Exemplo n.º 1
0
        // Cart Tab

        private void editCartItemsRemoveLinkLbl_Click(object sender, EventArgs e)
        {
            //Changes made here
            int    selected = editCartItemsIndexCombox.SelectedIndex;
            string lineinfo = cartLV.Items[selected].SubItems[1].Text;

            try
            {
                foreach (Tour t in TourCollection.GetCart("SELECT c.TourID, TourName, TourState, Country, Region, Summary,Itinerary, c.Price, StartDate, EndDate, Duration,c.HotelStars, c.Quantity" +
                                                          " From Cart c, Tour t" +
                                                          " Where c.TourID = t.TourID AND UserName = '******'"))
                {
                    if (t.Name.Equals(lineinfo))
                    {
                        TourCollection.DeletedRow(t.Name);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            editCartItemsIndexCombox.Text = "";
            cartBtn_Click(sender, e);
        }
Exemplo n.º 2
0
        private void cartBtn_Click(object sender, EventArgs e)
        {
            try
            {
                cartLV.Items.Clear();
                editCartItemsIndexCombox.Items.Clear();
                navigationBarPanel.Height = cartBtn.Height;
                navigationBarPanel.Top    = cartBtn.Top;
                navigationTC.SelectTab(3);
                pageTitle.Text = ": Cart Page";
                double totalcostcart = 0;
                // Changes made here
                List <Tour> t = TourCollection.GetCart("Select c.TourID, TourName, TourState, Country, Region, Summary,Itinerary, c.Price, StartDate, EndDate, Duration,c.HotelStars, c.Quantity" +
                                                       " From Cart c, Tour t" +
                                                       " Where c.TourID = t.TourID AND UserName = '******'");
                int y = 1;
                foreach (Tour x in t)
                {
                    ListViewItem item = new ListViewItem("Item No. #" + y);
                    item.SubItems.Add(x.Name);
                    item.SubItems.Add("(" + x.Country + ", " + x.State + ")");
                    item.SubItems.Add(x.Region);
                    item.SubItems.Add("Price: $" + x.Price);
                    item.SubItems.Add("Hotel Stars: " + x.HotelStars);
                    item.SubItems.Add("Quantity: " + x.TQuantity);
                    totalcostcart += double.Parse(x.Price) * int.Parse(x.TQuantity);
                    cartLV.Items.Add(item);
                    y++;
                }
                int tIndex = y;

                for (int i = 1; i < tIndex; i++)
                {
                    editCartItemsIndexCombox.Items.Add(i);
                }

                ttlCartPriceNumText.Text = "$" + (totalcostcart * CartPayment.ttlCost).ToString();
                double totalcostgst = Convert.ToDouble(totalcostcart) * 1.07;
                ttlPriceNumText.Text = "$" + totalcostgst;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }