コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool flat = true;

            if (cb_select.SelectedIndex == 1)
            {
                if (DateTime.Compare(dpt_date_end.Value, this.end_date) > 0 && DateTime.Compare(dpt_date_end.Value, DateTime.Now) < 0)
                {
                    flat = false;
                    MessageBox.Show("Date time not Invalid!");
                    return;
                }
            }
            if (cb_select.SelectedIndex == 2)
            {
                if (DateTime.Compare(dpt_date_end.Value, this.end_date) < 0 || DateTime.Compare(dpt_date_end.Value, DateTime.Now) < 0)
                {
                    flat = false;
                    MessageBox.Show("Date time not Invalid!");
                    return;
                }
            }
            if (flat)
            {
                if (cb_select.SelectedIndex == 0)
                {
                    if (Calendar_BUS.Instance.ChangeCalendar(this.id_reservation, DateTime.Now))
                    {
                        int id_bill            = Bill_BUS.Instance.InsertBill(this.id_reservation, DTO.Session.username);
                        GUI.Bill.fCheckOut frm = new GUI.Bill.fCheckOut();
                        frm.Id_bill = id_bill;
                        this.Hide();
                        frm.ShowDialog();
                        this.Close();
                    }
                }
                else
                {
                    if (cb_select.SelectedIndex == 1)
                    {
                        if (Calendar_BUS.Instance.ChangeCalendar(this.id_reservation, dpt_date_end.Value))
                        {
                            MessageBox.Show("Change calendar is success!");
                            this.Close();
                        }
                    }
                    else
                    {
                        if (Calendar_BUS.Instance.ChangeCalendar(this.id_reservation, dpt_date_end.Value) && cb_select.SelectedIndex == 2)
                        {
                            GUI.Reservation.fDeposit frm = new fDeposit();
                            frm.Id_reservation = this.id_reservation;
                            this.Hide();
                            frm.ShowDialog();
                            this.Close();
                        }
                    }
                }
            }
        }
コード例 #2
0
 private void btn_chechout_Click(object sender, EventArgs e)
 {
     if (this.id_reservation != 0)
     {   //Thoi hien tai phai lon hon thoi gian cua phieu dat
         if (Reservation_BUS.Instance.GetInfoReservation(this.id_reservation).Status_reservation == 2)
         {
             if (DateTime.Compare(DateTime.Now, Calendar_BUS.Instance.GetCalendarReservationUsing(this.id_reservation).End_date) > 0)
             {
                 if (Reservation_BUS.Instance.CheckConfirmBillByReservation(id_reservation) == false)
                 {
                     int id_bill            = Bill_BUS.Instance.InsertBill(this.id_reservation, DTO.Session.username);
                     GUI.Bill.fCheckOut frm = new GUI.Bill.fCheckOut();
                     frm.Id_bill = id_bill;
                     this.Close();
                     frm.ShowDialog();
                     this.id_reservation = 0;
                 }
                 else
                 {
                     MessageBox.Show("Reservation has finshed paid!");
                     this.id_reservation = 0;
                 }
             }
             else
             {
                 MessageBox.Show("The reservation cannot check out! Please edit date end of the reservation");
                 this.id_reservation = 0;
             }
         }
         else
         {
             MessageBox.Show("The reservation cannot check out");
             this.id_reservation = 0;
         }
     }
     else
     {
         MessageBox.Show("You must select reservation");
         this.Id_reservation = 0;
     }
 }