public JsonResult LoadAccountPermission(string strFuncId, string strPermission) { //读取数据 string strErrText; PermissionSystem permission = new PermissionSystem(); bool data = permission.LoadAccountPermission(long.Parse(strFuncId), strPermission, LoginAccountId, LoginStaffName, out strErrText); return Json(data, JsonRequestBehavior.AllowGet); }
public ActionResult AssignPermissions(AccountPermissionViewModel model) { if (ModelState.IsValid) { //保存数据 string strErrText; PermissionSystem permission = new PermissionSystem(); if (permission.UpdateAccountPermissions(model.AccountId, model.Groups, LoginAccountId, LoginStaffName, out strErrText)) { return Json(string.Empty); } else { return Json(strErrText); } } return View(model); }
public JsonResult LoadFunctionPermission(string strFuncId, string strPermission) { //读取数据 string strErrText; PermissionSystem permission = new PermissionSystem(); int data = permission.LoadFunctionPermission(long.Parse(strFuncId), strPermission, LoginAccountId, LoginStaffName, out strErrText); if (data < 0) { throw new Exception(strErrText); } if (data == 1) return Json(true, JsonRequestBehavior.AllowGet); else return Json(false, JsonRequestBehavior.AllowGet); }
public JsonResult LoadAccountPermissions(long nAccountId) { //读取全部数据 string strErrText; PermissionSystem permission = new PermissionSystem(); List<AccountPermission> listPermission = permission.LoadAccountPermissions(nAccountId, LoginAccountId, LoginStaffName, out strErrText); if (listPermission == null) { throw new Exception(strErrText); } return Json(listPermission, JsonRequestBehavior.AllowGet); }
public ActionResult NewPermissionGroup(PermissionGroupViewModel model) { if (ModelState.IsValid) { //保存数据 string strErrText; PermissionSystem permission = new PermissionSystem(); if (permission.InsertPermissionGroup(model.Name, model.Remark ?? string.Empty, model.Functions, LoginAccountId, LoginStaffName, out strErrText) > 0) { return Json(string.Empty); } else { return Json(strErrText); } } return View(model); }
public ActionResult ModifyPermissionGroup(string id) { string strErrText; //生成Model数据 long nGroupId = long.Parse(id); PermissionSystem permission = new PermissionSystem(); SysGroup data = permission.LoadPermissionGroup(nGroupId, LoginAccountId, LoginStaffName, out strErrText); if (data == null) { throw new Exception(strErrText); } PermissionGroupViewModel model = new PermissionGroupViewModel(); model.Id = data.Id; model.Name = data.Name; model.Remark = data.Remark; return View(model); }
public ActionResult DeletePermissionGroup(string id) { //删除数据 string strErrText; PermissionSystem permission = new PermissionSystem(); if (permission.DeletePermissionGroup(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText)) { return Json(string.Empty); } else { return Json(strErrText); } }
public JsonResult LoadPermissionGroupsGrid(string sidx, string sord, int page, int rows) { //读取全部数据 string strErrText; PermissionSystem permission = new PermissionSystem(); List<SysGroup> listGroup = permission.LoadPermissionGroups(LoginAccountId, LoginStaffName, out strErrText); if (listGroup == null) { throw new Exception(strErrText); } //提取当前页面数据 int nTotalRows = listGroup.Count; int nPageIndex = page; int nPageSize = rows; int nTotalPages = nTotalRows / nPageSize; if (nTotalRows % nPageSize > 0) nTotalPages++; string sortExpression = (sidx ?? "GroupId") + " " + (sord ?? "ASC"); var data = listGroup.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList(); //生成表格数据 var ret = new { total = nTotalPages, page = nPageIndex, records = nTotalRows, rows = ( from g in data select new { id = g.Id, cell = new string[] { g.Id.ToString(), g.Name, g.Remark } }).ToArray() }; return Json(ret, JsonRequestBehavior.AllowGet); }
public JsonResult LoadGroupPermissionsGrid(string id, string sidx, string sord, int page, int rows) { //读取全部数据 string strErrText; PermissionSystem permission = new PermissionSystem(); List<SysGroupPermission> listPermission = permission.LoadGroupPermissions(long.Parse(id), LoginAccountId, LoginStaffName, out strErrText); if (listPermission == null) { throw new Exception(strErrText); } //提取当前页面数据 int nTotalRows = listPermission.Count; int nPageIndex = page; int nPageSize = rows; int nTotalPages = nTotalRows / nPageSize; if (nTotalRows % nPageSize > 0) nTotalPages++; string sortExpression = (sidx ?? "FuncId") + " " + (sord ?? "ASC"); var data = listPermission.OrderBy(sortExpression).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList(); //生成表格数据 var ret = new { total = nTotalPages, page = nPageIndex, records = nTotalRows, rows = ( from f in data select new { id = f.FuncId, cell = new string[] { f.FuncId.ToString(), f.FuncName, f.AllowOpen.ToString(), f.AllowNew.ToString(), f.AllowModify.ToString(), f.AllowDelete.ToString(), f.AllowCancel.ToString(), f.AllowDetail.ToString(), f.AllowSearch.ToString(), f.AllowSubmit.ToString(), f.AllowApprove.ToString(), f.AllowDispatch.ToString(), f.AllowExport.ToString(), f.AllowImport.ToString(), f.AllowPrint.ToString() } }).ToArray() }; return Json(ret, JsonRequestBehavior.AllowGet); }