//[Route("/SetDefaultPage/{id?}")]
        public ActionResult SetDefaultPage(int id, int menuId)
        {
            SetConnectionDB();
            SetDefaultPageService _setDefaultPage = new SetDefaultPageService(DBConnection);

            ViewData["usermenu"] = _setDefaultPage.GetListDefaultPage(id);
            _setDefaultPage.UpdatePageDefault(id, menuId);
            return(Redirect("SetDefaultPage?id=" + id));
        }
Esempio n. 2
0
        public ActionResult Login(LoginModel loginModel)
        {
            Char charRange = '/';

            //STEP1: GOI HAM LOGIN TOI CSDL *****************************************************
            this.SetConnectionDB();
            BI_Project.Services.User.UserServices userServices = new UserServices(this.DBConnection);
            BI_Project.Services.Departments.DepartmentServices departmentServices = new DepartmentServices(this.DBConnection);

            EntityUserModel       entityUser       = userServices.CheckLogin(loginModel);
            EntityDepartmentModel entityDepartment = departmentServices.GetEntityById(entityUser.DeptId);
            SetDefaultPageService setDefault       = new SetDefaultPageService(DBConnection);

            if (entityUser.UserName != null)
            {
                Session["UserName"] = entityUser.UserName;
                Session["FullName"] = entityUser.FullName;
                Session[this.SESSION_NAME_USER_NAME] = entityUser.UserName;
                Session[this.SESSION_NAME_USERID]    = entityUser.UserId;
                Session["DepartIdUserLogin"]         = entityUser.DeptId;
                Session["IsAdmin"]         = entityUser.IsAdmin;
                Session["IsSuperAdmin"]    = entityUser.IsSuperAdmin;
                Session["CodeIsAdmin"]     = entityDepartment.Code;
                Session["Filter01IsAdmin"] = entityDepartment.Filter01;
                List <EntityUserMenuModel> entityUserMenuModel = setDefault.GetListDefaultPage(entityUser.UserId);
                foreach (EntityUserMenuModel item in entityUserMenuModel)
                {
                    if (item.IsDefaultPage == true)
                    {
                        var    _path       = item.Path;
                        string _controller = _path.Split(charRange)[0];
                        string _action     = _path.Split(charRange)[1];
                        int    _menuId     = item.MenuId;

                        return(RedirectToAction(_action + "/" + _menuId, _controller));
                    }
                }
                return(RedirectToAction("Index"));
            }
            if (userServices.ERROR != null)
            {
                Session["msgcode"] = MessageType.ServerError;
                FileHelper.SaveFile(userServices.ERROR, this.LOG_FOLDER + "/ERROR_" + this.GetType().ToString() + BI_Project.Helpers.Utility.APIStringHelper.GenerateFileId() + ".txt");
            }
            else
            {
                Session["msgcode"] = MessageType.BusinessError;
            }

            this.GetLanguage();
            ViewData["VIEWDATA_LANGUAGE"] = this.LANGUAGE_OBJECT;
            return(View("~/" + this.THEME_FOLDER + "/" + this.THEME_ACTIVE + "/login.cshtml", loginModel));

            //STEP2: NEU DANG NHAP KHONG THANH CONG
        }
        // GET: DefaultPage
        //[CheckUserMenus]
        public ActionResult SetDefaultPage(int id)
        {
            ViewData["pagename"]     = "SetDefaultPage";
            ViewData["action_block"] = "DefaultPage/SetDefaultPage";
            SetCommonData();
            GetLanguage();
            SetConnectionDB();
            SetDefaultPageService _setDefaultPage = new SetDefaultPageService(DBConnection);

            ViewData["usermenu"] = _setDefaultPage.GetListDefaultPage(id);
            return(View("~/" + this.THEME_FOLDER + "/" + this.THEME_ACTIVE + "/index.cshtml"));
        }