コード例 #1
0
ファイル: UserController.cs プロジェクト: nvlab/App.Marriage
        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));
        }
コード例 #2
0
 public RoleViewModel(RolesDAL R)
 {
     _Id          = R.Roles.Id;
     _RoleName    = R.Roles.RoleName;
     _Description = R.Roles.Description;
     _RoleState   = R.Roles.RoleStatus;
 }
コード例 #3
0
ファイル: LoginController.cs プロジェクト: 89mich7/ORA
 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;
     }
 }
コード例 #4
0
        public static List <RoleViewModel> GetRoleList()
        {
            List <RoleViewModel> RList = new List <RoleViewModel>();

            RolesDAL.GetRolesList().ForEach(r => RList.Add(new RoleViewModel(r)));
            return(RList);
        }
コード例 #5
0
ファイル: UserController.cs プロジェクト: nvlab/App.Marriage
        public ActionResult UserGVP()
        {
            ViewData["Role"]  = RolesDAL.GetRolesComboList();
            ViewData["UType"] = EnumDAL.GetEnumsComboList("UserType");
            var model = UserViewModel.GetUserList();

            return(PartialView(UserPartial, model));
        }
コード例 #6
0
ファイル: AccountController.cs プロジェクト: 89mich7/ORA
        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));
        }
コード例 #7
0
        public RolesBLL FindRoleByID(int RoleID)
        {
            RolesBLL ProposedReturnValue = null;
            RolesDAL DataLayerObject     = _context.FindRoleByID(RoleID);

            if (null != DataLayerObject)
            {
                ProposedReturnValue = new RolesBLL(DataLayerObject);
            }
            return(ProposedReturnValue);
        }
コード例 #8
0
        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;
        }
コード例 #9
0
        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;
            }
        }
コード例 #10
0
 /// <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;
         }
     }
 }
コード例 #11
0
 /// <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;
         }
     }
 }
コード例 #12
0
 /// <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;
         }
     }
 }
コード例 #13
0
 /// <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;
         }
     }
 }
コード例 #14
0
 /// <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;
         }
     }
 }
コード例 #15
0
 /// <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;
         }
     }
 }
コード例 #16
0
        /// <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);
        }
コード例 #17
0
        /// <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);
        }
コード例 #18
0
        /// <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);
        }
コード例 #19
0
        /// <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);
        }
コード例 #20
0
        /// <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);
        }
コード例 #21
0
ファイル: RolesBO.cs プロジェクト: 6624465/PickC01122018
 public RolesBO()
 {
     rolesDAL = new RolesDAL();
 }
コード例 #22
0
        public RolesBLL(RolesDAL dal)
        {
            this.RoleID = dal.RoleID;

            this.RoleName = dal.RoleName;
        }
コード例 #23
0
 public ActionResult DeleteRole(RolesVM role)
 {
     RolesDAL.DeleteRole(Mapper.Map <RolesDM>(role));
     return(View());
 }
コード例 #24
0
 public ActionResult ReadRoleByID(RolesDM role)
 {
     return(View(Mapper.Map <RolesVM>(RolesDAL.ReadRoleByID(role.RoleId))));
 }
コード例 #25
0
 public static IEnumerable GetRoleComboList()
 {
     return(RolesDAL.GetRolesComboList());
 }
コード例 #26
0
 public static int Add(Roles r)
 {
     return(RolesDAL.Add(r));
 }
コード例 #27
0
        public void Delete()
        {
            RolesDAL R = new RolesDAL(_Id);

            R.Delete();
        }
コード例 #28
0
 public RolesBLL(Account oAccount) : base(oAccount)
 {
     mRolesDAL = new RolesDAL(mAccount);
 }
コード例 #29
0
 /// <summary>
 /// 查询所有的角色
 /// </summary>
 /// <returns></returns>
 public static List <Roles> GetAll()
 {
     return(RolesDAL.GetAll());
 }
コード例 #30
0
 public ActionResult ReadRoles()
 {
     return(View(Mapper.Map <List <RolesVM> >(RolesDAL.ReadRoles())));
 }