예제 #1
0
        /// <summary>
        ///  http://www.binaryintellect.net/articles/c6a28be9-8511-4d41-b3b6-6287a48f828f.aspx
        /// </summary>
        protected void Wizard1_OnActiveStepChanged(object sender, EventArgs e)
        {
            if (Wizard1.ActiveStep.Name == "Date & Time")
            {
                if (bookingObject.PackageID == 0)
                {
                    AlertMessage("Please select a package");
                    Wizard1.ActiveStepIndex = 0;
                }
            }

            if (Wizard1.ActiveStep.Name == "Add Your Info")
            {
                if (bookingObject.TimeSlot == new TimeSpan(0, 0, 0))
                {
                    AlertMessage("Please select a booking time");
                    Wizard1.ActiveStepIndex = 1;
                }

                if (bookingObject.BookingDate == DateTime.MinValue)
                {
                    AlertMessage("Please select a booking date");
                    Wizard1.ActiveStepIndex = 1;
                }
            }

            if (Wizard1.ActiveStep.Name == "Summary")
            {
                double packagePrice = 0;
                double extraTotal   = 0;
                double total        = 0;
                if (bookingObject.PackageID > 0)
                {
                    DataView dv = new DataView(packageList);
                    dv.RowFilter = "PackageID=" + bookingObject.PackageID.ToString();

                    //get data from a specific column
                    //https://www.codeproject.com/Questions/48158/get-data-from-DataView
                    foreach (DataRowView drV in dv)
                    {
                        lblPackageName.Text  = drV["PackageName"].ToString();
                        packagePrice         = Convert.ToDouble(drV["PackagePrice"].ToString());
                        lblPackagePrice.Text = string.Format("{0:0.00}", packagePrice);
                    }
                }

                List <clsExtra> extras = new List <clsExtra>();
                if (selectedExtras.Count > 0)
                {
                    lblServices.Visible = true;
                    foreach (var extraId in selectedExtras)
                    {
                        DataView dv = new DataView(extrasList);
                        dv.RowFilter = "ExtraID=" + extraId;

                        clsExtra extra = new clsExtra();
                        foreach (DataRowView drV in dv)
                        {
                            extra.ExtraPrice = Convert.ToDouble(drV["ExtraPrice"].ToString());
                            extraTotal       = extraTotal + extra.ExtraPrice;
                            extra.ExtraName  = drV["ExtraName"].ToString();
                        }

                        extras.Add(extra);
                    }
                }

                if (extras.Count > 0)
                {
                    lstViewExtras.DataSource = extras;
                    lstViewExtras.DataBind();
                }

                total = extraTotal + packagePrice;
                if (bookingObject.CouponCode > 0)
                {
                    panelCoupon.Visible = true;
                    total = total - 5;
                }
                else
                {
                    panelCoupon.Visible = false;
                }
                lblTotal.Text = string.Format("{0:0.00}", total);
                lblBookingDateAndTime.Text = string.Format("{0:dd/MM/yyyy}", bookingObject.BookingDate) + " " +
                                             DateTime.Today.Add(bookingObject.TimeSlot).ToString("hh:mm tt");
            }
        }
예제 #2
0
        public void GenerateBookingSummary()
        {
            double packagePrice = 0;
            double extraTotal   = 0;

            bookingTotal = 0;
            if (bookingObject.PackageID > 0)
            {
                DataView dv = new DataView(packageList);
                dv.RowFilter = "PackageID=" + bookingObject.PackageID.ToString();
                foreach (DataRowView drV in dv)
                {
                    //create item
                    Item item = new Item()
                    {
                        name     = drV["PackageName"].ToString(),
                        currency = "GBP",
                        price    = drV["PackagePrice"].ToString(),
                        quantity = "1"
                    };
                    //add item to item list
                    bookingItemList.Add(item);

                    //set values to booking summary
                    lblPackageName.Text  = item.name;
                    packagePrice         = Convert.ToDouble(item.price);
                    lblPackagePrice.Text = string.Format("{0:0.00}", packagePrice);
                }
            }

            List <clsExtra> extras = new List <clsExtra>();

            if (selectedExtras.Count > 0)
            {
                lblServices.Visible = true;
                foreach (var extraId in selectedExtras)
                {
                    DataView dv = new DataView(extrasList);
                    dv.RowFilter = "ExtraID=" + extraId;

                    clsExtra extra = new clsExtra();
                    foreach (DataRowView drV in dv)
                    {
                        //create item
                        Item item = new Item()
                        {
                            name     = drV["ExtraName"].ToString(),
                            currency = "GBP",
                            price    = drV["ExtraPrice"].ToString(),
                            quantity = "1"
                        };
                        //add item to item list
                        bookingItemList.Add(item);

                        //set values to booking summary extra list
                        extra.ExtraPrice = Convert.ToDouble(item.price);
                        extraTotal       = extraTotal + extra.ExtraPrice;
                        extra.ExtraName  = item.name;
                    }

                    extras.Add(extra);
                }
            }

            if (extras.Count > 0)
            {
                lstViewExtras.DataSource = extras;
                lstViewExtras.DataBind();
            }

            bookingTotal  = extraTotal + packagePrice;
            lblTotal.Text = string.Format("{0:0.00}", bookingTotal);
            lblBookingDateAndTime.Text = string.Format("{0:dd/MM/yyyy}", bookingObject.BookingDate) + " " + DateTime.Today.Add(bookingObject.TimeSlot).ToString("hh:mm tt");
        }