Completed
Last Updated: 25 Mar 2015 13:09 by ADMIN
ADMIN
Dimitar
Created on: 11 Dec 2014 09:15
Category: Scheduler/Reminder
Type: Bug Report
0
FIX. RadScheduler - the reminder property cannot be saved properly in the database.
To reproduce: 
- Add mapping for the reminder property and try to save it in the database.

Workaround:
appointmentMappingInfo.Reminder = "Reminder";
appointmentMappingInfo.FindBySchedulerProperty("Reminder").ConvertToScheduler = ConvertReminderToScheduler;
appointmentMappingInfo.FindBySchedulerProperty("Reminder").ConvertToDataSource = ConvertReminderToDataSource;

 private object ConvertReminderToDataSource(object item)
private object ConvertReminderToDataSource(object item)
{
    TimeSpan? reminder = item as TimeSpan?;
    if (reminder != null)
    {
        return (int)reminder.Value.TotalMilliseconds;
    }

    return 0;
}

private object ConvertReminderToScheduler(object item)
{
    try
    {
        int value = Convert.ToInt32(item);
        if (value != 0)
        {
            return TimeSpan.FromMilliseconds(value);
        }

        return null;
    }
    catch
    {
        return null;
    }
}
0 comments