Exemple #1
0
 //overloaded constructor. in this case the admin add a report
 public AdminReportEdit(string Email, string PassHash, int BookingID)
 {
     InitializeComponent();
     this.Email           = Email;
     this.PassHash        = PassHash;
     this.ReportedBooking = new Report.Booking();
     this.newReport       = true;
     subjectTextbox.Text  = "";
     messageTextBox.Text  = "";
     DeleteButton.Visible = false;
     try
     {
         BookingManagerClient bookingManager = new BookingManagerClient();
         this.reportManager = new ReportManagerClient();
         Booking.Booking FetchedBooking = bookingManager.GetBookingByID(BookingID, this.Email, this.PassHash);
         ReportedBooking.ID                    = FetchedBooking.ID;
         ReportedBooking.BookedCar             = new Report.Car();
         ReportedBooking.BookedCar.PlateNumber = FetchedBooking.BookedCar.PlateNumber;
         ReportedBooking.Booker                = new Report.User();
         ReportedBooking.Booker.Email          = FetchedBooking.Booker.Email;
         ReportedBooking.End                   = FetchedBooking.End;
         ReportedBooking.Start                 = FetchedBooking.Start;
     }catch (Exception exc)
     {
         MessageBox.Show("Errore nella connessione al server.", "Proprio non riesco.", MessageBoxButtons.OK);
     }
 }
Exemple #2
0
 //on Click function. this show a new child form which allow the admin to modify the user of the booking
 private void EditUser(object sender, EventArgs e)
 {
     try
     {
         UserManagerClient userManager  = new UserManagerClient();
         var           selectedUser     = bookingManager.GetBookingByID(Convert.ToInt32(bookingsListView.SelectedItems[0].Text), this.Email, this.PassHash).Booker;
         AdminUserEdit bookingFormChild = new AdminUserEdit(userManager.GetUserByEmail(selectedUser.Email, this.Email, this.PassHash), this.Email, this.PassHash);
         bookingFormChild.MdiParent       = this.ParentForm;
         bookingFormChild.FormBorderStyle = FormBorderStyle.None;
         bookingFormChild.Dock            = DockStyle.Fill;
         bookingFormChild.Show();
     }
     catch (Exception exc)
     {
         MessageBox.Show("Errore nella connessione al server.", "Proprio non riesco a mostrare l'utente della prenotazione.", MessageBoxButtons.OK);
     }
 }
Exemple #3
0
 // on Click function. control all insert data, then close the book sending all data to the server
 private void returnBooking(object sender, EventArgs e)
 {
     if (bookingBox.SelectedIndex == -1 || Convert.ToInt32(litersUpDown.Value) == 0 || Convert.ToInt32(kilometersUpDown.Value) == 0)
     {
         MessageBox.Show("Inserisci tutti i dati.", "Controlla bene i dati inseriti.", MessageBoxButtons.OK);
     }
     else
     {
         var SelectedBooking = bookingBox.SelectedItem.ToString();
         SelectedBooking = SelectedBooking.Substring(0, SelectedBooking.IndexOf(" "));
         try
         {
             this.bookingManager.EndBooking(bookingManager.GetBookingByID(Convert.ToInt32(SelectedBooking), this.Email, this.PassHash), Convert.ToInt32(kilometersUpDown.Value), Convert.ToInt32(litersUpDown.Value), this.Email, this.PassHash);
             MessageBox.Show("Auto restituita!", "Puoi dormire sonni tranquilli.", MessageBoxButtons.OK);
             this.StopEditing();
         }
         catch (Exception exc)
         {
             MessageBox.Show("Errore nella connessione al server.", "Proprio non riesco a confermare la richiesta.", MessageBoxButtons.OK);
         }
     }
 }