/// <summary>
        /// 删除排序条件
        /// </summary>
        /// <param name="index"></param>
        public void Remove(int index)
        {
            #region
            if (index > Count - 1 || index < 0)
            {
                ExtConsole.WriteWithColor("删除排序时,索引出错!");
                return;
            }
            List.RemoveAt(index);

            #endregion
        }
        /// <summary>
        /// 增加排序条件(可以改进查找匹配算法?)
        /// </summary>
        /// <param name="sqlExpression"></param>
        public void Add(PageSort pagesort)
        {
            #region

            for (int i = 0; i < this.Count; i++)
            {
                if (pagesort._FieldName
                    == ((PageSort)List[i])._FieldName)
                {
                    ExtConsole.WriteWithColor("不能重复添加排序字段!");
                    return;
                }
            }
            List.Add(pagesort);
            #endregion
        }
Пример #3
0
        /// <summary>
        /// 更新App.config文件对应键值
        /// </summary>
        /// <param name="keyName">键名</param>
        /// <param name="value">更新值</param>
        public static void Update(object keyName, ref object newValue)
        {
            #region
            if (_configCacheGroup.Contains(keyName))
            {
                if (_configCacheGroup[keyName] != newValue)
                {
                    //此处给对应的键进行赋值,下面的save操作会应用此更新。
                    _configuration.AppSettings.Settings[keyName.ToString()].Value = newValue.ToString();

                    lock (_lockConfig)
                    {
                        _configuration.Save();
                        _configCacheGroup[keyName] = newValue;
                    }
                }
            }
            else
            {
                ExtConsole.Write(string.Format("系统应针对{0}键先进行读取后才可保存", keyName));
            }

            #endregion
        }