/// <summary> /// handles /Complete, /Cancelled and /Failed postfix url parts when applied to the RegisterGuest or Dontate pages /// this is used so that distinct urls can be detected by the analytics /// </summary> /// <param name="contentRequest"></param> /// <returns></returns> public bool TryFindContent(PublishedContentRequest contentRequest) { // chop up the url string[] urlParts = contentRequest.Uri.GetAbsolutePathDecoded().Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); // we know hierarchy of register guest and donate pages, so expect only 2 url parts if (urlParts.Length == 2) { // only try processing if it ends with known string switch (urlParts[1]) { case "complete": case "cancelled": RegisterGuest registerGuest = (RegisterGuest)UmbracoContext.Current.ContentCache.GetSingleByXPath("//" + RegisterGuest.Alias); Donate donate = (Donate)UmbracoContext.Current.ContentCache.GetSingleByXPath("//" + Donate.Alias); if (urlParts[0] == registerGuest.Url.Trim('/')) { contentRequest.PublishedContent = registerGuest; return(true); } if (urlParts[0] == donate.Url.Trim('/')) { contentRequest.PublishedContent = donate; return(true); } break; } } return(false); }
public ActionResult RegisterGuest(RegisterGuest model) { if (ModelState.IsValid) { // Attempt to register the user MembershipCreateStatus createStatus; var restaurantuser = MembershipService.CreateUser( new RestaurantUser(0, model.UserName, Guid.NewGuid()) { MobileNumber = UInt64.Parse(model.MobileNumber), UserRole = UserBase.RestaurantUserRole.Guest } , out createStatus); if (createStatus == MembershipCreateStatus.Success && restaurantuser != null) { FormsService.SignIn(restaurantuser, true); TempData[TempDataStringResuorce.ActionResultNotification] = new ActionResultNotification { Message = "You have been successully Registered as a Guest", Result = true, State = ActionResultNotification.MessageState.Information }; if (Request.QueryString["returnurl"] != null && Url.IsLocalUrl(Request.QueryString["returnurl"])) { return(Redirect(Request.QueryString["returnurl"])); } return(RedirectToAction("Index", "Home")); } ModelState.AddModelError("createstatus", AccountValidation.ErrorCodeToString(createStatus)); } // If we got this far, something failed, redisplay form TempData[TempDataStringResuorce.ActionResultNotification] = new ActionResultNotification { Message = ModelState.ContainsKey("createstatus") ? ModelState["createstatus"].Errors[0].ErrorMessage : "There was an Error registering you as our Guest User, please try again", Result = false, State = ActionResultNotification.MessageState.Error }; ViewBag.PasswordLength = MembershipService.MinPasswordLength; return(View(model)); }
public override ActionResult Index(RenderModel renderModel) { RegisterGuest model = (RegisterGuest)renderModel.Content; // if VendorTxCode can be found on the querystring, then get party guid from transaction table Guid vendorTxCode; if (Guid.TryParse(this.Request.QueryString["VendorTxCode"], out vendorTxCode)) { DonationRow donationRow = this.DatabaseContext.Database.Fetch <DonationRow>("SELECT TOP 1 * FROM wonderlandDonation WHERE VendorTxCode = @0", vendorTxCode).SingleOrDefault(); if (donationRow != null) { model.PartyHost = this.Members.GetPartyHost(donationRow.PartyGuid); model.DonationRow = donationRow; if (donationRow.Success) { return(this.View("RegisterGuest/Complete", model)); } else if (donationRow.Cancelled) { return(this.View("RegisterGuest/Cancelled", model)); } else { return(this.View("RegisterGuest/Failed", model)); } } else { return(this.View("RegisterGuest/UnknownTransaction", model)); } } Guid partyGuid; if (Guid.TryParse(this.Request.QueryString["partyGuid"], out partyGuid)) { model.PartyHost = this.Members.GetPartyHost(partyGuid); if (model.PartyHost != null) { if (this.Members.IsLoggedInPartier()) { if (this.Members.GetCurrentMember() is PartyGuest) { PartyGuest partyGuest = (PartyGuest)this.Members.GetCurrentMember(); return(this.View("RegisterGuest/RegisterGuestBilling", model)); } else { return(this.Redirect(Home.GetCurrentHome(model).Url)); } } return(View("RegisterGuest/RegisterGuest", model)); } } // fallback return(this.Redirect(Home.GetCurrentHome(model).Url)); }