private void Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         double Commission;
         if (MainWindow.IsEmpty(guestRequestKeyTextBox.Text))
         {
             if (MainWindow.IsEmpty(hostingUnitKeyTextBox.Text))
             {
                 bl = BL.Factory.GetBL();
             }
         }
         bl.CheakDatesAreFree(bl.GetHostingUnitFromOrder(order), bl.GetGuestRequestFromOrder(order).EntryDate, bl.GetGuestRequestFromOrder(order).EndDate);
         if ((int)this.statusComboBox.SelectedItem == 2)
         {
             Commission = bl.updateStatusOfOrder(order, (int)this.statusComboBox.SelectedItem);
             MessageBox.Show("your details update successfully ." +
                             "Commission is:" + Commission);
         }
         else
         {
             MessageBox.Show("your details update successfully .");
         }
     }
     catch (Exception E) { MessageBox.Show(E.Message); }
 }
Ejemplo n.º 2
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            try
            {
                if (bl.CheakDatesAreFree(hostingUnit, GuestRequest.EntryDate, GuestRequest.EndDate))
                {
                    bl.NewOrder(GuestRequest, hostingUnit);

                    // a thred that activates sending email to guest
                    workerThread         = new BackgroundWorker();
                    workerThread.DoWork += new DoWorkEventHandler(workerThread_DoWork);
                    workerThread.RunWorkerAsync();
                    MessageBox.Show("your order have been craeted");
                }
                else
                {
                    MessageBox.Show("the dates of the order have been booked ");
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
        }