Hi Stanislav,
The resolution to the connector issue is as follows:
Within the dhtmlxSchedulerConnector.cs file, I modified the Request_BeforeSelect to use the following conditions:
void Request_BeforeSelect(object sender, EventArgs e)
{
//include start date if it wasn't included yet
if (!this.Request.RequestedFields.Contains(this.StartDateField))
this.Request.RequestedFields.Add(this.StartDateField);
//include finish date if it wasn't included yet
if (!this.Request.RequestedFields.Contains(this.FinishDateField))
this.Request.RequestedFields.Add(this.FinishDateField);
//merge requested fields with details fields
this.Request.RequestedFields = this.Request.RequestedFields.Union(this.DetailsFields).Distinct().ToFieldsCollection();
if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["to"]) && this.FinishDateField != null)
{
this.Request.Rules.Add(new FieldRule(this.StartDateField, Operator.Lower, Convert.ToDateTime(HttpContext.Current.Request.QueryString["to"]).ToString(Tools.DateFormat)));
}
if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["from"]) && this.StartDateField != null)
{
this.Request.Rules.Add(new FieldRule(this.FinishDateField, Operator.Greater, Convert.ToDateTime(HttpContext.Current.Request.QueryString["from"]).ToString(Tools.DateFormat)));
}
}
As for your resolution to the event’s changing colour, I have attempted to implement that “work around solution” (and was allready aware of it) however, it does not seem to have any effect on my project. The code I used is as follows:
scheduler.attachEvent("onAfterLightbox", function (){
//any custom logic here
scheduler.setCurrentView(scheduler.getState().date);
return true;
});
This is the code which I use to configure the colour for the specific event:
scheduler.templates.event_class=function(start,end,event){
return event.SchedulerType;
}
I also have some server side code which generates the classes for each of the different scheduler types (depending on what colour value is held in the database). However, I have debugged the JavaScript code by adding a breakpoint to return event.SchedulerType, and it seems as though the “SchedulerType” attribute is not held on the event variable, unless I do a full refresh of the page, therefore it will not matter if I attach that event.
I have a SchedulerEvents table which holds the details for each event, which has a link to a table called SchedulerTypes, which has the types of events, and details for that type (Event Colour, and other type data).
The SchedulerTypeId still seems to be retained, even though the SchedulerType and SchedulerColour is not getting populated in the event variable in the javascript. Below is the Custom SQL statements I am using on my connector:
dhtmlxSchedulerConnector connector = new dhtmlxSchedulerConnector(
@"Select EventId, UserId, JobId, SE.SchedulerTypeId, FromDate, ToDate, EventName, EventDescription, " +
@"IsBillable, IsTentative, ApprovedUserId, ApprovedDate, CreatedUserId, CreatedDate, UpdatedUserId, " +
@"UpdatedDate, SchedulerType, IsJob, SchedulerColour FROM SchedulerEvents SE JOIN SchedulerTypes ST ON SE.SchedulerTypeId = ST.SchedulerTypeId"
, "EventId"
, dhtmlxDatabaseAdapterType.SqlServer2005
, "MyConnectionString"
, "FromDate"
, "ToDate"
, "FromDate as FromDate, ToDate as ToDate, EventName as text, EventId as EventId, UserId as UserId, JobId as JobId, SE.SchedulerTypeId as SchedulerTypeId," +
" EventDescription as EventDescription, IsBillable as IsBillable, IsTentative as IsTentative, ApprovedUserId as ApprovedUserId, ApprovedDate as ApprovedDate," +
" CreatedUserId as CreatedUserId, CreatedDate as CreatedDate, UpdatedUserId as UpdatedUserId, UpdatedDate as UpdatedDate, SchedulerType as SchedulerType," +
" IsJob as IsJob, SchedulerColour as SchedulerColour"
);
connector.Request.CustomSQLs.Add(CustomSQLType.Delete, @"DELETE FROM [SchedulerEvents] WHERE EventId = {EventId}");
connector.Request.CustomSQLs.Add(CustomSQLType.Update, @"UPDATE [SchedulerEvents] " +
@" SET [UserId] = {UserId}," +
@" [JobId] = {JobId}," +
@" [SchedulerTypeId] = {SchedulerTypeId}," +
@" [FromDate] = '{FromDate}'," +
@" [ToDate] = '{ToDate}'," +
@" [EventName] = '{text}'," +
@" [EventDescription] = '{EventDescription}'," +
@" [IsBillable] = {IsBillable}," +
@" [IsTentative] = {IsTentative}," +
@" [ApprovedUserId] = {ApprovedUserId}," +
@" [ApprovedDate] = '{ApprovedDate}'," +
@" [UpdatedUserId] = " + Common.Session.UserId + "," +
@" [UpdatedDate] = '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "'" +
@" WHERE EventId = {EventId}");
connector.Request.CustomSQLs.Add(CustomSQLType.Insert, @"INSERT INTO [SchedulerEvents] " +
@"([UserId]," +
@" [JobId]," +
@" [SchedulerTypeId]," +
@" [FromDate]," +
@" [ToDate]," +
@" [EventName]," +
@" [EventDescription]," +
@" [IsBillable]," +
@" [IsTentative]," +
@" [ApprovedUserId]," +
@" [ApprovedDate]," +
@" [CreatedUserId]," +
@" [CreatedDate]," +
@" [UpdatedUserId]," +
@" [UpdatedDate])" +
@" VALUES" +
@" ({UserId}," +
@" {JobId}," +
@" {SchedulerTypeId}," +
@" '{FromDate}'," +
@" '{ToDate}'," +
@" '{text}'," +
@" '{EventDescription}'," +
@" {IsBillable}," +
@" {IsTentative}," +
@" {ApprovedUserId}," +
@" '{ApprovedDate}'," +
@" " + Common.Session.UserId + "," +
@" '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "'," +
@" {UpdatedUserId}," +
@" '{UpdatedDate}')");
Another issue which I have noticed recently may also have significance. If I drag and drop an event within the scheduler component in timeline view, I can not edit the event unless I do a full refresh of the page, or switch views. Thanks heaps again for your help, it is appreciated.
Kind regards
Greg Goldberg 