/// <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); }
/// <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); }
/// <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); }
/// <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); }