issue with multi days appointments
Hi,
I'm using the schedulecontrol in Windows Forms and I have been able to verify that when there are several multi days appointments in a month, it only shows one of these appointments. I am using version 16.1.0.37 of this control.
Could you please provide a sample application that works? This example does not work and only shows one multi day appointment of 4.
I'm using the schedulecontrol in Windows Forms and I have been able to verify that when there are several multi days appointments in a month, it only shows one of these appointments. I am using version 16.1.0.37 of this control.
Could you please provide a sample application that works? This example does not work and only shows one multi day appointment of 4.
ArrayListDataProvider scheduleProvider;
scheduleProvider = new SimpleArrayListProvider();
scheduleProvider.MasterList =SimpleArrayListProvider.InitializeRandomData();
this.scheduleControl1.DataSource = scheduleProvider;
//Default value is true.
this.scheduleControl1.ShowMultiDayAppointmentsAsSpans =true;
Thanks
SIGN IN To post a reply.
4 Replies
SN
Sindhu Nagarajan
Syncfusion Team
June 5, 2018 01:08 PM UTC
Hi Carlos,
Sorry for the inconvenience caused.
If you want to add an appointment for multi days, you can use SimpleScheduleDataProvider as datasource to the schedule control. We have prepared a simple sample as per your requirement. In the sample, GetSchedule() method is overridden. By overriding the method, the appointment will be generated individually for the days from StartDate to the End Date. Please refer to the below code and sample,
Code Example
|
public override IScheduleAppointmentList GetSchedule(System.DateTime startDate, System.DateTime endDate)
{
ScheduleAppointmentList list = new ScheduleAppointmentList();
System.DateTime start = startDate.Date;
System.DateTime end = endDate.Date;
if (ScheduleList != null && ScheduleList.Count > 0)
{
return list;
}
foreach (ScheduleAppointment item in this.MasterList)
{
if ((item.StartTime.Date >= start && item.StartTime.Date <= end) || (item.EndTime.AddMinutes(-1).Date > start && item.EndTime.Date <= end))
{
if (item.StartTime < item.EndTime)
{
int count = ((TimeSpan)(item.EndTime.Date - item.StartTime.Date)).Days + 1;
System.DateTime meanDate = DateTime.Now;
System.DateTime meanStartDate = DateTime.Now;
System.DateTime tempEndTime = DateTime.Now;
bool intialized = true;
for (int i = 0; i < count; i++)
{
IScheduleAppointment item1 = item.Clone() as IScheduleAppointment;
if (intialized)
{
meanStartDate = item.StartTime;
meanDate = item.EndTime.Date;
tempEndTime = item.EndTime;
intialized = false;
}
else
{
item1.StartTime = meanStartDate.AddDays(i).Date;
}
if (item.StartTime.Date < meanDate)
{
item1.EndTime = item1.StartTime.Date;
}
else if (item.StartTime.Date.Equals(meanDate))
{
item1.EndTime = tempEndTime;
}
list.Add(item1);
}
}
else
{
list.Add(item);
}
}
}
list.SortStartTime();
ScheduleList = list;
return list;
} |
Screenshot
Sample Link: ScheduleControl
Please let us know if you have any other queries.
Regards,
Sindhu
CA
Carlos
June 5, 2018 01:56 PM UTC
Hi Sindhu,
Thanks for your answer but this is not what I need.
thank you for your patience.
According to the attached example, when there are several recorded appointments in the file and some take several days, the load of these days in the schedule control does it incorrectly. In particular there are 4 multiday appointments and only the first is shown.
I need to show it in multiday format (this.scheduleControl1.ShowMultiDayAppointmentsAsSpans = true)
thank you for your patience.
Attachment: CS2098752095_63615ff2.zip
SN
Sindhu Nagarajan
Syncfusion Team
June 6, 2018 12:46 PM UTC
Hi Carlos,
Thanks for the update.
We are able to reproduce the reported issue and logged a bug report for the issue. The fix for the issue will be included in our upcoming main release 2018_Volume3 which is estimated to be available at the end of September 2018.
Please let us know if you have any concerns.
Regards,
Sindhu
MG
Mohanraj Gunasekaran
Syncfusion Team
July 13, 2018 12:56 PM UTC
Hi Carlos,
Sorry for the inconvenience caused.
We have analyzed your provided sample. In your sample you have used ArrayListDataProvider. If you use the ArrayListDataProvider as a datasource of ScheduleControl, you should differentiate the every appointment by unique id. So, you can resolve this issue by using UniqueId and RecurrenceRuleId property. Please refer to the below code example and the sample,
Code example
|
ArrayListAppointmentList masterlist = new ArrayListAppointmentList();
for (int i = 0; i < 5; ++i)
{
ArrayListAppointment item = masterlist.NewScheduleAppointment() as ArrayListAppointment;
int dayOffSet = 30 - r.Next(60);
int hourOffSet = 24 - r.Next(48);
len += (i + 1);
item.StartTime = now.AddDays(i);
item.EndTime = item.StartTime.AddDays(2);// ((double)len);
item.Subject = string.Format("subject{0}", i);
item.Content = string.Format("content{0}", i);
item.LabelValue = i%10;
item.LocationValue = string.Format("location{0}", r1.Next(5));
item.UniqueID = this.GetUniqueID();
if (item.RecurrenceRuleID == -1)
item.RecurrenceRuleID = item.UniqueID;
item.ReminderValue = r1.Next(10) < 5 ? 0 : r1.Next(12);
item.Reminder = r1.Next(10) > 1;
item.AllDay = r1.Next(10) < 1;
item.MarkerValue = r1.Next(4);
item.Dirty = false;
masterlist.Add(item);
}
|
Sample link: ScheduleControl
Regards,
Mohanraj G
SIGN IN To post a reply.
- 4 Replies
- 3 Participants
-
CA Carlos
- Jun 4, 2018 03:49 PM UTC
- Jul 13, 2018 12:56 PM UTC