//根据父ID查询 public ActionResult DataLoad(int parentID) { int pageSize = int.Parse(Request.Form["rows"]); //获取请求的页码 int pageIndex = int.Parse(Request.Form["page"]); int rowCount = 0; P_PermissionBLL bll = new P_PermissionBLL(); //取权限list<Model>,new list<ID> 使用循环,将List<Model>中的ID 取出ADD进list<ID>中 再查询时,where 添加List<ID> contains(p.id) List <Model.P_Permission> mlist = UserOperateContext.Current.Session_UsrPermission.ToList(); List <int> listid = new List <int>(); for (int i = 0; i < mlist.Count; i++) { Model.P_Permission m = (Model.P_Permission)mlist[i]; listid.Add(m.ID); } // 查询分页数据 var list = bll.GetPagedList(pageIndex, pageSize, ref rowCount, p => p.ParentID == parentID && p.IsActive == true && listid.Contains(p.ID), p => p.SN).Select(p => p.ToPOCO()); // 生成规定格式的 json字符串发回 给异步对象 Model.EasyUIModel.DataGridModel dgModel = new Model.EasyUIModel.DataGridModel() { total = rowCount, rows = list, footer = null }; return(Json(dgModel)); }
public ActionResult GetAddPerView(int id) { var viewModel = new Model.ViewModel.Permission(); SetDropDonwList(); ViewBag.ID = viewModel.ID; if (id > 0) { //查一下父ID (传过来是父权限的ID) var model = new P_PermissionBLL().GetListBy(p => p.ID == id).FirstOrDefault(); if (model != null) { ViewBag.ParentID = model.ID; //父节点的ID ViewBag.ParentName = model.Name; viewModel.ParentName = model.Name; } } else { ViewBag.ParentID = 0; ViewBag.ParentName = "无"; viewModel.ParentName = "无"; } return(PartialView("EditPermission", viewModel)); }
//根据父ID查询 public ActionResult DataLoad(int parentID) { int pageSize = int.Parse(Request.Form["rows"]); //获取请求的页码 int pageIndex = int.Parse(Request.Form["page"]); int rowCount = 0; P_PermissionBLL bll = new P_PermissionBLL(); //取权限list<Model>,new list<ID> 使用循环,将List<Model>中的ID 取出ADD进list<ID>中 再查询时,where 添加List<ID> contains(p.id) List<Model.P_Permission> mlist = UserOperateContext.Current.Session_UsrPermission.ToList(); List<int> listid = new List<int>(); for (int i = 0; i < mlist.Count; i++) { Model.P_Permission m = (Model.P_Permission)mlist[i]; listid.Add(m.ID); } // 查询分页数据 var list = bll.GetPagedList(pageIndex, pageSize, ref rowCount, p => p.ParentID == parentID && p.IsActive == true && listid.Contains(p.ID), p => p.SN).Select(p => p.ToPOCO()); // 生成规定格式的 json字符串发回 给异步对象 Model.EasyUIModel.DataGridModel dgModel = new Model.EasyUIModel.DataGridModel() { total = rowCount, rows = list, footer = null }; return Json(dgModel); }
public ActionResult GetEditPerView() { //根据id查询要修改的权限 int id = int.Parse(Request.Form["id"]); var viewModel = new P_PermissionBLL().GetListBy(p => p.ID == id).FirstOrDefault().ToViewModel(); if (viewModel != null) { ViewBag.ID = viewModel.ID; var parent = new P_PermissionBLL().GetListBy(p => p.ID == viewModel.ParentID).FirstOrDefault(); if (parent != null) { ViewBag.ParentID = parent.ID; ViewBag.ParentName = parent.Name; viewModel.ParentName = parent.Name; } else { ViewBag.ParentID = 0; ViewBag.ParentName = "无"; viewModel.ParentName = "无"; } SetDropDonwList(); //设置下拉菜单 //将 权限对象 传给 视图 的 Model属性 return View("EditPermission", viewModel); } else { return this.JsonResult(Utility.E_JsonResult.Error, "没有查到此权限信息!", null, null); } }
public ActionResult GetAddPerView(int id) { var viewModel = new Model.ViewModel.Permission(); SetDropDonwList(); ViewBag.ID = viewModel.ID; if (id > 0) { //查一下父ID (传过来是父权限的ID) var model = new P_PermissionBLL().GetListBy(p => p.ID == id).FirstOrDefault(); if (model != null) { ViewBag.ParentID = model.ID; //父节点的ID ViewBag.ParentName = model.Name; viewModel.ParentName = model.Name; } } else { ViewBag.ParentID = 0; ViewBag.ParentName = "无"; viewModel.ParentName = "无"; } return PartialView("EditPermission", viewModel); }
public ActionResult GetRoleTree(int id) { //获取角色 权限ID var listRolePerIDs = new P_RolePermissionBLL().GetListBy(rp => rp.RoleID == id).Select(rp => rp.PermissionID); //获取所有 权限 var listAllPer = new P_PermissionBLL().GetListBy(p => p.IsActive == true).ToList(); //获取角色权限 var listRolePer = (from p in listAllPer where listRolePerIDs.Contains(p.ID) select p).ToList(); //获取父权限集合 var listParentPer = (from p in listAllPer where p.ParentID == 0 select p).ToList(); //var listParentPer = (from p in listAllPer select p).ToList(); //准备一个 角色id,传给视图 ViewBag.roleId = id; return(PartialView(new Model.ViewModel.RolePemissionTree() { RolePers = listRolePer, AllPers = listAllPer, AllParentPers = listParentPer })); }
//急救科统计 public ActionResult LinkJJ() { string LinkJJ = "LinkJJ"; P_PermissionBLL bll = new P_PermissionBLL(); Model.P_Permission info = bll.GetListBy(p => p.ActionName == LinkJJ && p.IsActive == true).FirstOrDefault(); ViewData["parentID"] = info.ID; return(View()); }
//调度业务数据统计 public ActionResult LinkDD() { string LinkDD = "LinkDD"; P_PermissionBLL bll = new P_PermissionBLL(); //在Permission表中先根据ActionName取出对应的info的ID,赋值给parentID 在DataLoad方法中取出所有"孩子" Model.P_Permission info = bll.GetListBy(p => p.ActionName == LinkDD && p.IsActive == true).FirstOrDefault(); ViewData["parentID"] = info.ID; return(View()); }
public ActionResult SavePermission(Model.ViewModel.Permission viewModel) { int res = -1; Model.P_Permission model = new Model.P_Permission(); model.ID = viewModel.ID; model.ParentID = viewModel.ParentID; model.Name = viewModel.Name; model.AreaName = viewModel.AreaName; model.ControllerName = viewModel.ControllerName; model.ActionName = viewModel.ActionName; model.FormMethod = viewModel.FormMethod; model.IsShow = viewModel.IsShow; model.Remark = viewModel.Remark; model.SN = viewModel.SN; if (new P_PermissionBLL().GetModelWithOutTrace(p => p.ID == model.ID) != null) { //修改修改 res = new P_PermissionBLL().Modify(model, "Name", "AreaName", "ControllerName", "ActionName", "FormMethod", "SN", "IsShow", "Remark"); } else { //增加权限 model.IsActive = true; res = new P_PermissionBLL().Add(model); } if (res > 0) { if (model.ParentID > 1) { return(Redirect("/DM/Permission/PermissionSon?pid=" + model.ParentID)); } else//如果新增的是 父权限,则跳到父权限列表 { return(Redirect("/DM/Permission/Index")); } } else { return(Redirect("/DM/Permission/Permission")); } }
/// <summary> /// 查询子权限列表数据 /// </summary> /// <returns></returns> public ActionResult PermissionSon(FormCollection form) { //获取页容量 int pageSize = int.Parse(form["rows"]); //获取请求的页码 int pageIndex = int.Parse(form["page"]); //获取父权限id int pid = int.Parse(Request.QueryString["pid"]); int rowCount = 0; // 查询分页数据 var list = new P_PermissionBLL().GetPagedList(pageIndex, pageSize, ref rowCount, p => p.ParentID == pid && p.IsActive == true, p => p.SN).Select(p => p.ToPOCO()); //2 生成规定格式的 json字符串发回 给 异步对象 Model.EasyUIModel.DataGridModel dgModel = new Model.EasyUIModel.DataGridModel() { total = rowCount, rows = list, footer = null }; return(Json(dgModel)); }
/// <summary> /// 权限列表 视图 /// </summary> /// <returns></returns> public ActionResult GetPermData() { //获取页容量 int pageSize = int.Parse(Request.Form["rows"]); //获取请求的页码 int pageIndex = int.Parse(Request.Form["page"]); int rowCount = 0; P_PermissionBLL bll = new P_PermissionBLL(); // 查询分页数据 var list = bll.GetPagedList(pageIndex, pageSize, ref rowCount, p => p.ParentID == 0 && p.IsActive == true, p => p.SN).Select(p => p.ToPOCO()); // 生成规定格式的 json字符串发回 给异步对象 Model.EasyUIModel.DataGridModel dgModel = new Model.EasyUIModel.DataGridModel() { total = rowCount, rows = list, footer = null }; return(Json(dgModel)); }
public ActionResult GetEditPerView() { //根据id查询要修改的权限 int id = int.Parse(Request.Form["id"]); var viewModel = new P_PermissionBLL().GetListBy(p => p.ID == id).FirstOrDefault().ToViewModel(); if (viewModel != null) { ViewBag.ID = viewModel.ID; var parent = new P_PermissionBLL().GetListBy(p => p.ID == viewModel.ParentID).FirstOrDefault(); if (parent != null) { ViewBag.ParentID = parent.ID; ViewBag.ParentName = parent.Name; viewModel.ParentName = parent.Name; } else { ViewBag.ParentID = 0; ViewBag.ParentName = "无"; viewModel.ParentName = "无"; } SetDropDonwList(); //设置下拉菜单 //将 权限对象 传给 视图 的 Model属性 return(View("EditPermission", viewModel)); } else { return(this.JsonResult(Utility.E_JsonResult.Error, "没有查到此权限信息!", null, null)); } }
//质量监控业务数据统计 public ActionResult LinkZJ() { string LinkZJ = "LinkZJ"; P_PermissionBLL bll = new P_PermissionBLL(); Model.P_Permission info = bll.GetListBy(p => p.ActionName == LinkZJ && p.IsActive == true).FirstOrDefault(); ViewData["parentID"] = info.ID; return View(); }
public ActionResult PermissionSon(FormCollection form) { //获取页容量 int pageSize = int.Parse(form["rows"]); //获取请求的页码 int pageIndex = int.Parse(form["page"]); //获取父权限id int pid = int.Parse(Request.QueryString["pid"]); int rowCount = 0; // 查询分页数据 var list = new P_PermissionBLL().GetPagedList(pageIndex, pageSize, ref rowCount, p => p.ParentID == pid && p.IsActive == true, p => p.SN).Select(p => p.ToPOCO()); //2 生成规定格式的 json字符串发回 给 异步对象 Model.EasyUIModel.DataGridModel dgModel = new Model.EasyUIModel.DataGridModel() { total = rowCount, rows = list, footer = null }; return Json(dgModel); }
public ActionResult SavePermission(Model.ViewModel.Permission viewModel) { int res = -1; Model.P_Permission model = new Model.P_Permission(); model.ID = viewModel.ID; model.ParentID = viewModel.ParentID; model.Name = viewModel.Name; model.AreaName = viewModel.AreaName; model.ControllerName = viewModel.ControllerName; model.ActionName = viewModel.ActionName; model.FormMethod = viewModel.FormMethod; model.IsShow = viewModel.IsShow; model.Remark = viewModel.Remark; model.SN = viewModel.SN; if (new P_PermissionBLL().GetModelWithOutTrace(p => p.ID == model.ID) != null) { //修改修改 res = new P_PermissionBLL().Modify(model, "Name", "AreaName", "ControllerName", "ActionName", "FormMethod", "SN", "IsShow", "Remark"); } else { //增加权限 model.IsActive = true; res = new P_PermissionBLL().Add(model); } if (res > 0) { if (model.ParentID > 1) return Redirect("/DM/Permission/PermissionSon?pid=" + model.ParentID); else//如果新增的是 父权限,则跳到父权限列表 return Redirect("/DM/Permission/Index"); } else return Redirect("/DM/Permission/Permission"); }
//调度业务数据统计 public ActionResult LinkDD() { string LinkDD = "LinkDD"; P_PermissionBLL bll = new P_PermissionBLL(); //在Permission表中先根据ActionName取出对应的info的ID,赋值给parentID 在DataLoad方法中取出所有"孩子" Model.P_Permission info = bll.GetListBy(p => p.ActionName == LinkDD && p.IsActive == true).FirstOrDefault(); ViewData["parentID"] = info.ID; return View(); }
public ActionResult GetPermData() { //获取页容量 int pageSize = int.Parse(Request.Form["rows"]); //获取请求的页码 int pageIndex = int.Parse(Request.Form["page"]); int rowCount = 0; P_PermissionBLL bll = new P_PermissionBLL(); // 查询分页数据 var list = bll.GetPagedList(pageIndex, pageSize, ref rowCount, p => p.ParentID == 0 && p.IsActive == true, p => p.SN).Select(p => p.ToPOCO()); // 生成规定格式的 json字符串发回 给异步对象 Model.EasyUIModel.DataGridModel dgModel = new Model.EasyUIModel.DataGridModel() { total = rowCount, rows = list, footer = null }; return Json(dgModel); }