void SavePhone()
        {
            Telephone telephone = new Telephone();

            telephone.Id        = idPhone;
            telephone.Initial   = initial.Text;
            telephone.Numero    = contactTxt.Text;
            telephone.RefMembre = InstantRound.GetInstance().IdMembre;

            telephone.Enregistrer(telephone);
        }
        private void btnSave2_Click(object sender, EventArgs e)
        {
            try
            {
                ITelephone telephone = new Telephone();

                telephone.Id = Convert.ToInt32(txtIDTel.Text);
                telephone.Id_proprietaire = Convert.ToInt32(_id_personne);
                telephone.Initial         = txtInitial.Text;
                telephone.Numero          = txtNumero.Text;

                telephone.Enregistrer(telephone);

                MessageBox.Show("Record has been saved Successfuly !!!", "Saving datas", MessageBoxButtons.OK, MessageBoxIcon.Information);

                // Actualisation de la liste des Telephone de la
                // personne selectionnee

                dgvTelephone.DataSource = telephone.TelephonesPersonnes(Convert.ToInt32(_id_personne));
            }
            catch (InvalidOperationException ex)
            {
                MessageBox.Show("Error when saving datas, " + ex.Message, "Saving datas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                MessageBox.Show("Error when saving datas, " + ex.Message, "Saving datas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                MessageBox.Show("Error when saving datas, " + ex.Message, "Saving datas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            catch (Npgsql.NpgsqlException ex)
            {
                MessageBox.Show("Error when saving datas, " + ex.Message, "Saving datas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error when saving datas, " + ex.Message, "Saving datas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            finally
            {
                if (ImplementeConnexion.Instance.Conn != null)
                {
                    if (ImplementeConnexion.Instance.Conn.State == System.Data.ConnectionState.Open)
                    {
                        ImplementeConnexion.Instance.Conn.Close();
                    }
                }
            }
        }
        private void cmdSaveTelephone_Click(object sender, EventArgs e)
        {
            try
            {
                if (telephone != null)
                {
                    getAttributTelephone();
                    telephone.Enregistrer();
                    cmdSaveTelephone.Enabled = false;
                    MessageBox.Show("Enregistrement éffectué", "Enregistrement", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    try
                    {
                        dgvTelephone.DataSource = Factory.Instance.GetTelephones(telephone.Id_utilisateur);
                    }
                    catch (Exception) { }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Echec de l'enregistrement, " + ex.Message, "Enregistrement", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Example #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                ITelephone t = new Telephone();

                this.BindValuesTelephone(t);

                t.Enregistrer(t);

                MessageBox.Show("Mise à jour effectué", "Mise à jour personne", MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.RefreshDG();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Echec de mise à jour, " + ex.Message, "Mise à jour personne", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            finally
            {
                ImplementeConnexion.Instance.Conn.Close();
            }
        }