public ActionResult UserGVPUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] App.Marriage.Models.UserMV.UserViewModel User) { if (ModelState.IsValid) { try { // Insert here a code to update the item in your model User.Update(); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } ViewData["Role"] = RolesDAL.GetRolesComboList(); ViewData["UType"] = EnumDAL.GetEnumsComboList("UserType"); var model = UserViewModel.GetUserList(); return(PartialView(UserPartial, model)); }
public RoleViewModel(RolesDAL R) { _Id = R.Roles.Id; _RoleName = R.Roles.RoleName; _Description = R.Roles.Description; _RoleState = R.Roles.RoleStatus; }
public ActionResult Login(LoginVM info) { try { if (info.Email != null && LoginDAL.Login(Mapper.Map <LoginDM>(info))) { Session["LoggedIn"] = true; info.EmployeeId = LoginDAL.ReadLoginByEmail(info.Email); info.Employee = EmployeeMap.GetEmployeeById(info.EmployeeId); info.Role = Mapper.Map <RolesVM>(RolesDAL.ReadRoleByID(info.Employee.RoleId)); Session["Role"] = info.Role.RoleName; Session["ID"] = info.EmployeeId; if ((bool)Session["LoggedIn"]) { if ((string)Session["Role"] == "ADMIN" || ((string)Session["Role"] == "DIRECTOR")) { Session["Email"] = info.Email; return(RedirectToAction("AdminDashboard", "Home", new { area = "Default" })); } else { Session["Email"] = info.Email; return(RedirectToAction("ReadAccount", "Account", new { area = "Default" })); } } } return(View()); } catch (Exception ex) { throw ex; } }
public static List <RoleViewModel> GetRoleList() { List <RoleViewModel> RList = new List <RoleViewModel>(); RolesDAL.GetRolesList().ForEach(r => RList.Add(new RoleViewModel(r))); return(RList); }
public ActionResult UserGVP() { ViewData["Role"] = RolesDAL.GetRolesComboList(); ViewData["UType"] = EnumDAL.GetEnumsComboList("UserType"); var model = UserViewModel.GetUserList(); return(PartialView(UserPartial, model)); }
public ActionResult AccountCreation() { EmployeeVM employee = new EmployeeVM(); employee.TeamList = Mapper.Map <List <TeamsVM> >(TeamsDAL.ReadTeams()); employee.AssignmentList = Mapper.Map <List <AssignmentVM> >(AssignmentDAL.ReadAssignments()); employee.RoleList = Mapper.Map <List <RolesVM> >(RolesDAL.ReadRoles()); return(View(employee)); }
public RolesBLL FindRoleByID(int RoleID) { RolesBLL ProposedReturnValue = null; RolesDAL DataLayerObject = _context.FindRoleByID(RoleID); if (null != DataLayerObject) { ProposedReturnValue = new RolesBLL(DataLayerObject); } return(ProposedReturnValue); }
public void Create() { RolesDAL R = new RolesDAL(); R.Roles.Id = _Id; R.Roles.RoleName = _RoleName; R.Roles.Description = _Description; R.Roles.RoleStatus = _RoleState; R.Create(); _Id = R.Roles.Id; }
public void Update() { RolesDAL R = new RolesDAL(); if (!string.IsNullOrEmpty(_RoleName)) { R.Roles.RoleName = _RoleName; } if (!string.IsNullOrEmpty(_Description)) { R.Roles.Description = _Description; } if (!string.IsNullOrEmpty(_RoleState)) { R.Roles.RoleStatus = _RoleState; } }
/// <summary>Get the roles by identifier.</summary> /// <param name="roleId">The Integer Object.</param> /// <returns>Roles Object.</returns> public AdminRoles GetRolesById(int roleId) { Logging.LogDebugMessage("Method: GetRolesById ,MethodType: Get, Layer: RolesBL, Parameters: roleId = " + roleId.ToString()); using (RolesDAL roleById = new RolesDAL()) { try { return(roleById.GetRolesById(roleId)); } catch (SqlException sqlEx) { Logging.LogErrorMessage("Method: GetRolesById, Layer: RolesBL, Stack Trace: " + sqlEx.ToString()); throw; } catch (Exception ex) { Logging.LogErrorMessage("Method: GetRolesById, Layer: RolesBL, Stack Trace: " + ex.ToString()); throw; } } }
/// <summary>Get the role exist by role name.</summary> /// <param name="roleName">The String Object.</param> /// <returns>Roles Object.</returns> public bool GetRoleExistsByRoleName(string roleName) { Logging.LogDebugMessage("Method: GetRoleExistsByRoleName, MethodType: Get, Layer: RolesBL, Parameters: roleName = " + roleName); using (RolesDAL roleExistByRoleName = new RolesDAL()) { try { return(roleExistByRoleName.GetRoleExistsByRoleName(roleName)); } catch (SqlException sqlEx) { Logging.LogErrorMessage("Method: GetRoleExistsByRoleName, Layer: RolesBL, Stack Trace: " + sqlEx.ToString()); throw; } catch (Exception ex) { Logging.LogErrorMessage("Method: GetRoleExistsByRoleName, Layer: RolesBL, Stack Trace: " + ex.ToString()); throw; } } }
/// <summary>This method deletes the selected roles.</summary> /// <param name="deletedRolesWithAdminUser">The DeletedRolesWithAdminUser Object.</param> /// <returns>List of Roles Object.</returns> public List <AdminRoles> DeleteRoles(DeletedRolesWithAdminUser deletedRolesWithAdminUser) { Logging.LogDebugMessage("Method: DeleteRoles, MethodType: Post, Layer: RolesBL, Parameters: DeletedRolesWithAdminUser = "******"Method: DeleteRoles, Layer: RolesBL, Stack Trace: " + sqlEx.ToString()); throw; } catch (Exception ex) { Logging.LogErrorMessage("Method: DeleteRoles, Layer: UserBL, Stack Trace: " + ex.ToString()); throw; } } }
/// <summary>Insert The Role and User.</summary> /// <param name="RoleList">The InserRoleUser Object.</param> /// <param name="CreatedByUserID">The Integer Object.</param> /// <returns>The Boolean Value.</returns> public bool UserRoleInsertBulk(List <InserRoleUser> Insertroleuser, int CreatedByUserID) { Logging.LogDebugMessage("Method: UserRoleInsertBulk ,MethodType: Post, Layer: RolesBL, Parameters: Insertroleuser = "******"Method: UserRoleInsertBulk, Layer: RolesBL, Stack Trace: " + sqlEx.ToString()); throw; } catch (Exception ex) { Logging.LogErrorMessage("Method: UserRoleInsertBulk, Layer: RolesBL, Stack Trace: " + ex.ToString()); throw; } } }
/// <summary>Upadte The Role Details.</summary> /// <param name="role">The AdminRole Object.</param> /// <returns>The Boolean Value.</returns> public bool UpdateRole(AdminRoles role) { Logging.LogDebugMessage("Method: UpdateRole, MethodType: Post, Layer: RolesBL, Parameters: role = " + JsonConvert.SerializeObject(role)); using (RolesDAL updateRole = new RolesDAL()) { try { return(updateRole.UpdateRole(role)); } catch (SqlException sqlEx) { Logging.LogErrorMessage("Method: UpdateRole, Layer: RolesBL, Stack Trace: " + sqlEx.ToString()); throw; } catch (Exception ex) { Logging.LogErrorMessage("Method: UpdateRole, Layer: RolesBL, Stack Trace: " + ex.ToString()); throw; } } }
/// <summary>Gets the list of all active roles.</summary> /// <returns>List of all active roles.</returns> public List <AdminRoles> GetAllActiveRoles() { Logging.LogDebugMessage("Method: GetAllActiveRoles, MethodType: Get, Layer: RolesBL, Parameters: No Input Parameters"); using (RolesDAL activeRoles = new RolesDAL()) { try { return(activeRoles.GetAllActiveRoles()); } catch (SqlException sqlEx) { Logging.LogErrorMessage("Method: GetAllActiveRoles, Layer: RolesBL, Stack Trace: " + sqlEx.ToString()); throw; } catch (Exception ex) { Logging.LogErrorMessage("Method: GetAllActiveRoles, Layer: RolesBL, Stack Trace: " + ex.ToString()); throw; } } }
/// <summary> /// Obtiene un elemento utilizando la identidad enviada como parámetro (Capa de Negocio) /// </summary> /// <param name=''></param> public static Rol GetRol(Guid RoleId) { RolesDAL rolesDAL = null; Rol role = null; rolesDAL = new RolesDAL(); try { try { role = rolesDAL.Select(RoleId, CommonENT.MYCTSDBSECURITY_CONNECTION); } catch (Exception ex) { new EventsManager.EventsManager(ex, EventsManager.EventsManager.OrigenError.BaseDeDatos); role = rolesDAL.Select(RoleId, CommonENT.MYCTSDBSECURITYBACKUP_CONNECTION); } } catch { } return(role); }
/// <summary> /// Indica si el usuario pertenece a un determinado Rol /// </summary> /// <param name="userId">Id del usuario</param> /// <param name="roleName">Nombre del rol</param> /// <returns>Bool</returns> public static bool IsUserInRole(Guid userId, string roleName) { RolesDAL rolesDAL = new RolesDAL(); bool exists = false; try { try { exists = rolesDAL.IsUserInRole(userId, roleName, CommonENT.MYCTSDBSECURITY_CONNECTION); } catch (Exception ex) { new EventsManager.EventsManager(ex, EventsManager.EventsManager.OrigenError.BaseDeDatos); exists = rolesDAL.IsUserInRole(userId, roleName, CommonENT.MYCTSDBSECURITYBACKUP_CONNECTION); } } catch { } return(exists); }
/// <summary> /// Obtiene todos los elementos de la tabla (Capa de Negocio) /// </summary> /// <param name=''></param> public static List <Rol> GetRolesByUser(Guid usuario) { RolesDAL rolesDAL = null; List <Rol> listRoles = null; rolesDAL = new RolesDAL(); try { try { listRoles = rolesDAL.SelectByUser(usuario, CommonENT.MYCTSDBSECURITY_CONNECTION); } catch (Exception ex) { new EventsManager.EventsManager(ex, EventsManager.EventsManager.OrigenError.BaseDeDatos); listRoles = rolesDAL.SelectByUser(usuario, CommonENT.MYCTSDBSECURITYBACKUP_CONNECTION); } } catch { } return(listRoles); }
/// <summary> /// Actualiza un elemento en la base de datos. (Capa de Negocio) /// </summary> /// <param name=""></param> public static bool UpdateRoles(Guid ApplicationId, Guid RoleId, string RoleName, string LoweredRoleName, string Description) { RolesDAL rolesDAL = null; bool bResult = false; rolesDAL = new RolesDAL(); try { try { rolesDAL.Update(ApplicationId, RoleId, RoleName, LoweredRoleName, Description, CommonENT.MYCTSDBSECURITY_CONNECTION); bResult = true; } catch (Exception ex) { new EventsManager.EventsManager(ex, EventsManager.EventsManager.OrigenError.BaseDeDatos); rolesDAL.Update(ApplicationId, RoleId, RoleName, LoweredRoleName, Description, CommonENT.MYCTSDBSECURITYBACKUP_CONNECTION); bResult = true; } } catch { } return(bResult); }
/// <summary> /// Borrado de un elemento de la base de datos (Capa de Negocio). /// </summary> /// <param name=""></param> public static bool DeleteRoles(Guid RoleId) { RolesDAL rolesDAL = null; bool bResult = false; rolesDAL = new RolesDAL(); try { try { rolesDAL.Delete(RoleId, CommonENT.MYCTSDBSECURITY_CONNECTION); bResult = true; } catch (Exception ex) { new EventsManager.EventsManager(ex, EventsManager.EventsManager.OrigenError.BaseDeDatos); rolesDAL.Delete(RoleId, CommonENT.MYCTSDBSECURITYBACKUP_CONNECTION); bResult = true; } } catch { } return(bResult); }
public RolesBO() { rolesDAL = new RolesDAL(); }
public RolesBLL(RolesDAL dal) { this.RoleID = dal.RoleID; this.RoleName = dal.RoleName; }
public ActionResult DeleteRole(RolesVM role) { RolesDAL.DeleteRole(Mapper.Map <RolesDM>(role)); return(View()); }
public ActionResult ReadRoleByID(RolesDM role) { return(View(Mapper.Map <RolesVM>(RolesDAL.ReadRoleByID(role.RoleId)))); }
public static IEnumerable GetRoleComboList() { return(RolesDAL.GetRolesComboList()); }
public static int Add(Roles r) { return(RolesDAL.Add(r)); }
public void Delete() { RolesDAL R = new RolesDAL(_Id); R.Delete(); }
public RolesBLL(Account oAccount) : base(oAccount) { mRolesDAL = new RolesDAL(mAccount); }
/// <summary> /// 查询所有的角色 /// </summary> /// <returns></returns> public static List <Roles> GetAll() { return(RolesDAL.GetAll()); }
public ActionResult ReadRoles() { return(View(Mapper.Map <List <RolesVM> >(RolesDAL.ReadRoles()))); }