public void ConvertToPropertyValue(Type objectValueType, object objectValue, PropertyValue pv, object target)
		{
			pv.Definition.DataType = PropertyDataType.DateTime;

			if (objectValue != null && objectValue is DateTime)
				pv.StringValue = string.Format("{0:yyyy-MM-dd HH:mm:ss}", objectValue);
		}
		public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
		{
			PropertyDefine pd = new PropertyDefine();

			pd.Name = DictionaryHelper.GetValue(dictionary, "name", string.Empty);
			pd.DisplayName = DictionaryHelper.GetValue(dictionary, "displayName", string.Empty);
			pd.Category = DictionaryHelper.GetValue(dictionary, "category", string.Empty);
			pd.DefaultValue = DictionaryHelper.GetValue(dictionary, "defaultValue", string.Empty);
			pd.DataType = DictionaryHelper.GetValue(dictionary, "dataType", PropertyDataType.String);
			pd.Description = DictionaryHelper.GetValue(dictionary, "description", string.Empty);
			pd.ReadOnly = DictionaryHelper.GetValue(dictionary, "readOnly", false);
			pd.Visible = DictionaryHelper.GetValue(dictionary, "visible", true);
			pd.EditorKey = DictionaryHelper.GetValue(dictionary, "editorKey", string.Empty);
			pd.PersisterKey = DictionaryHelper.GetValue(dictionary, "persisterKey", string.Empty);
            pd.EditorParamsSettingsKey = DictionaryHelper.GetValue(dictionary, "editorParamsSettingsKey", string.Empty);
            pd.EditorParams = DictionaryHelper.GetValue(dictionary, "editorParams", string.Empty);
			pd.SortOrder = DictionaryHelper.GetValue(dictionary, "sortOrder", 0xFFFF);
			pd.MaxLength = DictionaryHelper.GetValue(dictionary, "maxLength", 0xFFFF);
			pd.IsRequired = DictionaryHelper.GetValue(dictionary, "isRequired", false);
            pd.ShowTitle = DictionaryHelper.GetValue(dictionary, "showTitle", true);

			if (dictionary.ContainsKey("validators") == true)
			{
				PropertyValidatorDescriptorCollection validators = JSONSerializerExecute.Deserialize<PropertyValidatorDescriptorCollection>(dictionary["validators"]);
				pd.Validators.Clear();
				pd.Validators.CopyFrom(validators);
			}

			PropertyValue pv = new PropertyValue(pd);

			pv.StringValue = DictionaryHelper.GetValue(dictionary, "value", (string)null);

			return pv;
		}
        /// <summary>
        /// 客户端的属性值传递到服务器端,不会去改变服务器端的属性定义
        /// </summary>
        /// <param name="cpv"></param>
        /// <param name="pv"></param>
        public void ClientToServer(ClientPropertyValue cpv, PropertyValue pv)
        {
            cpv.NullCheck("cpv");

            if (pv != null)
                pv.StringValue = cpv.StringValue;
        }
        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            PropertyDefine pd = new PropertyDefine();

            pd.Name = DictionaryHelper.GetValue(dictionary, "name", string.Empty);

            PropertyValue pv = new PropertyValue(pd);

            pv.StringValue = DictionaryHelper.GetValue(dictionary, "value", (string)null);

            return pv;
        }
        public void ServerToClient(PropertyValue pv, ClientPropertyValue cpv)
        {
            pv.NullCheck("pv");
            cpv.NullCheck("cpv");

            cpv.DataType = pv.Definition.DataType.ToClientPropertyDataType();
            cpv.Key = pv.Definition.Name;

            if (pv.StringValue.IsNullOrEmpty())
                cpv.StringValue = pv.Definition.DefaultValue;
            else
                cpv.StringValue = pv.StringValue;
        }
		public abstract void Save(PropertyValue currentProperty);
		public abstract void Load(PropertyValue currentProperty);
Example #8
0
        /// <summary>
        /// 复制属性的值
        /// </summary>
        /// <returns></returns>
        public PropertyValue Clone()
        {
            PropertyValue newValue = new PropertyValue(this._Definition);

            newValue._StringValue = this._StringValue;

            return newValue;
        }
 public object PropertyValueToObjectValue(PropertyValue pv, Type objectValueType, object originalObjectValue, object target)
 {
     return(DataConverter.ChangeType(pv.GetRealValue(), objectValueType));
 }
		public object PropertyValueToObjectValue(PropertyValue pv, Type objectValueType, object originalObjectValue, object target)
		{
			return DataConverter.ChangeType(pv.GetRealValue(), objectValueType);
		}