Hello, I have a problem with the function Datamanager.GetActivities.The problem occurs only with recurring appointments. I create the following series • IsTimeZoneNeutral = True • FREQ = DAILY; INTERVAL = 1, COUNT = 10; WKST = MO GetActivities gives me two results on the first day
and the last day of the series no result.
I plan all the dates separately delivered correctly by GetActivities. Thanks for your support
I see. The logic must be including the initial activity if it intersects since this only happens with the first day. We can look at changing this but the modification I suggested would deal with it without any adverse affects. i.e.
private void button1_Click(object sender, RoutedEventArgs e) { var d = DateTime.Now.AddDays(2); var d1 = new DateTime(d.Year, d.Month, d.Day, 0, 0, 0); var d2 = new DateTime(d.Year, d.Month, d.Day, 23, 59, 59); var localRange = new Infragistics.DateRange( d1 ); var result = dataManager.GetActivities(new ActivityQuery( ActivityTypes.Appointment, new DateRange( localRange.Start.ToUniversalTime(), localRange.End.ToUniversalTime() ), calendars[0])); var localToken = dataManager.DataConnector.TimeZoneInfoProviderResolved.LocalToken; string activities = ""; int i = 1; foreach (Appointment app in result.Activities) { if ( app.GetEndLocal( localToken ) == localRange.Start && app.Start != app.End ) continue; activities += i + ": " + app.Subject + "\n"; i++; } Console.WriteLine(activities); localRange = new DateRange( d1, d2 ); result = dataManager.GetActivities(new ActivityQuery( ActivityTypes.Appointment, new DateRange( localRange.Start.ToUniversalTime(), localRange.End.ToUniversalTime() ), calendars[0])); activities = ""; i = 1; foreach (Appointment app in result.Activities) { if ( app.GetEndLocal( localToken ) == localRange.Start && app.Start != app.End ) continue; activities += i + ": " + app.Subject + "\n"; i++; } Console.WriteLine(activities); }
Hallo Andrew,
thanks for the quick replay.
Please please change the method used in the example AddDays 2days then only one activity displayed.that would have to be linear behavior
Thank you.
The range you are passing is in a 0 minute range starting at midnight (e.g. Monday 1/21/2013 00:00:00). The query manager returns all activities that intersect with this time. In your case you have 2 day long activities so one goes from Sunday 1/20/2013 00:00:00 to Monday 1/21/2013 00:00:00 and another goes from Monday 1/21/2013 00:00:00 to Tuesday 1/21/2013 00:00:00. Since you have 2 activities that intersect with Monday 1/21/2013 00:00:00 you get 2 results. Now the display/view controls treat the end date as exclusive (unless the activity is a 0 minute activity) so the view would skip that activity but the query result doesn't assume that so you get both. If you want to ignore the end time as well then you might do something like:
var localRange = new Infragistics.DateRange( d1 );var utcRange = new DateRange( localRange.Start.ToUniversalTime(), localRange.End.ToUniversalTime() );var result = dataManager.GetActivities(new ActivityQuery( ActivityTypes.Appointment, utcRange, calendars[0]));var localToken = dataManager.DataConnector.TimeZoneInfoProviderResolved.LocalToken;string activities = "";int i = 1;foreach (Appointment app in result.Activities){ if ( app.GetEndLocal( localToken ) == localRange.Start && app.Start != app.End ) continue;
Hello Krasimir
I modified the example again.Please look at the issue ... now the next day, two Activities displayed.
Hello Marcus,
After further investigated this behavior and also contacted our Development Team regarding it and it seems that actually, you need to pass the universal time to the ActivityQuery, since the XamScheduleDataManager is not aware in which time zone you are making the request, so the DateRange is expecting a UTC time.
Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support