Ejemplo n.º 1
0
        private void editCartItemsChangeBtn_Click(object sender, EventArgs e)
        {
            try
            {
                string lineinfo = cartLV.Items[editCartItemsIndexCombox.SelectedIndex].SubItems[1].Text;
                TourChoice.starsChosen    = int.Parse(editCartItemsHotelCombox.SelectedItem.ToString().Substring(0, 1));
                TourChoice.tourHotelStars = editCartItemsHotelCombox.SelectedIndex;
                TourChoice.QuantityChosen = int.Parse(editCartItemsQtyNUD.Value.ToString());

                //Changes made here
                try
                {
                    foreach (Tour t in TourCollection.GetTour("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.UpdateRow(t.Name);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            catch
            {
                MessageBox.Show("Please select an item to edit.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            editCartItemsIndexCombox.Text = "";
            cartBtn_Click(sender, e);
        }
Ejemplo n.º 2
0
        private void tourSearchBtn_Click(object sender, EventArgs e)
        {
            // Changes made here
            tourListingLV.Items.Clear();
            TourChoice.Country        = tourCountryCombox.SelectedItem.ToString();
            TourChoice.Region         = tourRegionCombox.SelectedItem.ToString();
            TourChoice.Date           = tourDateCombox.Value.ToString("yyyy-MM-dd");
            TourChoice.Duration       = tourDurationCombox.SelectedItem.ToString();
            TourChoice.tourHotelStars = tourHotelCombox.SelectedIndex;
            TourChoice.RegionCheck    = tourRegionRB.Checked;
            TourChoice.CountryCheck   = tourCountryRB.Checked;
            TourChoice.DateCheck      = tourDateCB.Checked;
            TourChoice.DurationCheck  = tourDurationCB.Checked;

            List <Tour> t = TourCollection.Refined();

            foreach (Tour x in t)
            {
                ListViewItem item = new ListViewItem(x.Name);
                item.SubItems.Add("(" + x.Country + ", " + x.State + ")");
                item.SubItems.Add(x.Region);
                item.SubItems.Add(x.Summary);
                item.SubItems.Add("Price : $" + TourChoice.calcTotal(x.Price));
                tourListingLV.Items.Add(item);
            }
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 private void tourHotelCombox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (TourChoice.tourHotelStars != tourHotelCombox.SelectedIndex)
     {
         TourChoice.tourHotelStars = tourHotelCombox.SelectedIndex;
         List <Tour> t = TourCollection.GetTour("select * from Tour");
         foreach (Tour x in t)
         {
             if (x.Name.Equals(TourChoice.tourChosen))
             {
                 tourPriceLbl.Text = String.Format("Price: ${0}/pax", TourChoice.calcTotal(x.Price));
             }
         }
     }
     tourPriceLbl.Refresh();
 }
Ejemplo n.º 5
0
        private void tourAddCartBtn_Click(object sender, EventArgs e)
        {
            //Changes made here
            string cartItemPrice = tourPriceLbl.Text.Substring(8);

            cartItemPrice = cartItemPrice.Remove(cartItemPrice.Length - 4);
            if (!tourHotelCombox.Text.Equals("-"))
            {
                TourCollection.InsertCart(tourNameLbl.Text, cartItemPrice, tourQuantityNumeric.Value.ToString(), tourHotelCombox.Text.Substring(0, 1));

                MessageBox.Show("Tour successfully added to cart!", "Cart item added!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                MessageBox.Show("Please input the type of hotel you wish to stay in.");
            }
        }
Ejemplo n.º 6
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);
            }
        }
Ejemplo n.º 7
0
        private void refreshForm()
        {
            //Changes made here
            List <Tour> t = TourCollection.GetTour("select * from Tour");

            foreach (Tour x in t)
            {
                if (!x.TQuantity.Equals("0")) // to ensure that only available tours are loaded
                {
                    ListViewItem item = new ListViewItem(x.Name);
                    item.SubItems.Add("(" + x.Country + ", " + x.State + ")");
                    item.SubItems.Add(x.Region);
                    item.SubItems.Add(x.Summary);
                    item.SubItems.Add("Price: $" + x.Price);
                    tourListingLV.Items.Add(item);
                }
            }
        }
Ejemplo n.º 8
0
        private void receiptText_VisibleChanged(object sender, EventArgs e)
        {
            try
            {
                receiptText.Text = "";
                string payment = "";
                string txt     = "";
                Random rnd     = new Random();
                CartPayment.OrderNo = rnd.Next(1000, 9999);

                payment += "Card Name: " + cardNameText.Text + Environment.NewLine;
                payment += "Card No: " + cardNoText.Text + Environment.NewLine;
                payment += "Card Expiry Date: " + cardEDDTP.Text;

                receiptText.AppendText(Environment.NewLine);
                receiptText.Text = "Order No: " + CartPayment.OrderNo;
                receiptText.AppendText(Environment.NewLine);
                receiptText.Text += "Username: "******"Order Details:" + Environment.NewLine;

                foreach (Array a in TourCollection.getBookings())
                {
                    foreach (string s in a)
                    {
                        txt += s + "\r\n";
                    }
                    txt += "\r\n";
                }

                receiptText.Text += txt;

                receiptText.Text  += "Total Cost: $" + TourChoice.Cost.ToString();
                profileOHText.Text = receiptText.Text;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 9
0
        private void wishlistBtn_Click(object sender, EventArgs e)
        {
            wishlistLV.Items.Clear();
            navigationBarPanel.Height = wishlistBtn.Height;
            navigationBarPanel.Top    = wishlistBtn.Top;
            navigationTC.SelectTab(4);
            pageTitle.Text = ": Wishlist Page";

            //Changes made here
            List <Tour> t = TourCollection.GetTour("select w.TourID, TourName, TourState, Country, Region, Summary,Itinerary, Price, StartDate, EndDate, Duration, Quantity" +
                                                   " from tour t, wishlist w" +
                                                   " where t.TourId = w.TourID AND Username = '******'");

            foreach (Tour x in t)
            {
                ListViewItem item = new ListViewItem(x.Name);
                item.SubItems.Add("(" + x.Country + ", " + x.State + ")");
                item.SubItems.Add(x.Region);
                item.SubItems.Add(x.Summary);
                item.SubItems.Add("Price: $" + TourChoice.calcTotal(x.Price));
                wishlistLV.Items.Add(item);
            }
        }
Ejemplo n.º 10
0
        private void makePaymentBtn_Click(object sender, EventArgs e)
        {
            TourChoice.getIndex = cartLV.Items.Count;
            TourChoice.Cost     = double.Parse(ttlCartPriceNumText.Text.Substring(1));
            string[] tourName  = new string[TourChoice.getIndex];
            string[] quantity  = new string[TourChoice.getIndex];
            string[] stars     = new string[TourChoice.getIndex];
            string[] pricePaid = new string[TourChoice.getIndex];
            for (int i = 0; i < TourChoice.getIndex; i++)
            {
                tourName[i]  = cartLV.Items[i].SubItems[1].Text;
                stars[i]     = cartLV.Items[i].SubItems[5].Text.Substring(13, 1);
                quantity[i]  = cartLV.Items[i].SubItems[6].Text.Substring(10, 1);
                pricePaid[i] = cartLV.Items[i].SubItems[4].Text.Substring(6);
            }

            try
            {
                if (cardNoText.Text.Equals(""))
                {
                    MessageBox.Show("Enter a valid Card Number.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    if (cardNameText.Text.Equals(""))
                    {
                        MessageBox.Show("Enter a valid Card Name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        if (cardEDDTP.Text.Equals(""))
                        {
                            MessageBox.Show("Enter a valid Card Number.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            if (cardCVVText.Text.Equals(""))
                            {
                                MessageBox.Show("Enter a valid Card Number.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                CartPayment.Payable = false;
                            }
                            else
                            {
                                if (cartLV.Items.Count == 0)
                                {
                                    CartPayment.Payable = false;
                                    MessageBox.Show("Payment will only be valid if there is/are cart item(s).", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                                else
                                {
                                    CartPayment.Payable = true;
                                }
                            }
                        }
                    }
                }

                if (CartPayment.Payable == true)
                {
                    TourCollection.InsertBK(tourName, pricePaid, quantity, cardNoText.Text, stars);
                    cartBtn_Click(sender, e);
                    receiptPanel.Visible = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 11
0
        public tourDetailPage()
        {
            InitializeComponent();
            Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 10, 10));

            if (Class.BackgroundColor.chosenColor == "White")
            {
                this.BackColor = Color.FromArgb(255, 255, 255);
            }
            else if (Class.BackgroundColor.chosenColor.Equals("Gray"))
            {
                this.BackColor = Color.FromArgb(232, 232, 232);
            }
            else
            {
                this.BackColor = Color.FromArgb(247, 245, 230);
            }

            //if hotel was chosen in refined search
            tourHotelCombox.SelectedIndex = TourChoice.tourHotelStars;

            List <Tour> t = TourCollection.GetTour("select * from Tour");

            foreach (Tour x in t)
            {
                if (x.Name.Equals(TourChoice.tourChosen))
                {
                    tourNameLbl.Text       = x.Name;
                    tourLocationLbl.Text   = x.Country + ", " + x.State;
                    tourRegionLbl.Text     = x.Region;
                    tourPriceLbl.Text      = TourChoice.tourPrice + "/pax";
                    tourDatesLbl.Text      = "Dates: " + x.StartDate.ToString("d/M/yyyy") + " - " + x.EndDate.ToString("d/M/yyyy");
                    tourItineraryText.Text = File.ReadAllText(".\\Tour Details\\" + x.Itinerary + ".txt");
                }
            }

            string imageSrc = "";

            if (tourNameLbl.Text.Contains("JB's"))
            {
                imageSrc = ".\\Tour Images\\JB.JPG";
            }
            else if (tourNameLbl.Text.Contains("Malaysia's Hottest"))
            {
                imageSrc = ".\\Tour Images\\KL.JPG";
            }
            else if (tourNameLbl.Text.Contains("Metropolitan Port"))
            {
                imageSrc = ".\\Tour Images\\Surabaya.JPG";
            }
            else if (tourNameLbl.Text.Contains("Historical Capital"))
            {
                imageSrc = ".\\Tour Images\\jakarta.JPG";
            }
            else if (tourNameLbl.Text.Contains("Busy Busan"))
            {
                imageSrc = ".\\Tour Images\\Busan.JPG";
            }
            else if (tourNameLbl.Text.Contains("Modern Metropolis"))
            {
                imageSrc = ".\\Tour Images\\Seoul.JPG";
            }
            else if (tourNameLbl.Text.Contains("The Old Capital"))
            {
                imageSrc = ".\\Tour Images\\Kyoto.JPG";
            }
            else if (tourNameLbl.Text.Contains("Modern but Traditional"))
            {
                imageSrc = ".\\Tour Images\\tokyo.JPG";
            }
            else if (tourNameLbl.Text.Contains("The Presidential Palace"))
            {
                imageSrc = ".\\Tour Images\\washington-dc.JPG";
            }
            else if (tourNameLbl.Text.Contains("Surfs-Up in Hollywood"))
            {
                imageSrc = ".\\Tour Images\\Hollywood.JPG";
            }
            else if (tourNameLbl.Text.Contains("Fine-Artisan"))
            {
                imageSrc = ".\\Tour Images\\Montreal.JPG";
            }
            else if (tourNameLbl.Text.Contains("Winter Wonderland"))
            {
                imageSrc = ".\\Tour Images\\ottawa.JPG";
            }
            else if (tourNameLbl.Text.Contains("The Kingdom Awakens"))
            {
                imageSrc = ".\\Tour Images\\Dublin.JPG";
            }
            else if (tourNameLbl.Text.Contains("Culture of the Capital"))
            {
                imageSrc = ".\\Tour Images\\Dublin.JPG";
            }
            else if (tourNameLbl.Text.Contains("The Sinking City"))
            {
                imageSrc = ".\\Tour Images\\venice.JPG";
            }
            else if (tourNameLbl.Text.Contains("For the Romantics"))
            {
                imageSrc = ".\\Tour Images\\paris.JPG";
            }

            tourImagePB.Image    = Image.FromFile(imageSrc);
            tourImagePB.SizeMode = PictureBoxSizeMode.StretchImage;
        }
Ejemplo n.º 12
0
        private void tourAddWishlistBtn_Click(object sender, EventArgs e)
        {
            TourCollection.ToWishlist(tourNameLbl.Text);

            MessageBox.Show("Tour successfully saved to wishlist!", "Wishlist added!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
        }