示例#1
0
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            DateTimePickerDataPack data = new DateTimePickerDataPack();

            data.Mode = DictionaryHelper.GetValue(dictionary, "Mode", DateTimePickerMode.DateTimePicker);
            DateTime originalTime = DictionaryHelper.GetValue(dictionary, "Value", DateTime.MinValue);

            data.Value = TimeZoneContext.Current.ConvertLocalTimeToCurrent(originalTime);

            return(data);
        }
示例#2
0
        public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer)
        {
            DateTimePickerDataPack data = (DateTimePickerDataPack)obj;

            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            dictionary.Add("Mode", data.Mode);

            DateTime convertedTime = TimeZoneContext.Current.ConvertTimeToUtc(data.Value);

            dictionary.Add("Value", convertedTime);

            return(dictionary);
        }