public IndoFacture() { InitializeComponent(); Save = true; TB_Facture newfacture = new TB_Facture(); TextCodeFacture.Value = newfacture.GenerateCode(); DateRecuFacture.Value = DateTime.Now; DateLivraisonFacutre.Value = DateTime.Now.AddDays(1); }
public IndoFacture(string Code) { InitializeComponent(); Save = false; currentFacture = new TB_Facture(); currentFacture.FindByKey(Code); TextCodeFacture.Value = currentFacture.Code; TextAdresseClient.Value = currentFacture.Client.Adresse; TextTelClient.Value = currentFacture.Client.NTel; TextNomClient.Value = currentFacture.Client.Nom; TextPrenomClient.Value = currentFacture.Client.Prenom; NumericPrixAvance.Value = currentFacture.Prix_Partiel; NumericPrixTotal.Value = currentFacture.Prix_Total; DateRecuFacture.Value = currentFacture.Date_Recu; DateLivraisonFacutre.Value = currentFacture.Date_livraison; comboModePayement.Text = currentFacture.Mode_Payement; DB_PostgreSQL dataBase = new DB_PostgreSQL(); DataSet ARFAC = dataBase.returnDataSet("SELECT \"Code_Article\",\"Libelle\",\"Quantite\",\"Operation\",\"Prix\" FROM \"Articles\",\"Ar_Fac\" WHERE \"Ar_Fac\".\"Code_Facture\"='" + Code + "' AND" + "\"Articles\".\"Code\"=\"Ar_Fac\".\"Code_Article\""); c1TrueDBGrid1.DataSource = ARFAC.Tables[0]; DataSet Client = dataBase.returnDataSet("SELECT * FROM \"Client\""); c1Combo1.DataSource = Client.Tables[0]; c1Combo1.Text = currentFacture.Client.Code; c1Combo1.DisplayMember = "Code"; c1Label1.Value = currentFacture.Etat; c1Label2.Value = currentFacture.Livree; if (currentFacture.Livree == "Non Livree") { dateSortie.Visible = false; } else { dateSortie.Value = currentFacture.Date_livraison; } Npgsql.NpgsqlDataReader reader = dataBase.returnDataReader("SELECT * FROM \"Cheque\" WHERE \"Code_Facture\"='" + Code + "'"); if (reader.Read()) { comboBox1.Text = (string)reader["Banque"]; c1TextBox1.Value = (string)reader["Montant"]; c1TextBox2.Value = (string)reader["Num"]; c1DateEdit1.Value = (DateTime)reader["Date"]; } }
public static List <TB_Facture> GetList() { List <TB_Facture> list = new List <TB_Facture>(); DB_PostgreSQL dataBase = new DB_PostgreSQL(); Npgsql.NpgsqlDataReader reader = dataBase.returnDataReader("SELECT * FROM \"Facture\""); while (reader.Read()) { TB_Facture f = new TB_Facture(); f.Code = (string)reader["Code"]; f.Date_Recu = (DateTime)reader["Date_Recu"]; f.Date_livraison = (DateTime)reader["Date_Livraison"]; f.Prix_Total = (double)reader["Prix_Total"]; f.Prix_Partiel = (double)reader["Prix_Partiel"]; f.Client = new TB_Client((string)reader["Code_Client"]); f.Mode_Payement = (string)reader["Mode_Payement"]; f.Livree = (string)reader["Livree"]; f.Date_Payement = /*reader["Date_Payement"] is DBNull ? :*/ (DateTime)reader["Date_Payement"]; f.Date_Sortie = /*reader["Date_Sortie"] is DBNull ? null : */ (DateTime)reader["Date_Sortie"]; list.Add(f); } return(list); }