protected void btnCLE_OnClick(object sender, EventArgs e) { LinkButton linkButton = (LinkButton)sender; string value = linkButton.CommandArgument.Split(new char[] { ',' })[0]; int associatedId = Convert.ToInt32(linkButton.CommandArgument.Split(new char[] { ',' })[1]); string commandName = linkButton.CommandName; if (string.IsNullOrEmpty(commandName) || string.IsNullOrEmpty(value)) { return; } 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) { Helpers.NewCart(auraId); webShoppingCartEx = new WebShoppingCartEx(); } Helpers.AddToCart(webShoppingCartEx, Convert.ToInt32(commandName), Convert.ToInt32(value), auraId, null, associatedId, "", ""); base.Response.Redirect(base.Request.RawUrl); }
private void GetEventAccessPassResult() { string auraId = Helpers.GetAuraId(Convert.ToString(base.Session["AptifyUniqueId"])); if (string.IsNullOrEmpty(auraId)) { return; } string meetingId = base.Request.QueryString["id"]; int id = Helpers.GetMeetingByMeetingId(meetingId).Product.Id; WebShoppingCartEx webShoppingCartEx = Helpers.GetCart(auraId).FirstOrDefault<WebShoppingCartEx>(); string baseUrl = ConfigurationManager.AppSettings["ServicesUrl"] + "/icpas/api/WebShoppingCartEx/GetEventAccessPassResult"; RestClient restClient = new RestClient(baseUrl); RestRequest restRequest = new RestRequest(Method.GET); restRequest.AddParameter("lgAttendeeID", Convert.ToInt64(base.Session["PersonID"])); restRequest.AddParameter("lgProductID", Convert.ToInt64(id)); if (webShoppingCartEx != null) { restRequest.AddParameter("cartId", webShoppingCartEx.Id); } else { restRequest.AddParameter("cartId", null); } IRestResponse restResponse = restClient.Execute(restRequest); string text = JsonConvert.DeserializeObject<string>(restResponse.Content); if (Helpers.TrimOrNull(text) != "" && !Helpers.TrimOrNull(text).Contains("Error occurred")) { this.pnlAccPassMsg.Visible = true; this.lblAccPassMsg.Text = "Because you are a <span style='font-style: italic;'>" + text.Trim() + "</span> holder, your price will be discounted when you register."; return; } this.pnlAccPassMsg.Visible = false; }
private bool GetAccessPassCartValidationResult() { string auraId = Helpers.GetAuraId(Convert.ToString(base.Session["AptifyUniqueId"])); if (string.IsNullOrEmpty(auraId)) { return(false); } string arg_3A_0 = base.Request.QueryString["id"]; WebShoppingCartEx webShoppingCartEx = Helpers.GetCart(auraId).FirstOrDefault <WebShoppingCartEx>(); if (webShoppingCartEx == null) { return(true); } string baseUrl = ConfigurationManager.AppSettings["ServicesUrl"] + "/icpas/api/WebShoppingCartEx/GetAccessPassCartValidationResult"; RestClient restClient = new RestClient(baseUrl); RestRequest restRequest = new RestRequest(Method.GET); restRequest.AddParameter("cartId", webShoppingCartEx.Id); IRestResponse restResponse = restClient.Execute(restRequest); string text = JsonConvert.DeserializeObject <string>(restResponse.Content); if (Helpers.TrimOrNull(text) != "" && !Helpers.TrimOrNull(text).Contains("Error occurred")) { this.AlertWindow.Visible = true; this.AlertWindow.InnerText = text; return(false); } return(true); }
protected void btnProceed_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)); } string value = base.Request.QueryString["id"]; if (string.IsNullOrEmpty(value)) { throw new HttpException(400, "Bad Request, QueryString Parameter Missing."); } int detailId = Convert.ToInt32(value); WebShoppingCartEx cart = this.Setup_Cart(auraId); foreach (ListViewDataItem current in this.ListViewPeople.Items) { CheckBox checkBox = (CheckBox)current.FindControl("PersonCheck"); int num = Convert.ToInt32(checkBox.InputAttributes["rowid"]); if (checkBox.Checked && num > 0) { Helpers.AddToCart(cart, num, detailId, auraId, null, 0, "", ""); } } base.Response.Redirect("/ProductCatalog/ViewCart"); }
public static IRestResponse AddToCart(WebShoppingCartEx cart, int registrantId, int detailId, string auraId, string badgeName = null, int associatedId = 0, string companyName = "", string jobTitle = "") { var apiUrl = ConfigurationManager.AppSettings["ServicesUrl"] + "/icpas/api/WebShoppingCartEx/AddShoppingCartLine"; var client = new RestClient(apiUrl); var request = new RestRequest(Method.PUT); request.AddHeader("x-aura-token", auraId); request.RequestFormat = DataFormat.Json; cart.Lines = new List <WebShoppingCartDetails> { new WebShoppingCartDetails { ProductId = detailId, RegistrantId = registrantId, BadgeName = badgeName, AssociatedLineId = associatedId, JobTitle = jobTitle, CompanyName = companyName, }, }; request.AddBody(cart); var response = client.Execute(request); return(response); }
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 WebShoppingCartEx Setup_Cart(string auraId) { WebShoppingCartEx webShoppingCartEx = Helpers.GetCart(auraId).FirstOrDefault <WebShoppingCartEx>(); if (webShoppingCartEx != null) { return(webShoppingCartEx); } Helpers.NewCart(auraId); return(new WebShoppingCartEx()); }
protected void btnUpdate_OnClick(object sender, EventArgs e) { WebShoppingCartOrderView webShoppingCartOrderView = (WebShoppingCartOrderView)base.Session["Cart"]; using (IEnumerator <WebShoppingCartDetails> enumerator = webShoppingCartOrderView.Lines.GetEnumerator()) { while (enumerator.MoveNext()) { WebShoppingCartDetails line = enumerator.Current; line.Price = webShoppingCartOrderView.Order.Lines.First((OrderLineViewModel x) => x.RequestedLineId == line.Id).Price; } } foreach (ListViewDataItem current in this.ListViewCart.Items) { CheckBox checkBox = (CheckBox)current.FindControl("Remove"); int rowId = Convert.ToInt32(checkBox.InputAttributes["rowid"]); if (!Convert.ToBoolean(checkBox.InputAttributes["is-session"])) { if (checkBox.Checked) { this.RemoveRow(rowId.ToString()); } else { CheckBox checkBox2 = (CheckBox)current.FindControl("ClassPass"); webShoppingCartOrderView.Lines.First((WebShoppingCartDetails x) => x.Id == rowId).ClassPassCardApplied = checkBox2.Checked; TextBox textBox = (TextBox)current.FindControl("PromoCode"); if (textBox.Text != string.Empty) { webShoppingCartOrderView.Lines.First((WebShoppingCartDetails x) => x.Id == rowId).CouponPromotionalCode = textBox.Text; } } } } WebShoppingCartEx obj = webShoppingCartOrderView; string baseUrl = ConfigurationManager.AppSettings["ServicesUrl"] + "/icpas/api/WebShoppingCartEx/UpdateDiscount"; RestClient restClient = new RestClient(baseUrl); RestRequest restRequest = new RestRequest(Method.POST); string auraId = Helpers.GetAuraId(Convert.ToString(base.Session["AptifyUniqueId"])); if (string.IsNullOrEmpty(auraId)) { base.Response.Redirect("/Login?ReturnUrl=" + HttpUtility.UrlEncode(base.Request.Url.AbsoluteUri)); } restRequest.AddHeader("x-aura-token", auraId); restRequest.RequestFormat = DataFormat.Json; restRequest.AddBody(obj); IRestResponse restResponse = restClient.Execute(restRequest); HttpStatusCode arg_271_0 = restResponse.StatusCode; this.LoadCartData(); }
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 btnRegister_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) { Helpers.NewCart(auraId); webShoppingCartEx = new WebShoppingCartEx(); } string baseUrl = ConfigurationManager.AppSettings["ServicesUrl"] + "/icpas/api/WebShoppingCartEx/AddShoppingCartLine"; RestClient restClient = new RestClient(baseUrl); RestRequest restRequest = new RestRequest(Method.PUT); string text = base.Request.QueryString["id"]; int id = Helpers.GetMeetingByMeetingId(text).Product.Id; if (string.IsNullOrEmpty(text)) { throw new HttpException(400, "Bad Request, QueryString Parameter Missing."); } restRequest.AddHeader("x-aura-token", auraId); int num; int registrantId = int.TryParse(Convert.ToString(base.Session["PersonID"]), out num) ? num : 107962; restRequest.RequestFormat = DataFormat.Json; webShoppingCartEx.Lines = new List<WebShoppingCartDetails> { new WebShoppingCartDetails { ProductId = Convert.ToInt32(id), RegistrantId = registrantId } }; restRequest.AddBody(webShoppingCartEx); restClient.Execute(restRequest); decimal d; bool flag = decimal.TryParse(this.PriceMember.InnerText.Replace("$", ""), out d); if (flag && d > 0m) { this.GetEventAccessPassResult(); } webShoppingCartEx = Helpers.GetCart(auraId).FirstOrDefault<WebShoppingCartEx>(); base.Response.Redirect("/CPE/MeetingRegistration?OL=" + webShoppingCartEx.Lines[webShoppingCartEx.Lines.Count - 1].Id); }
public static void NewCart(string auraId) { var apiUrl = ConfigurationManager.AppSettings["ServicesUrl"] + "/icpas/api/WebShoppingCartEx/AddShoppingCartLine"; var client = new RestClient(apiUrl); var request = new RestRequest(Method.PUT); request.AddHeader("x-aura-token", auraId); request.RequestFormat = DataFormat.Json; var empty = new WebShoppingCartEx { Id = -1, Type = new WebShoppingCartType { Id = 1, }, Name = "Shopping Cart", Lines = new List <WebShoppingCartDetails>(), }; request.AddBody(empty); var response = client.Execute(request); }
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); }