Exemple #1
0
        /// <summary>
        /// 添加或者更新参数
        /// </summary>
        /// <param name="key">参数名称</param>
        /// <param name="value">参数值</param>
        /// <param name="comment">描述</param>
        /// <param name="category">分类</param>
        public void AddOrUpdate(string key, string value, string comment, string category)
        {
            var index = ParamData.IndexOf(p => p.Key.Equals(key));

            if (index == -1)
            {
                ParamEntity entity = new ParamEntity();
                entity.Key      = key;
                entity.Value    = value;
                entity.Comment  = comment;
                entity.Category = category;
                if (Insert(entity))
                {
                    ParamData.Add(entity);
                }
            }
            else
            {
                ParamEntity entity = ParamData[index];
                entity.Key   = key;
                entity.Value = value;
                if (!string.IsNullOrEmpty(comment))
                {
                    entity.Comment = comment;
                }
                if (!string.IsNullOrEmpty(category))
                {
                    entity.Category = category;
                }
                Update(entity);
            }
        }
        /// <summary>
        /// 获取外观类型数据
        /// </summary>
        protected virtual XCIList <XCIAppearanceObject> GetAppearanceData()
        {
            XCIList <XCIAppearanceObject> list = new XCIList <XCIAppearanceObject>();

            PropertyInfo[] pi             = AppearanceType.GetProperties();
            string         appearanceType = typeof(AppearanceObject).Name;

            foreach (PropertyInfo info in pi)
            {
                if (info.PropertyType.Name.Equals(appearanceType))
                {
                    XCIAppearanceObject obj = new XCIAppearanceObject();
                    string name             = info.Name;
                    string des = name;
                    if (ItemDescriptionDic.ContainsKey(name))
                    {
                        des = ItemDescriptionDic[name];
                    }
                    obj.Name        = name;
                    obj.Description = des;
                    obj.Spell       = SpellHelper.GetStringSpell(des);
                    list.Add(obj);
                }
            }
            return(list);
        }
Exemple #3
0
        /// <summary>
        /// 数据表转为实体列表
        /// </summary>
        /// <param name="table">数据表</param>
        public XCIList <T> ConvertToEntityList(DataTable table)
        {
            XCIList <T> list = new XCIList <T>();

            foreach (DataRow row in table.Rows)
            {
                list.Add(MapToEntity(row));
            }
            return(list);
        }
Exemple #4
0
        public static XCIList <string> GetObjectBasicPropertyList(object instance)
        {
            XCIList <string> propertyList = new XCIList <string>();

            PropertyInfo[] configPropertys = instance.GetType().GetProperties();
            foreach (PropertyInfo instanceInfo in configPropertys)
            {
                if (CheckBasicProperty(instanceInfo))
                {
                    propertyList.Add(instanceInfo.Name);
                }
            }
            return(propertyList);
        }
        protected string AddTemplateName(string gridID, string name)
        {
            var index = TemplateList.IndexOf(p => p.Name.Equals(name) && p.Name.Equals(name));

            if (index > -1)
            {
                return(TemplateList[index].ConfigPath);
            }
            string configPath = StringHelper.GetGuidString();
            GridConfigTemplateEntity entity = new GridConfigTemplateEntity();

            entity.ID         = StringHelper.GetGuidString();
            entity.Name       = name;
            entity.GridID     = gridID;
            entity.ConfigPath = configPath;
            TemplateList.Add(entity);
            return(configPath);
        }
Exemple #6
0
        /// <summary>
        /// 获取对象基本属性
        /// </summary>
        /// <param name="instance">对象</param>
        /// <returns>返回基本属性列表</returns>
        public static XCIList <XCIKeyValuePair <string, string> > GetObjectBasicProperty(object instance)
        {
            XCIList <XCIKeyValuePair <string, string> > propertyList = new XCIList <XCIKeyValuePair <string, string> >();

            PropertyInfo[] configPropertys = instance.GetType().GetProperties();
            foreach (PropertyInfo instanceInfo in configPropertys)
            {
                if (CheckBasicProperty(instanceInfo))
                {
                    object proValue = instanceInfo.GetValue(instance, null);
                    if (proValue != null)
                    {
                        propertyList.Add(
                            new XCIKeyValuePair <string, string>(instanceInfo.Name, proValue.ToString()));
                    }
                }
            }
            return(propertyList);
        }
        /// <summary>
        /// 添加或者更新数据字典
        /// </summary>
        /// <param name="entity">字典对象</param>
        public void AddOrUpdate(DataDictionaryEntity entity)
        {
            var index = DictionaryData.IndexOf(p => p.Code.Equals(entity.Code) && p.ItemName.Equals(entity.ItemName));

            if (index == -1)
            {
                if (Insert(entity))
                {
                    DictionaryData.Add(entity);
                }
            }
            else
            {
                DataDictionaryEntity _entity = DictionaryData[index];
                _entity.ItemName  = entity.ItemName;
                _entity.ItemValue = entity.ItemValue;
                if (!string.IsNullOrEmpty(entity.Comment))
                {
                    entity.Comment = entity.Comment;
                }
                Update(_entity);
            }
        }
Exemple #8
0
 /// <summary>
 /// 添加元数据
 /// </summary>
 /// <param name="metadata">元数据</param>
 public void Add(EntityMetadata metadata)
 {
     MetadataList.Add(metadata);
     Save();
 }