public void Save(SysRoleModels model) { int result = 0; try { if (model.Tag == "Add") { result = SysRoleDomain.GetInstance().AddModel(model.DataModel); } else if (model.Tag == "Edit") { result = SysRoleDomain.GetInstance().UpdateModel(model.DataModel, model.DataModel.RoleId); } } catch { } Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"closeCurrentReloadTab\",\"forwardUrl\":\"/SysRole/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
public ActionResult Save(System.Int32 id, string tag) { SysUserModels model = new SysUserModels(); model.DataModel = new SysUser(); //加载性别类型 List <SelectListItem> list = new List <SelectListItem>(); list.Add(new SelectListItem { Text = "启用", Value = "1" }); list.Add(new SelectListItem { Text = "禁用", Value = "0" }); ViewData["ZT"] = new SelectList(list, "Value", "Text", "请选择"); if (id != 0) { model.DataModel = SysUserDomain.GetInstance().GetModelById(id); } model.Tag = tag; //加载权限列表 SysRoleModels rolemode = new SysRoleModels(); rolemode.DataModel = rolemode.DataModel ?? new SysRole(); rolemode.DataList = SysRoleDomain.GetInstance().GetAllT_SysUser(rolemode.DataModel); ViewData["SysRole"] = new SelectList(rolemode.DataList, "RoleId", "RoleName", "请选择"); return(View("~/Views/SysUser/Save.cshtml", model)); }
public ActionResult Index(SysRoleModels evalModel) { try { evalModel.currentPage = int.Parse(Request["pageNum"].ToString()); } catch { } string order = ""; try { order = Request["orderField"].ToString(); } catch { } if (order.Trim() == "${param.orderField}") { order = ""; } int pagesize = Convert.ToInt32(evalModel.pageSize); int pagecount = Convert.ToInt32(evalModel.pagecount); int currentPage = Convert.ToInt32(evalModel.currentPage); evalModel.DataModel = evalModel.DataModel ?? new SysRole(); evalModel.DataList = SysRoleDomain.GetInstance().PageSysRole(evalModel.DataModel, evalModel.StartTime, evalModel.EndTime, currentPage, pagesize, out pagecount, out resultCount); evalModel.resultCount = resultCount; return(View("~/Views/SysRole/Index.cshtml", evalModel)); }
public ActionResult Save(System.Int32 id, string tag) { SysRoleModels model = new SysRoleModels(); model.DataModel = new SysRole(); if (id != 0) { model.DataModel = SysRoleDomain.GetInstance().GetModelById(id); } model.Tag = tag; return(View("~/Views/SysRole/Save.cshtml", model)); }
public ActionResult Save(System.Int32 id, string tag) { SysUserRoleModels model = new SysUserRoleModels(); model.DataModel = new SysUserRole(); //加载用户列表 SysUserModels usermode = new SysUserModels(); usermode.DataModel = usermode.DataModel ?? new SysUser(); usermode.DataList = SysUserDomain.GetInstance().GetAllT_SysUser(usermode.DataModel); ViewData["SysUser"] = new SelectList(usermode.DataList, "UserID", "UserName", "请选择"); //加载权限列表 SysRoleModels rolemode = new SysRoleModels(); rolemode.DataModel = rolemode.DataModel ?? new SysRole(); rolemode.DataList = SysRoleDomain.GetInstance().GetAllT_SysUser(rolemode.DataModel); ViewData["SysRole"] = new SelectList(rolemode.DataList, "RoleId", "RoleName", "请选择"); if (id != 0) { model.DataModel = SysUserRoleDomain.GetInstance().GetModelById(id); } model.Tag = tag; return(View("~/Views/SysUserRole/Save.cshtml", model)); }