public ActionResult LogOn(LogOnModel model, string returnUrl, FormCollection formcollection)
        {
            // Decrypt128New("M5z8bP0bD/auyD/1wfthvCCkrr6q+quBRRRcyTGBh5c=");

            Home obj = new Home();

            ViewBag.AllCulture = obj.GetCulturecode();

            RemoveUserfromSession();
            string Msg = "";
            //Set Application Header with Application Type + Version and Build Date
            //  Session["ApplicationHeader"] = SecurityUtils.ApplicationHeader;
            if (returnUrl != null)
                if (returnUrl.Contains("%2f"))
                    returnUrl = Server.UrlDecode(returnUrl);
            bool locked = false;

            //string kjhgkhjk = model.Language;
            bool val = true;
            if (Request.QueryString["RemindCode"] != null)
            {
                string userID = "";
                string userName = "";
                string RemindCode = BizUtil.DecryptQueryStringParam(Request.QueryString["RemindCode"], ref val, true);
                bool checkDate = false;
                string[] tokens = RemindCode.Split(';');
                if (tokens.Length >= 3)
                {
                    userID = tokens[0];
                    userName = tokens[1];

                }

                if (RemindCode != "")
                {
                    using (BaseRepository baseRepo = new BaseRepository())
                    {
                        if (model.Password == model.ConfirmPassword)
                        {
                            BizContext BizContext = new BizContext();
                            if (userName != "" )
                            {
                                BizUser.UnlockUser(baseRepo.BizDB, "", userName);
                            }

                            BizUser.UpdateUserPassword(baseRepo.BizDB, userID, (new BizCrypto.AES128()).Encrypt(model.Password));
                            if (ValidateUser(model.UserName, model.Password, model.Language, ref locked, ref Msg))
                            {
                                if (!locked)
                                {
                                    FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
                                    return RedirectToAction("Index", "Home");
                                }
                                else
                                {
                                    ModelState.AddModelError("", "Your cannot log on the System, because your status is Locked. Please contact your Department Administrator.");
                                }
                            }
                        }
                        else
                        {
                            ModelState.AddModelError("", Msg);
                        }
                    }
                }
            }

            if (ModelState.IsValid)
            {
                if (ValidateUser(model.UserName, model.Password, model.Language, ref locked, ref Msg))
                {
                    if (!locked)
                    {

                        FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);

                        return RedirectToAction("Index", "Home");
                    }
                    else
                    {
                        ModelState.AddModelError("", "Your cannot log on the System, because your status is Locked. Please contact your Department Administrator.");
                    }
                }
                else
                {
                    ModelState.AddModelError("", Msg);
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
        public ActionResult LogOn()
        {
            Home obj = new Home();

               bool val=true;
            if (Request.QueryString["RemindCode"] != null)
            {
                string RemindCode = BizUtil.DecryptQueryStringParam(Request.QueryString["RemindCode"], ref val, true);

                if (RemindCode != "")
                {

            bool checkDate = false;
            string[] tokens = RemindCode.Split(';');
            if (tokens.Length >= 3)
            {
                    string userID = tokens[0];
                    string userName = tokens[1];
                    Session["RemindUserid"] = userID;

                    double DateDiff1 = (Convert.ToDateTime(tokens[2]) - DateTime.Today.Date).TotalDays;
                    if (!checkDate || DateDiff1 <= 2)
                    {
                        //BizTbl_User userInfo = BizUser.GetUser(DataContext, userID);
                        ViewBag.RemindUsername = userName;

                    }

            }

            }
                ViewBag.AllCulture = obj.GetCulturecode();
                RemoveUserfromSession();

                Response.StatusCode = 200;
                string userIpAddress = GetUserIPAddress();
                //GetCultureByIpaddress(userIpAddress);
                //AssignBizContext();

                AssignBizContext();
                if (BizContext.SystemCultureCode == null && BizContext.CultureCode == null)
                {
                    GetCultureByIpaddress(userIpAddress);
                }

                if (BizContext.SystemCultureCode != null && BizContext.CultureCode != null)
                {
                    ViewBag.SelectedLanguage = BizContext.CultureCode + "," + BizContext.SystemCultureCode;
                }
                else
                {
                    ViewBag.SelectedLanguage = null;
                }

            }
            else
            {

                //return View("ResetPassword");
                ViewBag.AllCulture = obj.GetCulturecode();
                RemoveUserfromSession();

                Response.StatusCode = 200;
                string userIpAddress = GetUserIPAddress();
                //GetCultureByIpaddress(userIpAddress);
                AssignBizContext();
                if (BizContext.SystemCultureCode == null && BizContext.CultureCode == null)
                {
                  GetCultureByIpaddress(userIpAddress);
                }

                if (BizContext.SystemCultureCode != null && BizContext.CultureCode != null)
                {
                    ViewBag.SelectedLanguage = BizContext.CultureCode + "," + BizContext.SystemCultureCode;
                }
                else
                {
                    ViewBag.SelectedLanguage = null;
                }

            }

            //Set Application Header with Application Type + Version and Build Date
            //  Session["ApplicationHeader"] = SecurityUtils.ApplicationHeader;
            return View();
        }