public static List <RolePermissionsViewModel> GetRolePermissionsListByRoleId(int Id) { List <RolePermissionsViewModel> RList = new List <RolePermissionsViewModel>(); RolePermissionsDAL.GetRolePermissionsListByRolId(Id).ForEach(r => RList.Add(new RolePermissionsViewModel(r))); return(RList); }
public RolePermissionsViewModel(RolePermissionsDAL R) { _Id = R.RolePermissions.Id; _Permission_Id = R.RolePermissions.Permission_Id.GetValueOrDefault(); _Roles_Id = R.RolePermissions.Roles_Id.GetValueOrDefault(); _InsertDate = R.RolePermissions.InsertDate.GetValueOrDefault(); _IsActive = R.RolePermissions.IsActive.GetValueOrDefault(); }
public void Create() { RolePermissionsDAL R = new RolePermissionsDAL(); R.RolePermissions.Id = _Id; R.RolePermissions.Permission_Id = _Permission_Id; R.RolePermissions.Roles_Id = _Roles_Id; R.RolePermissions.InsertDate = _InsertDate; R.RolePermissions.IsActive = _IsActive; R.Create(); _Id = R.RolePermissions.Id; }
/// <summary> /// Get Current User Permisson Can Do /// </summary> /// <returns></returns> public static bool CanDo(Permissons Perm) { if (HttpContext.Current.Request.IsAuthenticated) { string UserName = HttpContext.Current.User.Identity.GetUserName(); UserDAL user = new UserDAL(UserName); RolePermissionsDAL UserPerm = new RolePermissionsDAL(user.Users.Role_Id.GetValueOrDefault(), (int)Perm); if (UserPerm.RolePermissions != null) { return(UserPerm.RolePermissions.IsActive.GetValueOrDefault()); } else { return(false); } } else { return(false); } }
public ActionResult RolePermissionsGVPUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] App.Marriage.Models.RoleMV.RolePermissionsViewModel item) { //if (ModelState.IsValid) //{ try { RolePermissionsDAL RP = new RolePermissionsDAL(item.Id); RP.RolePermissions.IsActive = item.IsActive; RP.Update(); // Insert here a code to update the item in your model } catch (Exception e) { ViewData["EditError"] = e.Message; } //} //else // ViewData["EditError"] = "Please, correct all errors."; var model = RolePermissionsViewModel.GetRolePermissionsList(); return(PartialView("~/Views/RolePermissions/_RolePermissionsGVP.cshtml", model)); }
public void Update() { RolePermissionsDAL R = new RolePermissionsDAL(); if (_Permission_Id != null && _Permission_Id != 0) { R.RolePermissions.Permission_Id = _Permission_Id; } if (_Roles_Id != null && _Roles_Id != 0) { R.RolePermissions.Roles_Id = _Roles_Id; } if (_IsActive != null) { R.RolePermissions.IsActive = _IsActive; } R.RolePermissions.InsertDate = DateTime.Now; R.Update(); }
public void revokePermissions(int rid, int pid) { if (SafeUser != null && SafeUser.isLoggedIn()) { try { SqlHelper helper = new SqlHelper(); SecurityDAL sdal = new SecurityDAL(helper); if (sdal.hasPermission(SafeUser.SignIN.UID, "USER")) { RolePermissionsDAL dal = new RolePermissionsDAL(helper); dal.revokePermission(rid, pid); log(200, "A permission is succesfully revoked"); } else { log(600, "(SP) Permission denied"); } }catch (Exception ex) { log(ex); } } }
public IEnumerable GetRolePermissionsComboList() { return(RolePermissionsDAL.GetRolePermissionsComboList()); }
public void Delete() { RolePermissionsDAL R = new RolePermissionsDAL(_Id); R.Delete(); }