Ejemplo n.º 1
0
        private USER_OBJ checkLogin(AccountVM account)
        {
            string   password = MD5Encrypt.MD5Hash(account.Password);
            USER_OBJ user     = _serviceUser.GetForLogin(account);

            _serviceUser.CloseConnection();
            if (password.Equals(user.Password))
            {
                return(user);
            }
            return(null);
        }
Ejemplo n.º 2
0
        public ActionResult dologin(AccountVM account)
        {
            //Kiểm tra mật khâu cơ sở dữ liệu ở đây.
            USER_OBJ user_LogedIn = checkLogin(account);

            if (user_LogedIn != null)
            {
                STAFF_INFO staff = new STAFF_INFO();
                staff.CODE     = user_LogedIn.CODE;
                staff.USERMAME = user_LogedIn.Username;
                staff.LOGTIME  = DateTime.Now;
                List <MENU_OBJ> lidata = _serviceMenu.GetMenu();
                staff.MENUCHA = lidata.Where(x => x.MenuIdCha == null).OrderBy(x => x.Sort).ToList();
                staff.MENU    = lidata.Where(x => x.MenuIdCha != null).OrderBy(x => x.Sort).ToList();
                _serviceMenu.CloseConnection();
                ses.login(staff);
                return(RedirectToAction("Index", "Home"));
            }
            return(RedirectToAction("Login", "Home"));
        }