Exemple #1
0
 // Decide what to do when the selected conditions are applied...
 private void BtnEndReservation_Click(object sender, EventArgs e)
 {
     if (CmbBookStatus.SelectedIndex == -1 || (RbtnGiveChance.Checked && NumLimitToReturn.Value == 0) || (RbtnSetPayment.Checked && NumPenalty.Value == 0) || string.IsNullOrEmpty(TxtComment.Text))
     {
         MessageBox.Show("Boş sahə buraxmayın!");
         return;
     }
     Reservation.Penalty     = NumPenalty.Value;
     Reservation.BookStatus  = Convert.ToInt32(CmbBookStatus.SelectedItem.ToString().Split('-')[0]);
     Reservation.Comment     = TxtComment.Text;
     Reservation.TakenBackBy = User.Id;
     if (NumLimitToReturn.Value != 0)
     {
         Reservation.LimitToReturn = Convert.ToInt32(NumLimitToReturn.Value);
     }
     else
     {
         Reservation.TakenBackAt = DateTime.Now;
     }
     db.SaveChanges();
     MessageBox.Show("Kitab qaytarıldı...");
     if (Reservations != null)
     {
         Reservations.DgvReservations.Rows[Reservations.ClickedRow].Cells[8].Value  = User.Name + " " + User.Surname;
         Reservations.DgvReservations.Rows[Reservations.ClickedRow].Cells[9].Value  = Reservation.TakenBackAt?.ToString("dd.MM.yyyy");
         Reservations.DgvReservations.Rows[Reservations.ClickedRow].Cells[10].Value = Reservation.Penalty?.ToString("0.00") + " AZN";
         Reservations.DgvReservations.Rows[Reservations.ClickedRow].Cells[11].Value = Reservation.Case.Status;
     }
     if (MainBoard != null)
     {
         MainBoard.CreateLateBooksPanels();
     }
     this.Close();
 }
 // Declare this form to be closed (see more in MainBoard.cs)
 private void Clients_FormClosed(object sender, FormClosedEventArgs e)
 {
     Board.ClientIsOpen = false;
     Board.CreateLateBooksPanels();
 }
 // Set Reservations form as closed in the Main Board...
 private void Reservations_FormClosed(object sender, FormClosedEventArgs e)
 {
     MainBoard.ReservationsIsOpen = false;
     MainBoard.CreateLateBooksPanels();
 }