예제 #1
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);
            }
        }
예제 #2
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();
 }
예제 #3
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);
            }
        }
예제 #4
0
 public static void UpdateRow(string tourName)
 {
     using (SqlConnection conn = new SqlConnection())
     {
         using (SqlCommand comm = new SqlCommand())
         {
             using (SqlDataAdapter da = new SqlDataAdapter())
             {
                 conn.ConnectionString = "Data Source = DIT-NB1727526\\SQLEXPRESS;" +
                                         "database=APPD_CA2;" +
                                         "integrated security=true";
                 conn.Open();
                 comm.Connection  = conn;
                 comm.CommandText = "UPDATE Cart Set HotelStars = @s, Price = @p, Quantity = @q WHERE TourID = @TN";
                 comm.Parameters.AddWithValue("@s", TourChoice.starsChosen);
                 comm.Parameters.AddWithValue("@p", TourChoice.calcTotal(getBasePrice(tourName)));
                 comm.Parameters.AddWithValue("@q", TourChoice.QuantityChosen);
                 comm.Parameters.AddWithValue("@TN", getTourID(tourName));
                 comm.ExecuteNonQuery();
                 conn.Close();
             }
         }
     }
 }