public ActionResult LoginCustomer(string txtEmail, string txtPassWord)
        {
            CustomerAccountDAO customerAccountDAO = new CustomerAccountDAO();
            var result = customerAccountDAO.CheckLogin(txtEmail, Encryptor.MD5Hash(txtPassWord));

            if (result == 1)
            {
                var customer        = customerAccountDAO.getCustomerAccount(txtEmail);
                var customersession = new CustomerLogin();
                customersession.Email    = customer.Email;
                customersession.PassWord = customer.PassWord;
                customersession.Name     = customer.Name;
                Session.Add(Common.CommonConstants.Customer_SESSION, customersession);
                return(Redirect("/"));
            }
            else if (result == 0)
            {
                TempData["msg"] = MessageBox.Show("Tài Khoản Không Tồn Tại");
            }
            else if (result == -1)
            {
                ModelState.AddModelError("", "Bạn đã điền sai password");
            }
            return(View());
        }
Esempio n. 2
0
        public ActionResult LoginCustomer(string txtEmail, string txtPassWord)
        {
            CustomerAccountDAO customerAccountDAO = new CustomerAccountDAO();
            var result = customerAccountDAO.CheckLogin(txtEmail, Encryptor.MD5Hash(txtPassWord));

            if (result == 1)
            {
                var customer        = customerAccountDAO.getCustomerAccount(txtEmail);
                var customersession = new CustomerLogin();
                customersession.Email    = customer.Email;
                customersession.PassWord = customer.PassWord;
                customersession.Name     = customer.Name;
                Session.Add(Common.CommonConstants.Customer_SESSION, customersession);
                return(Redirect("/"));
            }
            else if (result == 0)
            {
                TempData["msg"] = "<script>alert('tên đăng nhập không tồn tại!')</script>";
            }
            else if (result == -1)
            {
                //ModelState.AddModelError("", "Bạn đã điền sai password");

                TempData["msg"] = "<script>alert('bạn đã điền sai mật khẩu!')</script>";
            }
            return(Redirect("/"));
        }
Esempio n. 3
0
        public ActionResult Information()
        {
            var session = (Common.CustomerLogin)Session[Common.CommonConstants.Customer_SESSION];

            if (session == null)
            {
                return(Redirect("/"));
            }
            CustomerAccountDAO customerAccountDAO = new CustomerAccountDAO();
            var customer = customerAccountDAO.getCustomerAccount(session.Email);

            return(View(customer));
        }