public void Save(SysResourceModels model) { int result = 0; try { if (model.Tag == "Add") { result = SysResourceDomain.GetInstance().AddModel(model.DataModel); } else if (model.Tag == "Edit") { result = SysResourceDomain.GetInstance().UpdateModel(model.DataModel, model.DataModel.ResourceId); } } catch { } Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"closeCurrentReloadTab\",\"forwardUrl\":\"/SysResource/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
public ActionResult Index(SysResourceModels 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 SysResource(); evalModel.DataList = SysResourceDomain.GetInstance().PageSysResource(evalModel.DataModel, evalModel.StartTime, evalModel.EndTime, currentPage, pagesize, out pagecount, out resultCount); evalModel.resultCount = resultCount; return(View("~/Views/SysResource/Index.cshtml", evalModel)); }
public ActionResult Save(System.Int32 id, string tag) { SysResourceModels model = new SysResourceModels(); model.DataModel = new SysResource(); if (id != 0) { model.DataModel = SysResourceDomain.GetInstance().GetModelById(id); } model.Tag = tag; return(View("~/Views/SysResource/Save.cshtml", model)); }
public void Delete(System.Int32 id) { int result = SysResourceDomain.GetInstance().DeleteModelById(id); Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"forward\",\"forwardUrl\":\"/SysResource/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
// GET: WebMain public ActionResult Index(WebMainModels model) { if (Session["UserModel"] != null) { try { SysUser UserModel = Session["UserModel"] as SysUser; model.ListResource = SysResourceDomain.GetInstance().GetPagesByUserId(UserModel.UserId); model.UserName = UserModel.UserName; var RoleCode = GetRoleCode(); model.RoleType = RoleCode == "1" ? "超级管理员" : (RoleCode == "2" ? "部门领导" : "普通员工"); return(View(model)); } catch (Exception) { return(RedirectToAction("Login", "WebMain")); } } else { return(RedirectToAction("Login", "WebMain")); } }