Esempio n. 1
0
        public List <Deposant> GetDeposantList()
        {
            var deposantList = new List <Deposant>();

            using (SqlCommand maCommande = m_Sqlconnection.CreateCommand())
            {
                maCommande.CommandText = "SELECT Id, Nom, Prenom, Telephone FROM Deposant order by Nom";
                using (SqlDataReader dataReader = maCommande.ExecuteReader())
                {
                    while (dataReader.Read())
                    {
                        Deposant newDeposant = new Deposant
                        {
                            Id        = dataReader.GetInt32(0),
                            Nom       = dataReader.GetString(1),
                            Prenom    = dataReader.GetString(2),
                            telephone = dataReader.GetString(3)
                        };
                        deposantList.Add(newDeposant);
                    }
                    dataReader.Close();
                }
            }
            return(deposantList);
        }
        internal void DeleteDeposant(int deposantId)
        {
            Deposant deposant = new Deposant {
                Id = deposantId
            };

            m_context.Deposants.Attach(deposant);
            m_context.Deposants.Remove(deposant);
            m_context.SaveChanges();
        }
Esempio n. 3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (currentDeposant == null)
     {
         currentDeposant = new Deposant();
     }
     currentDeposant.Nom       = txtNom.Text;
     currentDeposant.Prenom    = txtPrenom.Text;
     currentDeposant.telephone = txtTelephone.Text;
     this.DialogResult         = System.Windows.Forms.DialogResult.OK;
 }
        internal void UpdateDeposant(int id, string nom, string prenom, string telephone)
        {
            Deposant deposant = new Deposant {
                Id = id
            };

            m_context.Deposants.Attach(deposant);
            deposant.Nom       = nom;
            deposant.Prenom    = prenom;
            deposant.telephone = telephone;
            m_context.SaveChanges();
        }
Esempio n. 5
0
 public AddDeposant(Deposant deposant)
 {
     InitializeComponent();
     edit            = true;
     this.Text       = "Modifier les données du déposant";
     currentDeposant = deposant;
     if (currentDeposant != null)
     {
         txtNom.Text       = currentDeposant.Nom;
         txtPrenom.Text    = currentDeposant.Prenom;
         txtTelephone.Text = currentDeposant.telephone;
     }
 }
Esempio n. 6
0
        private string GetSumArticle(List <Article> saleArticle, Deposant deposant)
        {
            string sumArticle = "Montant dû: ";
            float  somme      = 0;

            foreach (var article in saleArticle)
            {
                sumArticle += article.PrixRevientClient + "+";
                somme      += article.PrixRevientClient;
            }
            string sumArticle1 = sumArticle.Substring(0, sumArticle.Length - 1);

            somme       = somme - (float)2.5;
            sumArticle1 = sumArticle1 + "-2.5";
            sumArticle1 = sumArticle1 + "=" + somme + "\r\n";
            return(sumArticle1);
        }
Esempio n. 7
0
 private void cbDeposant_SelectedIndexChanged(object sender, EventArgs e)
 {
     currentDeposant = (Deposant)cbDeposant.SelectedItem;
     refreshDeposantInformation();
     InitArticleDataGrid();
 }
Esempio n. 8
0
        private string BuildResultDeposantString(List <Article> unsoldedArticle, List <Article> saleArticle, Deposant deposant)
        {
            string result = "Nom du déposant: " + deposant.Nom + "\r\n";

            result += GetSumArticle(saleArticle, deposant);
            result += GetUnsoldedArticle(unsoldedArticle);
            return(result);
        }
Esempio n. 9
0
 private void InitDeposantList()
 {
     currentDeposant          = new Deposant();
     cbDeposant.DataSource    = m_databaseInterface.GetDeposantList();
     cbDeposant.DisplayMember = "Nom";
 }