Beispiel #1
0
        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");
        }
Beispiel #2
0
        public void LoadCartData()
        {
            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 details = Helpers.GetOrderDetails(auraId).FirstOrDefault <WebShoppingCartOrderView>();

            base.Session["Cart"] = details;
            if (details == null)
            {
                Helpers.NewCart(auraId);
                base.Session["CartDetails"] = null;
                base.Session["Cart"]        = null;
            }
            else
            {
                List <WebShoppingCartItemView> list = (
                    from item in details.Order.Lines
                    let person = Helpers.GetPersonById(item.RequestedRegistrantId, auraId)
                                 let line = details.Lines.First((WebShoppingCartDetails x) => x.Id == item.RequestedLineId)
                                            select new WebShoppingCartItemView
                {
                    Id = item.RequestedLineId,
                    MeetingName = item.Meeting.MeetingTitle,
                    ProductId = item.Product.Id,
                    MeetingId = item.Meeting.Id,
                    PersonId = item.RequestedRegistrantId,
                    Price = item.Price - item.Price * (line.Discount / 100m),
                    ClassPass = line.ClassPassCardApplied,
                    PromoCode = line.CouponPromotionalCode,
                    CLEId = item.Meeting.cleProductId,
                    SessionCount = item.Meeting.SessionCount,
                    AllowGuests = Helpers.IsGuestRegistrationAvailable(item.Product.Id.ToString(), auraId),
                    Description = Helpers.FormatDescriptionLine(person, line, item)
                }).ToList <WebShoppingCartItemView>();
                HashSet <int> hashSet = new HashSet <int>();
                foreach (WebShoppingCartItemView current in list)
                {
                    if (hashSet.Contains(current.Id))
                    {
                        current.IsSession = true;
                    }
                    hashSet.Add(current.Id);
                }
                decimal d = list.Sum((WebShoppingCartItemView x) => x.Price);
                this.PriceSubTotal.Text     = d.ToString("C");
                this.PriceShipping.Text     = details.Order.ShippingTotal.ToString("C");
                this.PriceTax.Text          = details.Order.Tax.ToString("C");
                this.PriceTotal.Text        = (d + details.Order.ShippingTotal + details.Order.Tax).ToString("C");
                base.Session["CartDetails"] = list;
            }
            this.BindListView();
            this.CheckSessionData();
        }
Beispiel #3
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();
        }
Beispiel #4
0
        public bool LoadCartData()
        {
            decimal num    = 0m;
            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 details = Helpers.GetOrderDetails(auraId).FirstOrDefault <WebShoppingCartOrderView>();

            if (details == null)
            {
                base.Session["CartDetails"] = null;
                this.billAddress.Visible    = false;
            }
            else
            {
                this.billAddress.Visible = true;
                List <WebShoppingCartItemView> list = (
                    from item in details.Order.Lines
                    let person = Helpers.GetPersonById(item.RequestedRegistrantId, auraId)
                                 let line = details.Lines.First((WebShoppingCartDetails x) => x.Id == item.RequestedLineId)
                                            select new WebShoppingCartItemView
                {
                    Id = item.RequestedLineId,
                    MeetingName = item.Meeting.MeetingTitle,
                    ProductId = item.Product.Id,
                    Description = Helpers.FormatDescriptionLine(person, line, item),
                    Price = item.Price - item.Price * (line.Discount / 100m)
                }).ToList <WebShoppingCartItemView>();
                num = list.Sum((WebShoppingCartItemView x) => x.Price);
                this.PriceSubTotal.Text     = num.ToString("C");
                this.PriceShipping.Text     = details.Order.ShippingTotal.ToString("C");
                this.PriceTax.Text          = details.Order.Tax.ToString("C");
                this.PriceTotal.Text        = (num + details.Order.ShippingTotal + details.Order.Tax).ToString("C");
                this.txtName.Text           = details.Order.ShipToPerson.FirstName + details.Order.ShipToPerson.LastName;
                this.txtAddress.Text        = details.Order.ShippingAddress.Line1 + details.Order.ShippingAddress.Line2 + details.Order.ShippingAddress.Line3 + details.Order.ShippingAddress.Line4;
                this.txtCity.Text           = details.Order.ShippingAddress.City;
                this.txtState.Text          = details.Order.ShippingAddress.StateProvince;
                this.txtZip.Text            = details.Order.ShippingAddress.PostalCode;
                this.hiddenCartId.Text      = details.Id.ToString();
                base.Session["CartDetails"] = list;
            }
            this.BindListView();
            return(details.Order.Tax + details.Order.ShippingTotal + num > 0m);
        }