Example #1
0
        public FrmAjoutChambre(BD5B6TP1_ConstantinBrassardLaheyDataSet.ChambreRow nouvelleChambre, BD5B6TP1_ConstantinBrassardLaheyDataSet.TypeChambreDataTable dataTable, bool modifMode = false)
        {
            InitializeComponent();
            this.nouvelleChambre = nouvelleChambre;

            controlesAValider = new Control[]
            {
                tbDecoration,
                tbEmplacement,
                cboTypeChambre
            };

            this.dataTable = dataTable;

            if (modifMode)
            {
                tbDecoration.Text            = nouvelleChambre.Decoration;
                tbEmplacement.Text           = nouvelleChambre.Emplacement;
                cboTypeChambre.SelectedValue = nouvelleChambre.NoTypeChambre;

                Text              = "Modification d'une chambre";
                lblEntete.Text    = "Modifer chambre";
                btnConfirmer.Text = "Confirmer modification";
            }
        }
        private void btnModifierChambre_Click(object sender, EventArgs e)
        {
            int noChambreSelec = (int)((DataRowView)chambreBindingSource.Current)["NoChambre"];

            BD5B6TP1_ConstantinBrassardLaheyDataSet.ChambreRow rowSelec =
                bD5B6TP1_ConstantinBrassardLaheyDataSet.Chambre.FindByNoChambre(noChambreSelec);

            FrmAjoutChambre frmAjout = new FrmAjoutChambre(rowSelec, bD5B6TP1_ConstantinBrassardLaheyDataSet.TypeChambre, true);

            DialogResult resultat = frmAjout.ShowDialog();

            if (resultat == DialogResult.Cancel)
            {
                rowSelec.CancelEdit();
            }
            else
            {
                BaseFormGestion.estSavegarder = true;
            }
        }