public static List<CategorieClient> getListCategorieClient(String query) { NpgsqlConnection con = Connexion.Connection(); try { List<CategorieClient> l = new List<CategorieClient>(); NpgsqlCommand Lcmd = new NpgsqlCommand(query, con); NpgsqlDataReader lect = Lcmd.ExecuteReader(); if (lect.HasRows) { while (lect.Read()) { CategorieClient a = new CategorieClient(); a.Id = Convert.ToInt64(lect["id"].ToString()); a.Code = lect["code"].ToString(); a.Designation = lect["libelle"].ToString(); a.Remises = BLL.PlanRemiseBll.Liste("select * from yvs_com_plan_remise where actif = true and categorie =" + a.Id + " and '" + DateTime.Now + "' between date_debut and date_fin "); a.Update = true; l.Add(a); } lect.Close(); } return l; } catch (NpgsqlException e) { Messages.Exception(e); return null; } finally { Connexion.Deconnection(con); } }
public static CategorieClient getAjoutCategorieClient(CategorieClient a) { NpgsqlConnection con = Connexion.Connection(); try { string insert = ""; NpgsqlCommand cmd = new NpgsqlCommand(insert, con); cmd.ExecuteNonQuery(); a.Id = getCurrent(); return a; } catch { return null; } finally { Connexion.Deconnection(con); } }
public static void TotalRemiseContenuDoc(Contenu c, CategorieClient ca) { if ((ca != null) ? c != null : false) { ArticleCom a = c.Article; if (a != null) { //Gestion Remise Sur l'article par le plan tarifaire Article a_ = a.Article; if ((a_ != null) ? ((a_.Plans != null) ? a_.Plans.Count > 0 : false) : false) { PlanTarifaire p = a_.Plans[0]; c.Prix = p.Puv; c.RemiseArt = MontantRemise(p.Remise_, c.Quantite, c.PrixTotal); } //Gestion Remise Sur l'article par le plan de remise foreach (PlanRemise p in ca.Remises) { if (p.Article.Equals(a)) { c.RemiseCat = MontantRemise(p.Remise, c.Quantite, c.PrixTotal); break; } } } } }
public static CategorieClient getOneCategorieClient(long id) { NpgsqlConnection con = Connexion.Connection(); try { String search = "select * from yvs_com_categorie_client where id = " + id + ""; NpgsqlCommand Lcmd = new NpgsqlCommand(search, con); NpgsqlDataReader lect = Lcmd.ExecuteReader(); CategorieClient a = new CategorieClient(); if (lect.HasRows) { while (lect.Read()) { a.Id = Convert.ToInt64(lect["id"].ToString()); a.Code = lect["code"].ToString(); a.Designation = lect["libelle"].ToString(); a.Remises = BLL.PlanRemiseBll.Liste("select * from yvs_com_plan_remise where actif = true and categorie =" + a.Id + " and '" + DateTime.Now + "' between date_debut and date_fin "); a.Update = true; } lect.Close(); } return a; } catch (NpgsqlException e) { Messages.Exception(e); return null; } finally { Connexion.Deconnection(con); } }
public static bool getUpdateCategorieClient(CategorieClient a) { NpgsqlConnection con = Connexion.Connection(); try { string update = ""; NpgsqlCommand Ucmd = new NpgsqlCommand(update, con); Ucmd.ExecuteNonQuery(); return true; } catch (Exception e) { Messages.Exception(e); return false; } finally { Connexion.Deconnection(con); } }
public CategorieClientBll(CategorieClient unCategorieClient) { categorie = unCategorieClient; }