public ActionResult Delete(int id) { if (id == -1) { return(this.Direct()); } _service.DeleteRole(id); _service.Save(); return(View("Index", GetToolarPermission())); }
public ActionResult SaveManagementAuthorize(string managementOrgId, string authorizes) { ChangeRecords <ManagementAuthorizeDTO> records = new StoreDataHandler(authorizes).BatchObjectData <ManagementAuthorizeDTO>(); SA_Organization managementOrg = _service.GetOrgById(managementOrgId); foreach (var rec in records.Updated) { if (rec.Granted.ToLower() == "true") { SA_Authorize authorize = new SA_Authorize(); authorize.OrgId = managementOrg.Id; authorize.OrgName = managementOrg.Name; authorize.OrgIdPath = managementOrg.IdPath; authorize.OrgNamePath = managementOrg.NamePath; authorize.AuthorizeRoleId = rec.RoleId; authorize.CreatedBy = GetCurrentUserName(); authorize.CreatedDate = DateTime.Now; authorize.CreatedByIdPath = GetOrganizationIdPath(); authorize.CreatedByNamePath = GetOrganizationNamePath(); _service.AddAuthorize(authorize); } else { _service.DeleteAuthorize(managementOrg.Id, rec.RoleId); } } _service.Save(); return(this.Direct()); }
public ActionResult SaveManagementDataAuthorize(string managementOrgId, string authorizes) { ChangeRecords <ManagementAuthorizeDTO> records = new StoreDataHandler(authorizes).BatchObjectData <ManagementAuthorizeDTO>(); var curOrganization = _service.GetOrgById(managementOrgId); foreach (var updatedRec in records.Updated) { if (updatedRec.Granted.ToLower() == "true") { SA_Authorize role = new SA_Authorize { OrgId = curOrganization.Id, OrgName = curOrganization.Name, OrgIdPath = curOrganization.IdPath, OrgNamePath = curOrganization.NamePath, AuthorizeRoleId = updatedRec.RoleId, CreatedBy = GetCurrentUserName(), CreatedDate = DateTime.Now, CreatedByIdPath = GetOrganizationIdPath(), CreatedByNamePath = GetOrganizationNamePath() }; _service.AddAuthorize(role); } else { _service.DeleteAuthorize(curOrganization.Id, updatedRec.RoleId); } } _service.Save(); return(this.Direct()); }
public ActionResult SaveManagementRole(string currOrg, string roleManagement) { ChangeRecords <ManagementRoleDTO> records = new StoreDataHandler(roleManagement).BatchObjectData <ManagementRoleDTO>(); var curOrganization = _service.GetOrgById(currOrg); foreach (var updatedRec in records.Updated) { if (updatedRec.Granted.ToLower() == "true") { SA_ManagementRole role = new SA_ManagementRole { OrgId = curOrganization.Id, OrgName = curOrganization.Name, OrgIdPath = curOrganization.IdPath, OrgNamePath = curOrganization.NamePath, RoleId = ConvertToInt(updatedRec.Id), RoleType = updatedRec.RoleType, CreatedBy = GetCurrentUserName(), CreatedDate = DateTime.Now, CreatedByIdPath = GetOrganizationIdPath(), CreatedByNamePath = GetOrganizationNamePath() }; _service.AddManagementRole(role); } else { _service.DeleteManagementRole(updatedRec.ManagementId); } } _service.Save(); return(this.Direct()); }
public ActionResult Insert(SA_Resource entity) { if (ModelState.IsValid) { entity.Show = GetCheckBoxValue(entity.Show); entity.ResourceTypeId = 0; entity.Granted = "true"; _service.AddResource(entity); _service.Save(); RefreshTree(entity.ParentId); //this.GetCmp<Store>("storeSA_Resource").Reload(); return(this.Direct()); } return(this.Direct()); }
public ActionResult SavePermission(string rolePermissions) { ChangeRecords <SA_RolePermission> records = new StoreDataHandler(rolePermissions).BatchObjectData <SA_RolePermission>(); foreach (var saRolePermission in records.Updated) { _service.InsertOrUpdateRolePermission(saRolePermission); } _service.Save(); return(this.Direct()); }
public ActionResult SaveBusinessManagement(string currOrg, string businessManagement) { ChangeRecords <BusinessManagementDTO> records = new StoreDataHandler(businessManagement).BatchObjectData <BusinessManagementDTO>(); var curOrganization = _service.GetOrgById(currOrg); foreach (var updatedRec in records.Updated) { if (updatedRec.Granted.ToLower() == "true") { var targetOrganization = _service.GetOrgById(updatedRec.Id); SA_Management busManagement = new SA_Management { ManagementType = updatedRec.ManagementType, OrgId = curOrganization.Id, OrgName = curOrganization.Name, OrgIdPath = curOrganization.IdPath, OrgNamePath = curOrganization.NamePath, ManagementOrgId = targetOrganization.Id, ManagementOrgName = targetOrganization.Name, ManagementOrgIdPath = targetOrganization.IdPath, ManagementOrgNamePath = targetOrganization.NamePath, CreatedBy = GetCurrentUserName(), CreatedDate = DateTime.Now, CreatedByIdPath = GetOrganizationIdPath(), CreatedByNamePath = GetOrganizationNamePath() }; _service.AddBusinessManagement(busManagement); } else { _service.DeleteBusinessManagement(currOrg, updatedRec.Id, ManagementTypes.Business.ToString()); } } _service.Save(); return(this.Direct()); }
public ActionResult Delete(string id) { string parentId = _service.GetOrgById(id).ParentId; if (string.IsNullOrEmpty(id)) { return(this.Direct()); } _service.DeleteOrganization(id); _service.DeleteUser(id); _service.Save(); //this.GetCmp<TreeStore>("storeSAOrganization").Reload(); TreePanel treePanel = this.GetCmp <TreePanel>("treePanelSAOrganization"); treePanel.GetNodeById(parentId).Reload(); return(this.Direct()); }