Ejemplo n.º 1
0
        private void btnEnregistrement_Click(object sender, EventArgs e)
        {
            var nouvelPartie = new PartiesJouee
            {
                IdAbonnement = cmbAbonne.SelectedValue.ToString(),
                NoTerrain    = Convert.ToInt32(cmbTerrain.SelectedValue),
                DatePartie   = Convert.ToDateTime(lblDatePartie.Text),
                Pointage     = Convert.ToInt32(nUDPointage.Value),
                Remarque     = remarqueTextBox.Text
            };


            try
            {
                dataContext.PartiesJouees.InsertOnSubmit(nouvelPartie);
                dataContext.SubmitChanges(ConflictMode.ContinueOnConflict);
                MessageBox.Show($"La partie jouée le {lblDatePartie.Text} par {cmbAbonne.SelectedValue.ToString()} a été enregistrée", "Enregistrement d'une partie jouée", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (ChangeConflictException)
            {
                dataContext.ChangeConflicts.ResolveAll(RefreshMode.KeepCurrentValues);
            }
            catch (Exception ex)
            {
                MessageBox.Show("L'enregistrement de la partie a échouée" + ex, "Enregistrement de l'abonné principal", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            nomCompletIDAbonneBindingSource.DataSource = infoIDetNom();
        }
Ejemplo n.º 2
0
        private void btnConfirmer_Click(object sender, EventArgs e)
        {
            int             selectedrowindex = idEtNomCompletAboDataGridView.SelectedCells[0].RowIndex;
            DataGridViewRow selectedRow      = idEtNomCompletAboDataGridView.Rows[selectedrowindex];
            string          id = Convert.ToString(selectedRow.Cells["dataGridViewTbId"].Value);

            Terrain terrain = this.lstTerrains.SelectedItem as Terrain;

            DateTime     date   = DateTime.Now;
            PartiesJouee partie = new PartiesJouee
            {
                IdAbbonement = id,
                NoTerrain    = terrain.No,
                DatePartie   = date,
                Pointage     = Convert.ToInt32(numPoint.Value),
                Remarque     = tbPartie.Text == "" ? null : tbPartie.Text
            };

            monDatatContext.PartiesJouees.InsertOnSubmit(partie);
            if (Enregistrer())
            {
                new FrmInformationPartie(partie).ShowDialog();
            }
        }
Ejemplo n.º 3
0
        public FrmInformationPartie(PartiesJouee partie)
        {
            this.partie = partie;

            InitializeComponent();
        }