コード例 #1
0
 public ActionResult logIn(User Account)
 {
     var result = new AccountModel().LogIn(Account,true);
     if(result==3)
     {
         var Object= new AccountModel().GetUserSession(Account.UserName);
         SessionHelper.SetSesstion(Constant.SESSION_USER, Object);
         SessionHelper.SetSesstion(Constant.SESSION_RULE, new AccountModel().GetListRule(Account.UserName));
         return RedirectToAction("Home", "AdminHome");
     }
     else if(result==-2)
     {
         ModelState.AddModelError("", "Mời bận nhập mật khẩu");
     }
     else if(result==-1)
     {
         ModelState.AddModelError("", "Mời bạn nhập tài khoản");
     }
     else if(result==0)
     {
         ModelState.AddModelError("", "Tài khoản không tồn tại");
     }
     else if(result==1)
     {
         ModelState.AddModelError("", "Sai mật khẩu");
     }
     else if(result==2)
     {
         ModelState.AddModelError("", "Tài khoản không có quyền đang nhập");
     }
     return View();
 }
コード例 #2
0
ファイル: AdminBaseController.cs プロジェクト: hoangdxvnu/SEA
 protected override void Initialize(System.Web.Routing.RequestContext requestContext)
 {
     // Using caching
     var account = SessionHelper.GetSession(Constant.SESSION_USER) as UserSession;
     var Profile = new AccountModel().GetProfile(account.Id);
     ViewBag.Profile = Profile;
     base.Initialize(requestContext);
 }
コード例 #3
0
ファイル: AccountController.cs プロジェクト: hoangdxvnu/SEA
 // GET: Account
 public ActionResult Index()
 {
     UserSession account = SessionHelper.GetSession(Constant.SESSION_USER) as UserSession;
     var result =  new AccountModel().GetAccount(account.Id);
     return View(result);
 }