Пример #1
0
 private void BTNAddon_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (ListBooking.SelectedIndex >= 0)
         {
             TBikeDAL  MyDAl       = new TBikeDAL();
             DataTable ResultTable = MyDAl.SelectSnackSalesByBookIDCustomer(TBBookID.Text.Trim(), TBCustomer.Text.Trim());
             if (ResultTable.Rows.Count > 0)
             {
                 PopWindow pop = new PopWindow(ImageType.Information, "Addon Details", "Item :" + Convert.ToString(ResultTable.Rows[0]["SnackName"]).Trim() + " , Quantity :" + Convert.ToInt32(ResultTable.Rows[0]["Quantity"]) + " , Total Price :" + Convert.ToDouble(ResultTable.Rows[0]["TotalPrice"]), "OK");
                 pop.ShowDialog();
             }
             else
             {
                 PopWindow pop = new PopWindow(ImageType.Warning, "No Detail", "No Data Found for this booking", "OK");
                 pop.ShowDialog();
             }
         }
         else
         {
             PopWindow pop = new PopWindow(ImageType.Warning, "No Data..", "Please Select a List", "OK");
             pop.ShowDialog();
         }
     }
     catch (Exception ex) {
         PopWindow pop = new PopWindow(ImageType.Error, "Error", "Error: " + ex.Message, "OK");
         pop.ShowDialog();
     }
 }
Пример #2
0
        private void ListBooking_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TBBookID.Text = ListBooking.SelectedValue.ToString().Trim();
            TBikeDAL  MyDAL       = new TBikeDAL();
            DataTable ResultTable = MyDAL.SelectAllBookingDetailsByID(TBBookID.Text);

            TBBike.Text       = Convert.ToString(ResultTable.Rows[0]["BicycleName"]).Trim();
            TBBookStatus.Text = "Successful";
            TBBikeType.Text   = Convert.ToString(ResultTable.Rows[0]["BicycleType"]).Trim();
            DateTime date = Convert.ToDateTime(ResultTable.Rows[0]["BookingDate"]);

            TBBookDate.Text   = date.ToShortDateString().ToString().Trim();
            TBStartTime.Text  = Convert.ToString(ResultTable.Rows[0]["StartTime"]).Trim();
            TBEndTime.Text    = Convert.ToString(ResultTable.Rows[0]["EndTime"]).Trim();
            TBDeposit.Text    = Convert.ToString(ResultTable.Rows[0]["BookingDeposit"]).Trim();
            TBCustomer.Text   = Convert.ToString(ResultTable.Rows[0]["Customer"]).Trim();
            TBTotalPrice.Text = Convert.ToString(ResultTable.Rows[0]["TotalPrice"]).Trim();
            TBRemark.Text     = Convert.ToString(ResultTable.Rows[0]["Remark"]).Trim();
            TBCreatedBy.Text  = Convert.ToString(ResultTable.Rows[0]["CreatedBy"]).Trim();
            date                 = Convert.ToDateTime(ResultTable.Rows[0]["CreatedAt"]);
            TBCreatedAt.Text     = date.ToShortDateString().ToString().Trim();
            TBLastUpdatedBy.Text = Convert.ToString(ResultTable.Rows[0]["LastUpdatedBy"]).Trim();
            date                 = Convert.ToDateTime(ResultTable.Rows[0]["LastUpdatedAt"]);
            TBLastUpdatedAt.Text = date.ToShortDateString().ToString().Trim();
            TBShowTitle.Text     = "Seleted ID: " + ListBooking.SelectedValue.ToString().Trim();

            DataTable ResultFatTable = MyDAL.SelectSnackSalesByBookIDCustomer(TBBookID.Text.Trim(), TBCustomer.Text.Trim());

            if (ResultFatTable.Rows.Count == 0)
            {
                BTNAddon.IsEnabled = false;
            }
            else
            {
                BTNAddon.IsEnabled = true;
            }
        }