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(); }
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(); }
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; } }
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); }
private void cbDeposant_SelectedIndexChanged(object sender, EventArgs e) { currentDeposant = (Deposant)cbDeposant.SelectedItem; refreshDeposantInformation(); InitArticleDataGrid(); }
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); }
private void InitDeposantList() { currentDeposant = new Deposant(); cbDeposant.DataSource = m_databaseInterface.GetDeposantList(); cbDeposant.DisplayMember = "Nom"; }