public static T_TauxKilo GetTauxKiloById(int id) { CoEco_BDDataContext bd = new CoEco_BDDataContext(); T_TauxKilo tauxKilo = bd.T_TauxKilo.Single(o => o.idTaux == id); bd.Dispose(); return(tauxKilo); }
/// <summary> /// Ajoute un nouveau taux /// </summary> /// <param name="newTaux">nouveau taux</param> /// <param name="type">1 = Auto, 2 = Camion</param> public static void AddTauxKilo(float newTaux, int type) { T_TauxKilo tauxKilo = new T_TauxKilo(); tauxKilo.taux = newTaux; tauxKilo.ddate = DateTime.Today; tauxKilo.idTypeAuto = type; CoEco_BDDataContext bd = new CoEco_BDDataContext(); bd.T_TauxKilo.InsertOnSubmit(tauxKilo); bd.SubmitChanges(); bd.Dispose(); }