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");
            }
        }
예제 #2
0
        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();
        }
예제 #3
0
        public static WebShoppingCartDetails SaveCartLine(WebShoppingCartDetails cartLine, string auraId)
        {
            var apiUrl  = ConfigurationManager.AppSettings["ServicesUrl"] + "/icpas/api/WebShoppingCartDetails/Save";
            var client  = new RestClient(apiUrl);
            var request = new RestRequest(Method.POST);

            request.AddHeader("x-aura-token", auraId);
            request.RequestFormat = DataFormat.Json;
            request.AddBody(cartLine);
            var response = client.Execute(request);

            return(JsonConvert.DeserializeObject <WebShoppingCartDetails>(response.Content));
        }
        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";
            }
        }
        private void GetEventAccessPassResult()
        {
            WebShoppingCartDetails webShoppingCartDetails = (WebShoppingCartDetails)base.Session["CartLine"];

            if (webShoppingCartDetails != null)
            {
                string auraId = Helpers.GetAuraId(Convert.ToString(base.Session["AptifyUniqueId"]));
                if (string.IsNullOrEmpty(auraId))
                {
                    return;
                }
                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", webShoppingCartDetails.ProductId.ToString());
                if (webShoppingCartEx != null)
                {
                    restRequest.AddParameter("cartId", webShoppingCartEx.Id);
                }
                else
                {
                    restRequest.AddParameter("cartId", null);
                }
                restRequest.AddParameter("cartdetailId", webShoppingCartDetails.Id);
                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.Price.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;
            }
        }
예제 #6
0
 public static string FormatDescriptionLine(PersonEx person, WebShoppingCartDetails line, OrderLineViewModel item)
 {
     //person id 2 is guest
     return(string.Format("Registration for {0} {1}.", person.FirstName, person.LastName));
 }