public ActionResult Login(LoginModel model)
        {
            try
            {
//                LogHelper.Info("Login model: " + model.LoginID);
                if (string.IsNullOrEmpty(model.LoginID) || string.IsNullOrEmpty(model.Password))
                {
                    ViewBag.ErrorMessage = "Please input all field!!";
                    return(View(model));
                }
                var user = ValidateModel(model);
                if (user != null)
                {
                    var logHistoryRepo = new LogHistoryRepository();

                    var logHistory = new LogHistoryModel()
                    {
                        UserId    = model.LoginID,
                        PcBrowser = Request.Browser.Browser,
                        IpAddress = Util.IP2INT(GetIpAddress())
                    };
                    logHistoryRepo.InsertLog(logHistory);

                    var status = AppDictionary.UserStatus.FirstOrDefault(a => a.Value == user.Status.ToString()).Key;
                    if (status == "New" || status == "Reset")
                    {
                        ViewBag.Status = "ChangePassword";
                        return(View(model));
                    }
                    SetAuthorized(user, model.Remember);
                    if (Session["CurUrl"] != null)
                    {
                        return(Redirect(Session["CurUrl"].ToString()));
                    }
                    return(RedirectToAction("Index", "Home"));
                }
                ViewBag.ErrorMessage = "Login ID & Password is incorrect!";
            }
            catch (Exception ex)
            {
                LogHelper.Error("AnonymousController: UserId: " + model.LoginID + " Exception: " + ex.InnerException.Message);
                return(null);
            }
            return(View(model));
        }