Example #1
0
        /// <summary>
        /// 更新值
        /// </summary>
        /// <param name="id"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static bool Update(int id, string name, string value, string remark = "")
        {
            IDicConfig dic = Get(id);

            if (dic == null)
            {
                return(false);
            }
            //if (!dic.CanChange)
            //{
            //    return false;
            //}
            CRL.ParameCollection c = new ParameCollection();
            c["name"]  = name;
            c["value"] = value;
            if (!string.IsNullOrEmpty(remark))
            {
                c["remark"] = remark;
                dic.Remark  = remark;
            }
            Update <IDicConfig>(b => b.Id == id, c);
            dic.Name  = name;
            dic.Value = value;
            return(true);
        }
Example #2
0
        /// <summary>
        /// 取值
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static string GetValue(int id)
        {
            IDicConfig dic = Get(id);

            if (dic == null)
            {
                return("");
            }
            return(dic.Value);
        }
Example #3
0
        /// <summary>
        /// 添加一项
        /// </summary>
        /// <param name="dic"></param>
        /// <returns></returns>
        public int Add(IDicConfig dic)
        {
            if (QueryItem(b => b.Name == dic.Name && b.DicType == dic.DicType) != null)
            {
                return(0);
            }
            int id = base.Add(dic);

            //ClearCache();
            return(id);
        }
Example #4
0
        /// <summary>
        /// 添加一项
        /// </summary>
        /// <param name="dic"></param>
        /// <returns></returns>
        public static int Add(IDicConfig dic)
        {
            if (allCache.Find(b => b.Name == dic.Name && b.DicType == dic.DicType) != null)
            {
                return(0);
            }
            DBExtend helper = dbHelper;
            int      id     = helper.InsertFromObj(dic);

            dic.Id = id;
            allCache.Add(dic);
            return(id);
        }