示例#1
0
        public ActionResult DoSearch(SearchParameters tmpSearch)
        {
            DebugUtils.StartLogEvent("HomeController.DoSearch");


            if (string.IsNullOrEmpty(tmpSearch.ReservationType))
            {
                tmpSearch.ReservationType = "1";
            }
            if (tmpSearch.ReservationType == "2" && !string.IsNullOrEmpty(tmpSearch.DestinationBonusTime))
            {
                tmpSearch.Destination = tmpSearch.DestinationBonusTime;
            }

            if (tmpSearch.Destination != null && !tmpSearch.Destination.ToLower().Contains("all-"))
            {
                tmpSearch.CheckInDate  = DateTime.MinValue;
                tmpSearch.CheckOutDate = DateTime.MinValue;
            }
            SearchParametersManager searchParametersManager = new SearchParametersManager(false);

            searchParametersManager.parameter = tmpSearch;

            searchParametersManager.SaveParameters();

            DebugUtils.EndLogEvent("HomeController.DoSearch");
            if (tmpSearch.Destination == null)
            {
                return(null);
            }
            else
            {
                return(Redirect(SitecoreUtils.GetPageUrl(SitecoreItemReferences.SearchResultPage)));
            }
        }
示例#2
0
 public ActionResult ShowFlexResort()
 {
     DebugUtils.StartLogEvent("HomeController.ShowFlexResort");
     if (Session["OwnerHomeResort"] != null)
     {
         string resortId = Session["OwnerHomeResort"].ToString();
         var    resort   = ResortManager.FindResort(FormatUtils.ConvertStringToInt(resortId));
         if (resort != null)
         {
             Server.TransferRequest(SitecoreUtils.GetPageUrl(resort.InnerItem));
         }
         DebugUtils.EndLogEvent("HomeController.ShowFlexResort");
     }
     return(null);
 }
示例#3
0
        public ActionResult ChangePasswordProcess(ChangePassword changePassword)
        {
            var            context = new SitecoreContext();
            ChangePassword model   = context.GetCurrentItem <ChangePassword>();

            if (!changePassword.isPasswordPolicyFail && !Context.User.IsAuthenticated)
            {
                Response.Redirect(UrlMapper.Map(model.SiteSettings.SignInPage.Url));
                return(null);
            }

            model.isPasswordPolicyFail = changePassword.isPasswordPolicyFail;  //Reset the default value
            if (ModelState.IsValid)
            {
                if (changePassword.txtNewPassword.Contains(" "))
                {
                    ModelState.AddModelError("", Sitecore.Globalization.Translate.Text("Profile_PasswordInvalid"));
                }
                else
                {
                    SitecoreProfileService scProfileService = new SitecoreProfileService();

                    var membershipUser = scProfileService.GetCurrentMembershipUser();
                    if (membershipUser.ChangePassword(changePassword.txtCurrentPassword, changePassword.txtNewPassword))
                    {
                        EmailManager.UpdatePassword(membershipUser.UserName, membershipUser.Email);
                        if (changePassword.isPasswordPolicyFail)// Need to Complete the login Proces
                        {
                            Response.Redirect(UrlMapper.Map(model.SiteSettings.SignInWaitPage.Url));
                            return(null);
                        }
                        else
                        {
                            Session["isShowPasswordUpdated"] = true;
                            //  model.isShowPasswordUpdated = true;
                            return(Redirect(UrlMapper.Map(SitecoreUtils.GetPageUrl(SitecoreItemReferences.ChangePasswordPageId))));
                        }
                    }
                    else
                    {
                        MembershipUser user = Membership.GetUser(Context.User.Name, false);
                        if (user != null)
                        {
                            if (user.IsLockedOut)
                            {
                                var scUser = scProfileService.GetUser(Context.User.Name);
                                Components.EmailManager.ResetEmail(Context.User.Name, scUser.Profile.Email);
                                if (scUser != null && !scProfileService.CheckForPasswordLockedEmail(scUser))
                                {
                                    scUser.Profile.SetCustomProperty(SitecoreProfileService.PasswordLockedEmailId, "1");
                                    scUser.Profile.Save();
                                }
                                Session["SignInUiError"] = Sitecore.Globalization.Translate.Text("Profile_AccountLocked");
                                return(Redirect(UrlMapper.Map(model.SiteSettings.SignInPage.Url)));
                            }
                        }
                        ModelState.AddModelError("", Sitecore.Globalization.Translate.Text("CurrentPassword_Current_NotCorrect"));
                    }
                }
            }


            var errors = ModelState.Select(x => x.Value.Errors)
                         .Where(y => y.Count > 0)
                         .ToList();

            if (errors != null && errors.Count > 0)
            {
                Session["ChangePasswordError"] = errors;
            }
            if (changePassword.isPasswordPolicyFail)
            {
                return(Redirect(UrlMapper.Map(SitecoreUtils.GetPageUrl(SitecoreItemReferences.ChangePasswordPageId)) + "?PasswordRuleFail=true"));
            }
            else
            {
                return(Redirect(UrlMapper.Map(SitecoreUtils.GetPageUrl(SitecoreItemReferences.ChangePasswordPageId))));
            }
            //return View(model);
        }