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); }
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(); }
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); } } }
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); } }
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; }