public int getCommandbyId(DAL.Commande dl, string id) { OleDbConnection ocn = new OleDbConnection(); ocn = BAL.Global.seConnecter(BAL.Global.cs); Object o1 = BAL.Global.ExecuterOleDBScalaire(@"select NumClient from Commande where NumCmd=" + id, ocn); int i = Int32.Parse(o1.ToString()); BAL.Global.seDeconnecter(ocn); return(i); }
public int AjouterCommande(DAL.Commande dal) { int res; OleDbConnection cn = new OleDbConnection(); cn = Global.seConnecter(Global.cs); object[,] tabPMNames = { { "@NumCmd", dal.NumCmd }, { "@DateCmd", dal.DateCmd }, { "@NumClient", dal.NumClient } }; res = Global.ExecuteroleDbActionNomsParams(@"insert into Commande (NumCmd,DateCmd,NumClient) values (@NumCmd,@DateCmd,@NumClient)", cn, tabPMNames); Global.seDeconnecter(cn); return(res); }
public List <Commande> ListComNum(int NumClient) { SqlConnection connect = new SqlConnection("server=.; database = FIL_ROUGE; Integrated Security = true"); connect.Open(); List <Commande> resultat = new List <Commande>(); SqlCommand CmdSearch = new SqlCommand("select * from commercial.Commande join commercial.Clients on commercial.Commande.ID_Client = commercial.Clients.ID_Client where commercial.Clients.ID_Client = @Numero_client", connect); CmdSearch.Parameters.AddWithValue("@Numero_client", NumClient); SqlDataReader lecture = CmdSearch.ExecuteReader(); while (lecture.Read()) { Commande com = new Commande(); com.Numero_Commande = Convert.ToInt32(lecture["ID_Commande"]); com.Date_de_Commande = Convert.ToDateTime(lecture["Date_Reglement"]); com.Total_HT = Convert.ToDecimal(lecture["Montant_HT"]); com.Numero_Client = Convert.ToInt32(lecture["ID_Client"]); resultat.Add(com); } connect.Close(); return(resultat); }