public void CheckSessionData() { string auraId = Helpers.GetAuraId(Convert.ToString(base.Session["AptifyUniqueId"])); if (string.IsNullOrEmpty(auraId)) { base.Response.Redirect("/Login?ReturnUrl=" + HttpUtility.UrlEncode(base.Request.Url.AbsoluteUri)); } WebShoppingCartOrderView webShoppingCartOrderView = Helpers.GetOrderDetails(auraId).FirstOrDefault <WebShoppingCartOrderView>(); if (webShoppingCartOrderView == null || webShoppingCartOrderView.Lines == null) { return; } foreach (WebShoppingCartDetails current in webShoppingCartOrderView.Lines) { MeetingEx meetingByProductId = Helpers.GetMeetingByProductId(current.ProductId.ToString()); List <MeetingEx> sessionsByMeetingId = Helpers.GetSessionsByMeetingId(meetingByProductId.Id.ToString()); if (sessionsByMeetingId.Count > 0 && current.SessionRanks.Count == 0) { this.paymentSeciton.Visible = false; this.btnSubmit.Visible = false; this.SessionInfo.Attributes.Add("style", "display:visible"); return; } } this.SessionInfo.Attributes.Add("style", "display:none"); }
protected void btnSubmit_OnClick(object sender, EventArgs e) { string auraId = Helpers.GetAuraId(Convert.ToString(base.Session["AptifyUniqueId"])); if (string.IsNullOrEmpty(auraId)) { base.Response.Redirect("/Login?ReturnUrl=" + HttpUtility.UrlEncode(base.Request.Url.AbsoluteUri)); } WebShoppingCartEx webShoppingCartEx = Helpers.GetCart(auraId).FirstOrDefault <WebShoppingCartEx>(); if (webShoppingCartEx == null || webShoppingCartEx.Lines == null) { base.Response.Redirect("/productcatalog/viewcart"); return; } int rowId = Convert.ToInt32(base.Request.QueryString["OL"]); WebShoppingCartDetails webShoppingCartDetails = webShoppingCartEx.Lines.First((WebShoppingCartDetails x) => x.Id == rowId); MeetingEx meetingByProductId = Helpers.GetMeetingByProductId(webShoppingCartEx.Lines.First((WebShoppingCartDetails x) => x.Id == Convert.ToInt32(rowId)).ProductId.ToString()); if (this.ListViewSessions.Items.Count > 0) { if (!this.CheckSessionGroup(meetingByProductId.Id)) { return; } if (!this.AtLeastOneSessionChecked()) { return; } } base.Session["CartLine"] = webShoppingCartDetails; webShoppingCartDetails.SessionRanks.Clear(); for (int i = 0; i < this.ListViewSessions.Items.Count; i++) { ListViewDataItem listViewDataItem = this.ListViewSessions.Items[i]; CheckBox checkBox = (CheckBox)listViewDataItem.FindControl("SessionSelect"); int sessionProductID = Convert.ToInt32(checkBox.InputAttributes["productId"]); if (checkBox.Checked) { webShoppingCartDetails.SessionRanks.Add(new WebShoppingCartDetailsSessionRank { SessionProductID = sessionProductID, Sequence = i }); } } webShoppingCartDetails.BadgeName = this.txtName1.Text.Trim(); webShoppingCartDetails.JobTitle = this.txtTitle.Text.Trim(); webShoppingCartDetails.CompanyName = this.txtCompany.Text.Trim(); Helpers.SaveCartLine(webShoppingCartDetails, auraId); if (this.SavePersonalInfo()) { base.Response.Redirect("/productcatalog/viewcart"); } }
public void LoadSessionData() { if (base.Request.QueryString["OL"] == null) { return; } string ol = base.Request.QueryString["OL"]; if (string.IsNullOrEmpty(ol)) { throw new HttpException(400, "Bad Request, QueryString Parameter Missing."); } string auraId = Helpers.GetAuraId(Convert.ToString(base.Session["AptifyUniqueId"])); if (string.IsNullOrEmpty(auraId)) { base.Response.Redirect("/Login?ReturnUrl=" + HttpUtility.UrlEncode(base.Request.Url.AbsoluteUri)); } WebShoppingCartEx webShoppingCartEx = Helpers.GetCart(auraId).FirstOrDefault <WebShoppingCartEx>(); if (webShoppingCartEx == null || webShoppingCartEx.Lines == null) { base.Response.Redirect("/productcatalog/viewcart"); return; } if (webShoppingCartEx.Lines.FirstOrDefault((WebShoppingCartDetails x) => x.Id == Convert.ToInt32(ol)) == null) { this.btnSubmit.Visible = false; return; } base.Session["CartLine"] = webShoppingCartEx.Lines.First((WebShoppingCartDetails x) => x.Id == Convert.ToInt32(ol)); int productId = webShoppingCartEx.Lines.First((WebShoppingCartDetails x) => x.Id == Convert.ToInt32(ol)).ProductId; MeetingEx meetingByProductId = Helpers.GetMeetingByProductId(productId.ToString()); List <MeetingEx> sessionsByMeetingId = Helpers.GetSessionsByMeetingId(meetingByProductId.Id.ToString()); this.Price.Text = Helpers.GetProductPrice(productId.ToString(), base.Session["PersonID"].ToString()).ToString("C"); this.Title.Text = meetingByProductId.MeetingTitle; if (sessionsByMeetingId.Count > 0) { this.ListViewSessions.DataSource = sessionsByMeetingId; this.ListViewSessions.DataBind(); this.pnlSessions.Visible = true; return; } this.pnlSessions.Visible = false; }
protected void ListViewSessions_OnItemDataBound(object sender, ListViewItemEventArgs e) { WebShoppingCartDetails webShoppingCartDetails = (WebShoppingCartDetails)base.Session["CartLine"]; if (e.Item.ItemType != ListViewItemType.DataItem) { return; } ListViewDataItem listViewDataItem = (ListViewDataItem)e.Item; MeetingEx rowView = (MeetingEx)listViewDataItem.DataItem; CheckBox checkBox = (CheckBox)e.Item.FindControl("SessionSelect"); checkBox.InputAttributes.Add("productId", Convert.ToString(rowView.Product.Id)); if (webShoppingCartDetails.SessionRanks.Any((WebShoppingCartDetailsSessionRank x) => x.SessionProductID == rowView.Product.Id)) { checkBox.Checked = true; HtmlGenericControl htmlGenericControl = (HtmlGenericControl)e.Item.FindControl("Checklbl"); htmlGenericControl.InnerHtml = "Selected"; } }
public void CheckSessionData() { this.AlertWindow.Visible = false; WebShoppingCartEx webShoppingCartEx = (WebShoppingCartEx)base.Session["Cart"]; if (webShoppingCartEx == null || webShoppingCartEx.Lines == null) { return; } foreach (WebShoppingCartDetails current in webShoppingCartEx.Lines) { MeetingEx meetingByProductId = Helpers.GetMeetingByProductId(current.ProductId.ToString()); List <MeetingEx> sessionsByMeetingId = Helpers.GetSessionsByMeetingId(meetingByProductId.Id.ToString()); if (sessionsByMeetingId.Count > 0 && current.SessionRanks.Count == 0) { this.divCheckout.Visible = false; this.AlertWindow.Visible = true; return; } } List <WebShoppingCartItemView> list = (List <WebShoppingCartItemView>)base.Session["CartDetails"]; this.divCheckout.Visible = (list != null && list.Count != 0); }
public void LoadOrderData() { string text = base.Request.QueryString["id"]; if (string.IsNullOrEmpty(text)) { throw new HttpException(400, "Bad Request, QueryString Parameter Missing."); } Order order = Helpers.GetOrderById(text); string personId = Helpers.GetPersonId(Convert.ToString(base.Session["PersonID"])); if (string.IsNullOrEmpty(personId)) { base.Response.Redirect("/Login?ReturnUrl=" + HttpUtility.UrlEncode(base.Request.Url.AbsoluteUri)); } bool flag = order.BillToPerson.Id == Convert.ToInt32(personId); if (!flag && order.ShipToPerson.Id == Convert.ToInt32(personId)) { flag = true; } if (!flag) { return; } this.txtOrderNumberTitle.Text = order.Id.ToString(); this.txtOrderNumber.Text = order.Id.ToString(); if (order.BillToPerson != null) { this.txtCustomerNumber.Text = order.BillToPerson.Id.ToString(); } else { if (order.ShipToPerson != null) { this.txtCustomerNumber.Text = order.ShipToPerson.Id.ToString(); } } List <PaymentType> cards = this.GetCards(); if (order.PaymentTypeId == 0 && order.CardNumber == null) { this.PaymentSection.Visible = false; } else { PaymentType paymentType = cards.FirstOrDefault((PaymentType x) => x.Id == order.PaymentTypeId); this.txtCardType.Text = ((paymentType == null) ? "None" : paymentType.Name.Substring(0, paymentType.Name.IndexOf("-", StringComparison.Ordinal) - 1)); if (order.CardNumber != null && order.CardNumber.Length > 3) { this.txtLastFour.Text = "ending in " + order.CardNumber.Substring(order.CardNumber.Length - 4); } } if (order.BillToPerson != null) { Address billingAddress = order.BillingAddress; if (order.BillToCompany != null) { this.txtBillingName.Text = string.Concat(new string[] { order.BillToPerson.FirstName.ToString(), " ", order.BillToPerson.LastName.ToString(), " / ", order.BillToCompany.Name.ToString() }); } else { this.txtBillingName.Text = order.BillToPerson.FirstName.ToString() + " " + order.BillToPerson.LastName.ToString(); } this.txtBillingLine1.Text = billingAddress.Line1; this.txtBillingLine2.Text = billingAddress.Line2; this.txtBillingCity.Text = billingAddress.City; this.txtBillingState.Text = billingAddress.StateProvince; this.txtBillingZip.Text = billingAddress.PostalCode; } else { this.billAddress.Visible = false; this.billAddressHeader.Visible = false; } if (order.ShipToPerson != null && order.ShipToPerson.HomeAddress != null) { Address shippingAddress = order.ShippingAddress; if (order.ShipToCompany != null) { this.txtShippingName.Text = string.Concat(new string[] { order.ShipToPerson.FirstName.ToString(), " ", order.ShipToPerson.LastName.ToString(), " / ", order.ShipToCompany.Name.ToString() }); } else { this.txtShippingName.Text = order.ShipToPerson.FirstName.ToString() + " " + order.ShipToPerson.LastName.ToString(); } this.txtShippingLine1.Text = shippingAddress.Line1; this.txtShippingLine2.Text = shippingAddress.Line2; this.txtShippingCity.Text = shippingAddress.City; this.txtShippingState.Text = shippingAddress.StateProvince; this.txtShippingZip.Text = shippingAddress.PostalCode; } else { this.shipAddress.Visible = false; this.shipAddressHeader.Visible = false; } bool flag2 = false; List <WebShoppingCartItemView> list = new List <WebShoppingCartItemView>(); foreach (OrderLine current in order.Lines) { MeetingEx meetingByProductId = this.GetMeetingByProductId(current.Product.Id); if (meetingByProductId != null) { list.Add(new WebShoppingCartItemView { Id = current.RequestedLineId, MeetingName = meetingByProductId.MeetingTitle, MeetingStart = meetingByProductId.StartDate, MeetingEnd = meetingByProductId.EndDate, ProductId = current.Product.Id, Description = current.Description, Price = current.Extended, IsMeeting = true, Location = (meetingByProductId.Location != null) ? string.Concat(new string[] { meetingByProductId.Location.Line1, " ", meetingByProductId.Location.Line2, " ", meetingByProductId.Location.Line3, " ", meetingByProductId.Location.Line4, ", ", meetingByProductId.Location.City, ", ", meetingByProductId.Location.StateProvince, " ", meetingByProductId.Location.PostalCode, " ", meetingByProductId.Location.Country }) : "", WebDescription = current.Product.WebDescription }); flag2 = true; } else { list.Add(new WebShoppingCartItemView { Id = current.RequestedLineId, MeetingName = current.Product.WebName, ProductId = current.Product.Id, Description = current.Description, Price = current.Extended, IsMeeting = false, WebDescription = current.Product.WebDescription }); } } if (!flag2) { this.lnkCourseCatalog.Visible = false; } this.PriceSubTotal.Text = order.SubTotal.ToString("C"); this.PriceShipping.Text = order.ShippingTotal.ToString("C"); this.PriceTax.Text = order.Tax.ToString("C"); this.PriceTotal.Text = order.GrandTotal.ToString("C"); this.PaymentTotal.Text = order.PaymentTotal.ToString("C"); this.PriceBalance.Text = order.Balance.ToString("C"); this.ListViewCart.DataSource = list; this.ListViewCart.DataBind(); }
public void LoadData() { this.btnLogin.NavigateUrl = "/Login?ReturnUrl=" + HttpUtility.UrlEncode(base.Request.Url.AbsoluteUri); string personId = Helpers.GetPersonId(Convert.ToString(base.Session["PersonID"])); if (!string.IsNullOrEmpty(personId)) { this.btnRegister.Visible = true; this.btnRegisterBottom.Visible = true; this.btnLogin.Visible = false; string auraId = Helpers.GetAuraId(Convert.ToString(base.Session["AptifyUniqueId"])); if (Helpers.IsFirmAdminOrMember(personId, auraId)) { this.btnGroupRegister.Visible = true; this.btnGroupRegisterBottom.Visible = true; } } string text = base.Request.QueryString["id"]; if (string.IsNullOrEmpty(text)) { throw new HttpException(400, "Bad Request, QueryString Parameter Missing."); } string text2 = ConfigurationManager.AppSettings["ServicesUrl"] + "/icpas/api/meetingex/getsinglebyid"; RestClient restClient = new RestClient(text2 + "?Id=" + text); RestRequest request = new RestRequest(Method.GET); IRestResponse restResponse = restClient.Execute(request); MeetingEx meetingEx = JsonConvert.DeserializeObject<MeetingEx>(restResponse.Content); if (meetingEx == null || meetingEx.Product == null || !meetingEx.Product.WebEnabled) { base.Response.Redirect("~/coursenotfound"); } this.Title.InnerText = ((!string.IsNullOrEmpty(meetingEx.Product.Code)) ? string.Format("{0} ({1})", meetingEx.Product.WebName, meetingEx.Product.Code) : meetingEx.Product.WebName); this.StartDate.InnerText = meetingEx.StartDate.ToString("MM/dd/yyyy"); this.EndDate.InnerText = meetingEx.EndDate.ToString("MM/dd/yyyy"); this.RegistrationOpen.InnerText = meetingEx.OpenTime.ToString("h:mm tt"); this.RegistrationClosed.InnerText = meetingEx.StartDate.ToString("h:mm tt"); this.StartTime.InnerText = meetingEx.StartDate.ToString("h:mm tt"); this.EndTime.InnerText = meetingEx.EndDate.ToString("h:mm tt"); this.imgEMaterials.Visible = (meetingEx.EMaterials > 0); this.FieldsOfStudy.InnerText = Helpers.IfNull(meetingEx.FieldOfStudy, "Not Available"); if (Helpers.IfNull(meetingEx.SpecialtyCredits, "") == "") { this.divSpecialtyCredits.Visible = false; } else { this.SpecialtyCredits.InnerText = meetingEx.SpecialtyCredits; } this.MeetingType.InnerText = Helpers.IfNull(meetingEx.Type.Name, "NotAvailable"); this.FacilityName.InnerHtml = Helpers.IfNull(meetingEx.FacilityName, "Not Available"); this.litMarketing.Text = meetingEx.CpeMarketingMeetingSideNavDescription; this.litDescription.Text = meetingEx.CpeMarketingMeetingDescription; if (!string.IsNullOrEmpty(meetingEx.RelatedWebcastInformation)) { this.divCantAttend.Visible = true; this.litCantAttend.Text = meetingEx.RelatedWebcastInformation; } if (meetingEx.Location != null) { this.AddressLine1.InnerHtml = meetingEx.Location.Line1.Trim(); this.AddressLine2.InnerHtml = ((!string.IsNullOrWhiteSpace(meetingEx.Location.Line2)) ? meetingEx.Location.Line2.Trim() : string.Empty); this.AddressCity.InnerText = meetingEx.Location.City.Trim(); this.AddressState.InnerText = meetingEx.Location.StateProvince.Trim(); this.AddressZip.InnerText = meetingEx.Location.PostalCode.Trim(); string str; if (!string.IsNullOrWhiteSpace(meetingEx.Location.Line2)) { str = meetingEx.Location.Line1.Trim() + " " + meetingEx.Location.Line2.Trim(); } else { str = meetingEx.Location.Line1.Trim(); } this.linkMaps.NavigateUrl = string.Format("http://maps.google.com/maps?daddr={0} {1} {2} {3}", new object[] { HttpUtility.UrlEncode(str), meetingEx.Location.City.Trim(), meetingEx.Location.StateProvince.Trim(), meetingEx.Location.PostalCode.Trim() }); } else { this.FacilityName.InnerText = "No Location Available"; this.AddressLine1.Visible = false; this.AddressLine2.Visible = false; this.AddressOther.Visible = false; this.linkMaps.Enabled = false; } if (meetingEx.Product.Category.Id == 6) { this.FacilityName.Visible = false; this.AddressLine1.Visible = false; this.AddressLine2.Visible = false; this.AddressOther.Visible = false; this.linkMaps.Enabled = false; this.noAddress.Visible = true; this.noAddress.InnerText = "Webinar"; } if (meetingEx.Product.Category.Id == 34) { this.FacilityName.Visible = false; this.AddressLine1.Visible = false; this.AddressLine2.Visible = false; this.AddressOther.Visible = false; this.linkMaps.Enabled = false; this.MeetingTime.Visible = false; this.noAddress.Visible = true; this.noAddress.InnerText = "On-Demand"; } if (meetingEx.StartDate.ToShortDateString() == meetingEx.EndDate.ToShortDateString()) { this.EndDate.InnerText = ""; this.spnDateDash.InnerText = ""; } if (meetingEx.Type.Name.Contains("OnDemand")) { this.StartDate.InnerText = "onDemand"; this.EndDate.InnerText = ""; this.RegistrationOpen.InnerText = "onDemand"; this.RegistrationClosed.InnerText = ""; this.StartTime.InnerText = "onDemand"; this.EndTime.InnerText = ""; this.spnTimeDash.InnerText = ""; this.spnRegDash.InnerText = ""; this.spnDateDash.InnerText = ""; } this.Level.InnerText = Helpers.IfNull(meetingEx.Level, "Not Available"); this.Credit.InnerHtml = meetingEx.TotalCredits.ToString("F"); this.PriceMember.InnerText = "Member: " + meetingEx.Product.Prices.First((ProductPrice q) => q.MemberType.Name == "Member").Price.ToString("C"); this.PriceNonMember.InnerText = "Nonmember: " + meetingEx.Product.Prices.First((ProductPrice q) => q.MemberType.Name == "Non-Member").Price.ToString("C"); decimal d = 0m; bool flag = false; if (base.Session["PersonID"] != null) { d = Helpers.GetProductPrice(meetingEx.Product.Id.ToString(), base.Session["PersonID"].ToString()); flag = true; this.YourPrice.InnerText = d.ToString("C"); } else { this.divYourPrice.Visible = false; } if (flag && d > 0m) { this.GetEventAccessPassResult(); } text2 = ConfigurationManager.AppSettings["ServicesUrl"] + "/icpas/api/productex/GetProductDiscountsById"; restClient = new RestClient(text2 + "?productId=" + meetingEx.Product.Id); restResponse = restClient.Execute(request); List<ProductDiscountViewModel> list = JsonConvert.DeserializeObject<List<ProductDiscountViewModel>>(restResponse.Content); bool flag2 = true; string text3 = string.Empty; if (list != null && list.Any<ProductDiscountViewModel>()) { foreach (ProductDiscountViewModel current in list) { if (flag2) { text3 = current.Name; flag2 = false; } else { text3 = text3 + "\n" + current.Name; } } this.DiscountsAvailable.InnerText = Helpers.IfNull(text3, "Not Available"); } else { this.DiscountsAvailable.InnerText = Helpers.IfNull(text3, "Not Available"); } bool flag3 = false; if (meetingEx.Speakers != null) { foreach (MeetingSpeakerEx current2 in meetingEx.Speakers) { if (current2.Status != null & current2.Status.TrimEnd(new char[0]) == "Accepted") { HtmlGenericControl htmlGenericControl = new HtmlGenericControl("div") { ID = "Bio_" + current2.Id, InnerHtml = current2.Speaker.CpaSpeakerBio ?? string.Empty, ClientIDMode = ClientIDMode.Static }; htmlGenericControl.Attributes["class"] = "modal-body"; this.bioPlaceholder.Controls.Add(htmlGenericControl); string text4 = string.Format("<a href='#' data-toggle='modal' data-target='#bio-modal' onClick='setbio(\"#{2}\")'>{0} {1}</a>", current2.Speaker.FirstName, current2.Speaker.LastName, htmlGenericControl.ClientID); if (current2.Speaker.Company != null) { text4 = text4 + ", " + current2.Speaker.Company.Name; } HtmlGenericControl child = new HtmlGenericControl("li") { ID = "Speaker_" + current2.Id, InnerHtml = text4 }; this.Speakers.Controls.Add(child); flag3 = true; } } } if (meetingEx.Objectives == null) { this.Overview.Visible = false; this.overviewHeadline.Visible = false; } if (meetingEx.Speakers == null || meetingEx.Speakers.Count == 0 || !flag3) { this.Speakers.Visible = false; this.speakersHeadline.Visible = false; } if (meetingEx.AdditionalInformation == null) { this.Notes.Visible = false; this.notesHeadline.Visible = false; } if (meetingEx.Objectives == null) { this.Overview.Visible = false; this.overviewHeadline.Visible = false; } if (meetingEx.Prerequisites == null) { this.Prerequisites.Visible = false; this.prerequisitesHeadline.Visible = false; } if (meetingEx.Summary == null) { this.Highlights.Visible = false; this.highlightsHeadline.Visible = false; } if (meetingEx.OnsiteDescription == null) { this.OnSite.Visible = false; this.onsiteHeadline.Visible = false; } this.Notes.InnerHtml = (meetingEx.AdditionalInformation ?? "No Additional Information"); this.Overview.InnerHtml = (meetingEx.Objectives ?? "No Information Available"); this.Prerequisites.InnerHtml = (meetingEx.Prerequisites ?? "No Information Available"); this.Highlights.InnerHtml = (meetingEx.Summary ?? "No Information Available"); this.OnSite.InnerHtml = (meetingEx.OnsiteDescription ?? "No Information Available"); this.GetRelated(meetingEx.Product.Id); if ((meetingEx.MaxRegistrants <= 0 || meetingEx.AvailSpace > 0) && meetingEx.Product.WebEnabled && !meetingEx.NoRegistration && meetingEx.Product.IsSold) { if (!(meetingEx.Product.AvailableUntil < DateTime.Today)) { goto IL_D22; } DateTime arg_CD5_0 = meetingEx.Product.AvailableUntil; if (meetingEx.Product.AvailableUntil.Year <= 1900) { goto IL_D22; } } this.btnRegister.Visible = false; this.btnLogin.Visible = false; this.btnGroupRegister.Visible = false; this.btnRegisterBottom.Visible = false; IL_D22: if (meetingEx.NoRegistration) { this.RegistrationDetails.Visible = true; } base.Session["ProductId"] = meetingEx.Product.Id; }