private bool InviteEstSupprimable(DataRowView selection) { bool peutEtreSupprime = true; string texteTooltip = "L'invité sélectionné ne peut pas être supprimé car:"; ttpSupprimer.SetToolTip(btnSupprimerInvite, ""); int noClientSelectionne = (int)selection["NoClient"]; PlanifSoinTableAdapter planifSoinTableAdapter = new PlanifSoinTableAdapter(); planifSoinTableAdapter.Fill(bD5B6TP1_ConstantinBrassardLaheyDataSet.PlanifSoin); BD5B6TP1_ConstantinBrassardLaheyDataSet.PlanifSoinDataTable planifSoinTable = bD5B6TP1_ConstantinBrassardLaheyDataSet.PlanifSoin; if (planifSoinTable.Any(reservation => reservation.NoPersonne == noClientSelectionne)) { texteTooltip += "\n\t- Il a au moins un soin de planifié"; peutEtreSupprime = false; } if (!peutEtreSupprime) { ttpSupprimer.Show(texteTooltip, btnSupprimerInvite, 3000); } return(peutEtreSupprime); }
private bool ClientEstSupprimable(DataRowView selection) { bool peutEtreSupprime = true; string texteTooltip = "Le client sélectionné ne peut pas être supprimé car:"; ttpSupprimer.SetToolTip(btnSupprimerCli, ""); int noClientSelectionne = (int)selection["NoClient"]; if (bD5B6TP1_ConstantinBrassardLaheyDataSet.Invite.Any(invite => invite.NoClient == noClientSelectionne)) { texteTooltip += "\n\t- Il a des invités associés"; peutEtreSupprime = false; } ReservationChambreTableAdapter reservationTableAdapter = new ReservationChambreTableAdapter(); reservationTableAdapter.Fill(bD5B6TP1_ConstantinBrassardLaheyDataSet.ReservationChambre); BD5B6TP1_ConstantinBrassardLaheyDataSet.ReservationChambreDataTable reservationTable = bD5B6TP1_ConstantinBrassardLaheyDataSet.ReservationChambre; if (reservationTable.Any(reservation => reservation.NoClient == noClientSelectionne)) { texteTooltip += "\n\t- Il a réservé au moins une chambre"; peutEtreSupprime = false; } PlanifSoinTableAdapter planifSoinTableAdapter = new PlanifSoinTableAdapter(); planifSoinTableAdapter.Fill(bD5B6TP1_ConstantinBrassardLaheyDataSet.PlanifSoin); BD5B6TP1_ConstantinBrassardLaheyDataSet.PlanifSoinDataTable planifSoinTable = bD5B6TP1_ConstantinBrassardLaheyDataSet.PlanifSoin; if (planifSoinTable.Any(reservation => reservation.NoPersonne == noClientSelectionne)) { texteTooltip += "\n\t- Il a au moins un soin de planifié"; peutEtreSupprime = false; } if (!peutEtreSupprime) { ttpSupprimer.Show(texteTooltip, btnSupprimerCli, 3000); } return(peutEtreSupprime); }
private bool EstSupprimable(DataRowView selection) { if (soinBindingSource.Current == null) { return(false); } BD5B6TP1_ConstantinBrassardLaheyDataSet.AssistantSoinDataTable assistantSoinTable = bD5B6TP1_ConstantinBrassardLaheyDataSet.AssistantSoin; int idSoinSelectionne = (int)((DataRowView)soinBindingSource.Current)["NoSoin"]; AssistantSoinTableAdapter assistantSoinTableAdapter = new AssistantSoinTableAdapter(); assistantSoinTableAdapter.Fill(bD5B6TP1_ConstantinBrassardLaheyDataSet.AssistantSoin); bool peutEtreSupprime = true; string texteTooltip = "Le soin sélectionné ne peut pas être supprimé car:"; ttpSupprimer.SetToolTip(btnSupprimer, ""); if (assistantSoinTable.Any(assistantSoin => assistantSoin.NoSoin == idSoinSelectionne)) { texteTooltip += "\n\t- Il est assigné à un assistant"; peutEtreSupprime = false; } BD5B6TP1_ConstantinBrassardLaheyDataSet.PlanifSoinDataTable planifSoinTable = bD5B6TP1_ConstantinBrassardLaheyDataSet.PlanifSoin; PlanifSoinTableAdapter planifSoinTableAdapter = new PlanifSoinTableAdapter(); planifSoinTableAdapter.Fill(bD5B6TP1_ConstantinBrassardLaheyDataSet.PlanifSoin); if (planifSoinTable.Any(planifSoin => planifSoin.NoSoin == idSoinSelectionne)) { texteTooltip += "\n\t- Un soin de ce type est planifié"; peutEtreSupprime = false; } if (!peutEtreSupprime) { ttpSupprimer.Show(texteTooltip, btnSupprimer, 3000); } return(peutEtreSupprime); }
public FrmPlanifierSoin(BD5B6TP1_ConstantinBrassardLaheyDataSet.PlanifSoinRow planifSoin, BD5B6TP1_ConstantinBrassardLaheyDataSet.PlanifSoinDataTable dataTable, bool modifMode = false) { InitializeComponent(); this.planifSoin = planifSoin; this.assistantSoinTableAdapter = new AssistantSoinTableAdapter(); this.modifMode = modifMode; controlesAValider = new Control[] { dtpDateHeure, cboAssistant, cboPatient, cboSoin, }; if (modifMode) { ancienneDateHeure = this.planifSoin.DateHeure; ancienNoPersonne = this.planifSoin.NoPersonne; ancienNoAssistant = this.planifSoin.NoAssistant; } foreach (DataRow planifSoinRow in dataTable) { bD5B6TP1_ConstantinBrassardLaheyDataSet.PlanifSoin.ImportRow(planifSoinRow); } }