コード例 #1
0
        public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer)
        {
            Dictionary <string, object> dictionary            = new Dictionary <string, object>();
            SchemaPropertyDefine        sechemaPropertyDefine = (SchemaPropertyDefine)obj;

            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "name", sechemaPropertyDefine.Name);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "displayName", sechemaPropertyDefine.DisplayName);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "category", sechemaPropertyDefine.Category);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "defaultValue", sechemaPropertyDefine.DefaultValue);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "dataType", sechemaPropertyDefine.DataType);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "description", sechemaPropertyDefine.Description);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "readOnly", sechemaPropertyDefine.ReadOnly);

            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "visible", sechemaPropertyDefine.Visible);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "editorKey", sechemaPropertyDefine.EditorKey);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "editorParams", sechemaPropertyDefine.EditorParams);

            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "validators", sechemaPropertyDefine.Validators);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "clientVdtData", sechemaPropertyDefine.GetPropertyValidator());

            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "sortOrder", sechemaPropertyDefine.SortOrder);

            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "tab", sechemaPropertyDefine.Tab);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "snapshotMode", sechemaPropertyDefine.SnapshotMode);
            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "snapshotFieldName", sechemaPropertyDefine.SnapshotFieldName);

            return(dictionary);
        }
コード例 #2
0
        private static object GetPropertyValue(VersionedSchemaObjectBase obj, SchemaPropertyDefine pd)
        {
            try
            {
                object defaultValue = TypeCreator.GetTypeDefaultValue(pd.DataType.ToRealType());

                object result = defaultValue;

                if (pd.DataType == PropertyDataType.Enum)
                {
                    result = obj.Properties.GetValue(pd.Name, (object)null);
                }
                else
                {
                    result = obj.Properties.GetValue(pd.Name, defaultValue);
                }

                return(result);
            }
            catch (System.Exception ex)
            {
                throw new SystemSupportException(string.Format("生成Snapshot或全文检索时,{0}属性值获取错误: {1}", pd.Name, ex.Message),
                                                 ex);
            }
        }
コード例 #3
0
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            SchemaPropertyDefine sechemaPropertyDefine = new SchemaPropertyDefine();

            #region "PropertyDefine"
            sechemaPropertyDefine.Name         = DictionaryHelper.GetValue(dictionary, "name", string.Empty);
            sechemaPropertyDefine.DisplayName  = DictionaryHelper.GetValue(dictionary, "displayName", string.Empty);
            sechemaPropertyDefine.Category     = DictionaryHelper.GetValue(dictionary, "category", string.Empty);
            sechemaPropertyDefine.DefaultValue = DictionaryHelper.GetValue(dictionary, "defaultValue", string.Empty);
            sechemaPropertyDefine.DataType     = DictionaryHelper.GetValue(dictionary, "dataType", PropertyDataType.String);
            sechemaPropertyDefine.Description  = DictionaryHelper.GetValue(dictionary, "description", string.Empty);
            sechemaPropertyDefine.ReadOnly     = DictionaryHelper.GetValue(dictionary, "readOnly", false);
            sechemaPropertyDefine.Visible      = DictionaryHelper.GetValue(dictionary, "visible", true);
            sechemaPropertyDefine.EditorKey    = DictionaryHelper.GetValue(dictionary, "editorKey", string.Empty);
            sechemaPropertyDefine.EditorParams = DictionaryHelper.GetValue(dictionary, "editorParams", string.Empty);
            sechemaPropertyDefine.SortOrder    = DictionaryHelper.GetValue(dictionary, "sortOrder", 0xFFFF);

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

            sechemaPropertyDefine.Tab               = DictionaryHelper.GetValue(dictionary, "tab", string.Empty);
            sechemaPropertyDefine.SnapshotMode      = DictionaryHelper.GetValue(dictionary, "snapshotMode", default(SnapshotModeDefinition));
            sechemaPropertyDefine.SnapshotFieldName = DictionaryHelper.GetValue(dictionary, "snapshotFieldName", string.Empty);

            return(sechemaPropertyDefine);
        }
コード例 #4
0
        private static string GetFieldName(ORMappingItemCollection mapping, SchemaPropertyDefine pd)
        {
            string result = pd.SnapshotFieldName;

            if (result.IsNullOrEmpty())
            {
                result = pd.Name;

                ORMappingItem item = mapping.Find(m => m.PropertyName == pd.Name);

                if (item != null)
                {
                    result = item.DataFieldName;
                }
            }

            return(result);
        }
コード例 #5
0
        protected void TestClick(object sender, EventArgs e)
        {
            string auSchemaID = Request.QueryString["auSchemaID"];
            var    ext        = new AU.SchemaPropertyExtension("AdminUnits", auSchemaID, "Demo");
            var    ppt        = new MCS.Library.SOA.DataObjects.Schemas.SchemaProperties.SchemaPropertyDefine()
            {
                Name         = "Test",
                DataType     = MCS.Library.SOA.DataObjects.PropertyDataType.String,
                DefaultValue = "222",
                MaxLength    = 12,
                Category     = "ABC",
                Description  = "描述",
                DisplayName  = "测试属性",
                IsRequired   = true,
                ShowTitle    = true,
                Visible      = true,
                Tab          = "Basic",
                ReadOnly     = false,
            };

            ppt.Validators.Add(new MCS.Library.SOA.DataObjects.PropertyValidatorDescriptor()
            {
                MessageTemplate = "属性值有误",
                Name            = "DefaultValidator",
                Tag             = "bb",
                TypeDescription = "aaa"
            });

            ppt.Validators[0].Parameters.Add(new MCS.Library.SOA.DataObjects.PropertyValidatorParameterDescriptor()
            {
                DataType   = MCS.Library.SOA.DataObjects.PropertyDataType.String,
                ParamName  = "abc",
                ParamValue = "haha"
            });

            ext.Properties.Add(ppt);

            AU.Adapters.SchemaPropertyExtensionAdapter.Instance.Update(ext);
        }
コード例 #6
0
		protected void TestClick(object sender, EventArgs e)
		{
			string auSchemaID = Request.QueryString["auSchemaID"];
			var ext = new AU.SchemaPropertyExtension("AdminUnits", auSchemaID, "Demo");
			var ppt = new MCS.Library.SOA.DataObjects.Schemas.SchemaProperties.SchemaPropertyDefine()
			{
				Name = "Test",
				DataType = MCS.Library.SOA.DataObjects.PropertyDataType.String,
				DefaultValue = "222",
				MaxLength = 12,
				Category = "ABC",
				Description = "描述",
				DisplayName = "测试属性",
				IsRequired = true,
				ShowTitle = true,
				Visible = true,
				Tab = "Basic",
				ReadOnly = false,
			};

			ppt.Validators.Add(new MCS.Library.SOA.DataObjects.PropertyValidatorDescriptor()
			{
				MessageTemplate = "属性值有误",
				Name = "DefaultValidator",
				Tag = "bb",
				TypeDescription = "aaa"
			});

			ppt.Validators[0].Parameters.Add(new MCS.Library.SOA.DataObjects.PropertyValidatorParameterDescriptor()
			{
				DataType = MCS.Library.SOA.DataObjects.PropertyDataType.String,
				ParamName = "abc",
				ParamValue = "haha"
			});

			ext.Properties.Add(ppt);

			AU.Adapters.SchemaPropertyExtensionAdapter.Instance.Update(ext);
		}
コード例 #7
0
        public SchemaPropertyValue(SchemaPropertyDefine def)
        {
            ExceptionHelper.FalseThrow <ArgumentNullException>(def != null, "def");

            this._Definition = def;
        }