public ActionResult login(LogOnModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                int check = MembershipService.ValidateUser(model.UserName, model.Password);

                if (check == 1 || check == 3 || check==4)//login thanh cong
                {
                    FormsService.SignIn(model.UserName, model.RememberMe);

                    if(check == 1) // truong hop webmaster login
                    {
                        //if (!String.IsNullOrEmpty(returnUrl))// tra lai url truoc khi login
                        //{
                        //    return Redirect(returnUrl);
                        //}
                        //else 
                            return RedirectToAction("Index", "Account");
                    }
                    else if (check == 3)// truong hop Customer login
                    {
                       
                        return RedirectToAction("Index", "Customer");
 
                    }
                    else if (check == 4)
                    {
                        return RedirectToAction("Index","Admin");
                    }

                }

                else if(check == 0) // username va password khong dung.
                {
                    ModelState.AddModelError("", "The user name or password provided is incorrect.");
                }
                else if(check == 2) //account chua duoc active
                {
                    ModelState.AddModelError("","Your account is not active! Please check email to active account!");
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
        public ActionResult login(LogOnModel model, string returnUrl)
        {

            LangText.Load(model.UserName);

            if (ModelState.IsValid)
            {
                string HashPassword = MPHash.GetPassWordMD5Hash(model.Password);
                //hash password

                int check = MembershipService.ValidateUser(model.UserName, HashPassword);

                if (check == 1 || check == 3 || check==4)//login thanh cong
                {
                    FormsService.SignIn(model.UserName, model.RememberMe);

                    TransactionLogViewModel.AddLog(model.UserName + " has just login succesffully!",DateTime.Now);
                    
                   

                    if(check == 1) // truong hop webmaster login
                    {
                        
                        return View("redirectWebmaster");
                       
                    }
                    else if (check == 3)// truong hop Customer login
                    {
                       return View("redirectCustomer");
 
                    }
                    else if (check == 4)
                    {
                        return View("redirectAdmin");
                    }

                }

                else if(check == 0) // username va password khong dung.
                {
                    TransactionLogViewModel.AddLog(model.UserName + " login with incorrect username or password!", DateTime.Now);

                    ModelState.AddModelError("", LangText.GetText("THE_USER_NAME_OR_PASSWORD_PROVIDED_IS_INCORRECT"));
                }
                else if(check == 2) //account chua duoc active
                {
                    TransactionLogViewModel.AddLog(model.UserName + " has login with inactive account!", DateTime.Now);

                    ModelState.AddModelError("", LangText.GetText("YOUR_ACCOUNT_IS_NOT_ACTIVE!_PLEASE_CHECK_EMAIL_TO_ACTIVE_ACCOUNT"));
                }
                else if (check == 5)// account da bi Disable
                {
                    TransactionLogViewModel.AddLog(model.UserName + " has login with account is disabled by Money Pacific Admin!", DateTime.Now);
                    ModelState.AddModelError("", LangText.GetText("YOUR_ACCOUNT_IS_DISABLED_BY_MONEY_PACIFIC_ADMIN"));
                }
            }
            

            // If we got this far, something failed, redisplay form

            return View(model);
        }