コード例 #1
0
        private void btnAjouterChambre_Click(object sender, EventArgs e)
        {
            var         nouvelleChambre         = bD5B6TP1_ConstantinBrassardLaheyDataSet.Chambre.NewChambreRow();
            DataRowView typeChambreSelectionnee = (DataRowView)typeChambreBindingSource.Current;

            nouvelleChambre.NoChambre     = TrouverNoChambre();
            nouvelleChambre.NoTypeChambre = (int)typeChambreSelectionnee["NoTypeChambre"];

            FrmAjoutChambre frmAjout = new FrmAjoutChambre(nouvelleChambre, bD5B6TP1_ConstantinBrassardLaheyDataSet.TypeChambre);

            DialogResult resultat = frmAjout.ShowDialog();

            if (resultat == DialogResult.Cancel)
            {
                return;
            }

            int indexTypeNouvelleChambre =
                typeChambreBindingSource.Find("NoTypeChambre", nouvelleChambre.NoTypeChambre);

            typeChambreBindingSource.Position = indexTypeNouvelleChambre;

            bD5B6TP1_ConstantinBrassardLaheyDataSet.Chambre.AddChambreRow(nouvelleChambre);
            chambreBindingSource.MoveLast();
            BaseFormGestion.estSavegarder = false;
        }
コード例 #2
0
        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;
            }
        }