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 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) { 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 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 void Delete(System.Int32 id) { if (id < 4) { Response.Write("{\"statusCode\":\"300\", \"message\":\"内置角色不能删除\"}"); return; } int result = SysRoleDomain.GetInstance().DeleteModelById(id); Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"forward\",\"forwardUrl\":\"/SysRole/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
public ActionResult LoginNew(string userAccount, string password) { SysUser user = null; string result = SysUserDomain.GetInstance().Login(userAccount, password, out user); if (user != null) { Session["UserModel"] = user; Session["RoleId"] = user.RoleId; if (user.RoleId != null) { var roleModel = SysRoleDomain.GetInstance().GetModelById(user.RoleId); if (roleModel != null) { Session["RoleCode"] = roleModel.RoleCode; //1超级管理员,2部门领导,3普通职员 } } } return(Json(result, JsonRequestBehavior.AllowGet)); }
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)); }