public ActionResult ChangePassword()
 {
     if (ModelState.IsValid)
     {
         Models.User        oUser    = new Models.User();
         List <Models.User> lstUsers = new List <Models.User>();
         lstUsers = oUser.GetUserInformation(Convert.ToInt64(Session["UserID"]), "ONE");
         return(View(lstUsers[0]));
     }
     return(View());
 }
        public ActionResult ManageUser()
        {
            Models.User        oUser    = new Models.User();
            List <Models.User> lstUsers = null;

            if (ModelState.IsValid)
            {
                lstUsers = oUser.GetUserInformation(0, "ALL");
            }
            ViewBag.UserList = lstUsers;
            return(View());
        }
        public ActionResult ViewProfile(Int64 UserID)
        {
            Models.User        oUser    = new Models.User();
            List <Models.User> lstUsers = null;

            if (ModelState.IsValid)
            {
                lstUsers = oUser.GetUserInformation(UserID, "ONE");
                if (lstUsers != null && lstUsers.Count > 0)
                {
                    oUser = lstUsers[0];
                }
                ViewBag.RoleList = new SelectList(GetAllRoles(), "RoleID", "RoleName");
            }
            ViewBag.UserID = UserID;
            return(View(oUser));
        }
Example #4
0
        private void SetViewByUserRole(ActionExecutingContext filterContext, HttpSessionStateBase session)
        {
            if (session["UserID"] != null && session["UserName"] != null && session["RoleID"] != null && session["RoleName"] != null)
            {
                bool        bIsValidUser = false;
                bool        bIsValidRole = false;
                Models.User oUser        = null;
                Models.Role oRole        = null;
                try
                {
                    oUser = new Models.User();
                    List <Models.User> oUserList = oUser.GetUserInformation(Convert.ToInt64(session["UserID"]), "ONE");
                    if (oUserList.Count == 1)
                    {
                        bIsValidUser = true;
                    }
                    oRole = new Models.Role();
                    List <Models.Role> oRoleList = oRole.GetAllRoles(Convert.ToInt64(session["RoleID"]), "ONE");
                    if (oRoleList.Count == 1)
                    {
                        bIsValidRole = true;
                    }

                    if (bIsValidUser)
                    {
                        if (bIsValidRole)
                        {
                            switch (Convert.ToString(session["RoleName"]))
                            {
                            case "Super Admin":
                                filterContext.Controller.ViewData["Dashboard"]       = "normal";
                                filterContext.Controller.ViewData["ManageAircraft"]  = "normal";
                                filterContext.Controller.ViewData["ManageAirline"]   = "normal";
                                filterContext.Controller.ViewData["StandData"]       = "normal";
                                filterContext.Controller.ViewData["AssociationData"] = "normal";
                                break;

                            case "Admin":
                                filterContext.Controller.ViewData["Dashboard"]       = "normal";
                                filterContext.Controller.ViewData["ManageAircraft"]  = "normal";
                                filterContext.Controller.ViewData["ManageAirline"]   = "normal";
                                filterContext.Controller.ViewData["StandData"]       = "normal";
                                filterContext.Controller.ViewData["AssociationData"] = "normal";
                                break;

                            case "User":
                                filterContext.Controller.ViewData["Dashboard"]       = "normal";
                                filterContext.Controller.ViewData["ManageAircraft"]  = "normal";
                                filterContext.Controller.ViewData["ManageAirline"]   = "normal";
                                filterContext.Controller.ViewData["StandData"]       = "normal";
                                filterContext.Controller.ViewData["AssociationData"] = "normal";
                                break;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                }
                finally
                {
                    if (oUser != null)
                    {
                        oUser.Dispose();
                        oUser = null;
                    }
                    if (oRole != null)
                    {
                        oRole.Dispose();
                        oRole = null;
                    }
                }
            }
        }