// GET: Account
        public ActionResult Login()
        {
            CongTy ct = CongTyDAO.getCongTyByDefault();

            Session["CongTy"] = ct;
            NhaMay nm = NhaMayDAO.GetNhaMayByDefault();

            Session["NhaMay"] = nm;
            if (User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Index", "Home"));
            }
            return(View());
        }
        // call hàm này để check xem có được phép truy cập
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            if (HttpContext.Current.User.Identity.IsAuthenticated || HttpContext.Current.Session["User"] != null)
            {
                if (HttpContext.Current.Session["User"] == null)
                {
                    HttpCookie authCookie = HttpContext.Current.Request.Cookies["login_form_cre"];
                    FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);
                    var     serializeModel = JsonConvert.DeserializeObject <CustomSerializeModel>(authTicket.UserData);
                    Account acc            = AccountDAO.GetAccountByID(serializeModel.UserId);
                    HttpContext.Current.Session["User"] = acc;
                }

                HttpContext.Current.Session["CongTy"] = CongTyDAO.getCongTyByDefault();
                HttpContext.Current.Session["NhaMay"] = NhaMayDAO.GetNhaMayByDefault();
                return(true);
            }
            return(false);
        }