public ActionResult CreatDictionary() { SysPower(SysMenuConstant.MENU_DICTIONARY_MANAGE, SysMenuConstant.FUN_ADD, UserInfo.UserCode); var model = new SysDictionaryEntity(); model.Isenable = true; return(View("EidtDictionary", model)); }
public int Insert(SysDictionaryEntity model) { StringBuilder strsql = new StringBuilder(); strsql.Append("insert into sys_dictionary(dcode,parentcode,dname,dseq,isenable,dictype,remark,createby,createdate) "); strsql.Append(" values(@dcode,@parentcode,@dname,@dseq,@isenable,@dictype,@remark,@createby,@createdate)"); return(SqlHelper.Execute(strsql.ToString(), model)); }
public int Update(SysDictionaryEntity model) { StringBuilder strsql = new StringBuilder(); strsql.Append("update sys_dictionary set "); strsql.Append("dcode=@dcode,parentcode=@parentcode,dname=@dname,dseq=@dseq,isenable=@isenable,dictype=@dictype,remark=@remark,createby=@createby,createdate=@createdate"); strsql.Append(" where id=@id "); return(SqlHelper.Execute(strsql.ToString(), model)); }
public JsonResult SaveDictionary(SysDictionaryEntity model) { var menuname = StringHelper.GetStrLength(model.Dname); bool power = true; if (menuname == 0 || menuname > 30) { return(new CustomerJsonResult(new ResponseResult { code = ResponseHelper.ORPARAMCODE, msg = "名称不合法" })); } if (string.IsNullOrWhiteSpace(model.Dcode)) { return(new CustomerJsonResult(new ResponseResult { code = ResponseHelper.ORPARAMCODE, msg = "代码不能为空" })); } model.Createby = UserInfo.UserCode; model.Createdate = DateTime.Now; if (Request.Form["isenable"].ToString() == "0") { model.Isenable = false; } else { model.Isenable = true; } int result = 0; if (model.Id > 0) { power = SysPower(SysMenuConstant.MENU_DICTIONARY_MANAGE, SysMenuConstant.FUN_UPDATE, UserInfo.UserCode, false); if (!power) { return(new CustomerJsonResult(new ResponseResult { code = ResponseHelper.FAILCODE, msg = "权限不足" })); } result = ISysDictionaryService.Update(model); } else { power = SysPower(SysMenuConstant.MENU_DICTIONARY_MANAGE, SysMenuConstant.FUN_ADD, UserInfo.UserCode, false); if (!power) { return(new CustomerJsonResult(new ResponseResult { code = ResponseHelper.FAILCODE, msg = "权限不足" })); } result = ISysDictionaryService.Insert(model); } if (result > 0) { return(new CustomerJsonResult(new ResponseResult { code = ResponseHelper.ESUCCESSCODE, msg = "保存成功" })); } else { return(new CustomerJsonResult(new ResponseResult { code = ResponseHelper.FAILCODE, msg = "保存失败" })); } }