public Boolean AddReservation(reservation reservationToAdd)
        {
            bool isAdded = false;

            try
            {
                reservationEntitie.reservations.Add(reservationToAdd);
                reservationEntitie.SaveChanges();
                MessageBox.Show("reservation added");
                isAdded = true;
            }
            catch
            {

                MessageBox.Show("erreur !!!!");

            }
            return isAdded;
        }
Exemplo n.º 2
0
        // Méthodes
        /// <summary>
        /// Création d'un nouveau client à l'aide des informations inscrites dans les champs
        /// </summary>        
        private void btnClientCreate_add_Click(object sender, EventArgs e)
        {
            reservation reservationToCreate = new reservation();

            reservationToCreate.clientID = int.Parse(txtClientCreate_clientId.Text);
            reservationToCreate.employeID = 2;
            reservationToCreate.succursaleID = ((KeyValuePair<int, string>) cbReservationCreate_Succursale.SelectedItem).Key;
            reservationToCreate.vehiculeID = ((KeyValuePair<int, string>)cbReservationCreate_noPlaque.SelectedItem).Key;

            DateTime reservationOUT = dateTimePicker_ReservationCreate_DateOUT.Value.Date.Add(TimeSpan.Parse("08:00:00"));
            DateTime reservationIN = dateTimePicker_ReservationCreate_DateIN.Value.Date.Add(TimeSpan.Parse("10:00:00"));

            reservationToCreate.date_debut_reservation = reservationOUT;
            reservationToCreate.date_fin_reservation = reservationIN;

            reservationToCreate.date_appel_reservation = DateTime.Now;

            reservationServices.AddReservation(reservationToCreate);
        }