public M_Dictionary ToDictionary()
 {
     //对象的初始化器直接构造
     M_Dictionary dic = new M_Dictionary()
     {
         ID = this.ID.ToString(),
         Name = this.Name,
     };
     return dic;
 }
Exemple #2
0
        public M_Dictionary ToDictionary()
        {
            //对象的初始化器直接构造
            M_Dictionary dic = new M_Dictionary()
            {
                ID   = this.ID.ToString(),
                Name = this.Name,
            };

            return(dic);
        }
 //修改
 public ActionResult EditDictionary()
 {
     string DictionaryID = Request.Form["DID"].ToString();
     string DictionaryName = Request.Form["DictionaryName"].ToString();
     int SN = int.Parse(Request.Form["SN"]);
     M_Dictionary dic = new M_Dictionary();
     dic.ID = DictionaryID;
     dic.Name = DictionaryName;
     dic.SN = SN;
     if (new M_DictionaryBLL().Modify(dic, "Name", "SN") > 0)
     {
         return this.JsonResult(Utility.E_JsonResult.OK, "修改字典信息成功!", null, null);
     }
     else
     {
         return this.JsonResult(Utility.E_JsonResult.Error, "修改字典信息失败!", null, null);
     }
 }
        //新增字典信息,ID为TypeID和最大TypeID数量+1的拼出结果。
        public ActionResult AddDictionary()
        {
            string TDictionaryType = Request.Form["TDictionaryType"].ToString();
            int maxID = new TDictionaryBLL().GetMaxDictionaryID(TDictionaryType, "M_Dictionary");
            string newID = TDictionaryType + "-" + (maxID).ToString();

            int newSN = int.Parse(Request.Form["SN"]);
            string newName = Request.Form["DinctionaryName"].ToString();

            M_Dictionary dic = new M_Dictionary();
            dic.ID = newID;
            dic.Name = newName;
            dic.TypeID = TDictionaryType;
            dic.SN = newSN;
            dic.IsActive = true;

            if (new M_DictionaryBLL().Add(dic) > 0)
            {
                return this.JsonResult(Utility.E_JsonResult.OK, "新增字典信息成功!", null, null);
            }
            else
                return this.JsonResult(Utility.E_JsonResult.Error, "新增字典信息失败!", null, null);
        }
 public ActionResult updataActive()
 {
     string DictionaryID = Request.Form["DID"].ToString();
     bool isActive = Convert.ToBoolean(Request.Form["isActive"]);
     M_Dictionary dic = new M_Dictionary();
     dic.ID = DictionaryID;
     dic.IsActive = isActive;
     if (new M_DictionaryBLL().Modify(dic, "IsActive") > 0)
     {
         return this.JsonResult(Utility.E_JsonResult.OK, "修改字典信息成功!", null, null);
     }
     else
     {
         return this.JsonResult(Utility.E_JsonResult.Error, "修改字典信息失败!", null, null);
     }
 }