Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 删除表格配置模板
        /// </summary>
        /// <param name="templateID">模板ID</param>
        public void DeleteConfig(string templateID)
        {
            var index = TemplateList.IndexOf(p => p.ID.Equals(templateID));

            if (index > -1)
            {
                var    entity   = TemplateList[index];
                string fileName = entity.ConfigPath;
                string path     = GetPath(fileName);
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
                TemplateList.RemoveAt(index);
                SaveData();
            }
        }
Ejemplo n.º 3
0
        /// <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);
            }
        }
Ejemplo n.º 4
0
        public void BindConfigEntity()
        {
            ConfigData = GetConfigData();
            ListViewHelper.BindData(objectListView1, ConfigData);

            var index = ConfigData.IndexOf(p => p.IsDefault);

            if (index > -1)
            {
                objectListView1.Items[index].BackColor = Color.FromArgb(255, 255, 192);
            }
            btnParamNew.Enabled = btnEdit.Enabled = btnDelete.Enabled
                                                        = btnTest.Enabled = btnSetDefault.Enabled
                                                                                = objectListView1.SelectedIndex > -1 && objectListView1.Items.Count > 0;
        }