private void _ButtonClientsSupprimer_Click(object sender, RoutedEventArgs e) { if (this._dataGridClient.SelectedItem != null) { if (this._dataGridClient.SelectedItems.Count ==1) { Reservation_SalleContact_Client_Invite tmp = new Reservation_SalleContact_Client_Invite(); tmp = (Reservation_SalleContact_Client_Invite)this._dataGridClient.SelectedItem; ((Reservation_Salle)this.DataContext).Reservation_SalleContact_Client_Invite.Remove(tmp); } } Verif_NbParticipant(); }
/// <summary> /// duplique la commande passée en paramètre /// </summary> /// <param name="commande1">commande à dupliquer</param> private Reservation_Salle duplicateReservationSalle(Reservation_Salle itemToCopy) { Reservation_Salle tmp = new Reservation_Salle(); tmp.Date_Reservation = itemToCopy.Date_Reservation; tmp.Date_Reservation_Fin = itemToCopy.Date_Reservation_Fin; tmp.Heure_Debut = itemToCopy.Heure_Debut; tmp.Heure_Fin = itemToCopy.Heure_Fin; tmp.Nb_Participants = itemToCopy.Nb_Participants; tmp.ObjetReunion = itemToCopy.ObjetReunion; tmp.Commentaire = itemToCopy.Commentaire; tmp.Entreprise_Mere1 = itemToCopy.Entreprise_Mere1; tmp.Salle1 = itemToCopy.Salle1; foreach (Reservation_SalleBesoin_Reservation_Salle item in itemToCopy.Reservation_SalleBesoin_Reservation_Salle) { Reservation_SalleBesoin_Reservation_Salle toAdd = new Reservation_SalleBesoin_Reservation_Salle(); toAdd.Quantite = item.Quantite; toAdd.Besoin_Reservation_Salle1 = item.Besoin_Reservation_Salle1; tmp.Reservation_SalleBesoin_Reservation_Salle.Add(toAdd); } foreach (Reservation_SalleContact_Client_Invite item in itemToCopy.Reservation_SalleContact_Client_Invite) { Reservation_SalleContact_Client_Invite toAdd = new Reservation_SalleContact_Client_Invite(); toAdd.Contact1 = item.Contact1; tmp.Reservation_SalleContact_Client_Invite.Add(toAdd); } foreach (Reservation_SalleContact_Fournisseur_Invite item in itemToCopy.Reservation_SalleContact_Fournisseur_Invite) { Reservation_SalleContact_Fournisseur_Invite toAdd = new Reservation_SalleContact_Fournisseur_Invite(); toAdd.Contact1 = item.Contact1; tmp.Reservation_SalleContact_Fournisseur_Invite.Add(toAdd); } foreach (Reservation_SalleSalarie_Invite item in itemToCopy.Reservation_SalleSalarie_Invite) { Reservation_SalleSalarie_Invite toAdd = new Reservation_SalleSalarie_Invite(); toAdd.Salarie1 = item.Salarie1; tmp.Reservation_SalleSalarie_Invite.Add(toAdd); } tmp.Salarie1 = ((App)App.Current)._connectedUser.Salarie_Interne1.Salarie; return tmp; }
private void _ButtonClientsAjouter_Click(object sender, RoutedEventArgs e) { //Initialisation de la fenêtre ReservationSalleSelectionClientWindow reservationSalleSelectionClientWindow = new ReservationSalleSelectionClientWindow(); //booléen nullable vrai ou faux ou null bool? dialogResult = reservationSalleSelectionClientWindow.ShowDialog(); if (dialogResult.HasValue && dialogResult.Value == true) { bool verif = true; Reservation_SalleContact_Client_Invite tmp = new Reservation_SalleContact_Client_Invite(); tmp.Contact1 = (Contact)reservationSalleSelectionClientWindow._comboBoxContact.SelectedItem; foreach (Reservation_SalleContact_Client_Invite item in this._dataGridClient.Items) { if (tmp.Contact1.Personne.Identifiant == item.Contact1.Personne.Identifiant && tmp.Contact1.Personne.Identifiant != 0) { verif = false; } } if (verif == true) { tmp.Reservation_Salle1 = ((Reservation_Salle)this.DataContext); } else { MessageBox.Show(tmp.Contact1.Personne.Nom + " " + tmp.Contact1.Personne.Prenom + " est déjà invité(e)"); } } else { } this._dataGridClient.Items.Refresh(); Verif_NbParticipant(); }