/// <summary> /// Creates the control(s) necessary for prompting user for a new value /// </summary> /// <param name="configurationValues">The configuration values.</param> /// <param name="id"></param> /// <returns> /// The control /// </returns> public override System.Web.UI.Control EditControl(Dictionary <string, ConfigurationValue> configurationValues, string id) { var eventCalendarPicker = new EventCalendarPicker { ID = id }; if (EventCalendarCache.All().Any()) { return(eventCalendarPicker); } return(null); }
/// <summary> /// Sets the value. /// Expects value as a EventCalendar.Guid as string /// </summary> /// <param name="control">The control.</param> /// <param name="configurationValues">The configuration values.</param> /// <param name="value">The value.</param> public override void SetEditValue(System.Web.UI.Control control, Dictionary <string, ConfigurationValue> configurationValues, string value) { EventCalendarPicker eventCalendarPicker = control as EventCalendarPicker; if (eventCalendarPicker != null) { Guid guid = value.AsGuid(); // get the item (or null) and set it var eventCalendar = EventCalendarCache.Get(guid); eventCalendarPicker.SetValue(eventCalendar == null ? "0" : eventCalendar.Id.ToString()); } }
/// <summary> /// Reads new values entered by the user for the field /// returns EventCalendar.Guid as string /// </summary> /// <param name="control">Parent control that controls were added to in the CreateEditControl() method</param> /// <param name="configurationValues">The configuration values.</param> /// <returns></returns> public override string GetEditValue(System.Web.UI.Control control, Dictionary <string, ConfigurationValue> configurationValues) { EventCalendarPicker eventCalendarPicker = control as EventCalendarPicker; if (eventCalendarPicker != null) { int?eventCalendarId = eventCalendarPicker.SelectedEventCalendarId; if (eventCalendarId.HasValue) { var eventCalendar = EventCalendarCache.Get(eventCalendarId.Value); if (eventCalendar != null) { return(eventCalendar.Guid.ToString()); } } } return(string.Empty); }