public static bool getUpdateEntete(Entete 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 static Entete getAjoutEntete(Entete a) { NpgsqlConnection con = Connexion.Connection(); try { string insert = "insert into yvs_com_entete_doc_vente" + "(creneau, date_entete, etat)" + "values (" + Constantes.Creneau.Id + ", " + DateTime.Now + ", " + Constantes.ETAT_EN_ATTENTE + ")"; NpgsqlCommand cmd = new NpgsqlCommand(insert, con); cmd.ExecuteNonQuery(); a.Id = getCurrent(); return(a); } catch { return(null); } finally { Connexion.Deconnection(con); } }
public static Entete getOneEntete(Creneau creneau, DateTime date) { NpgsqlConnection con = Connexion.Connection(); try { String search = "select * from yvs_com_entete_doc_vente where date_entete = '" + date + "' and creneau = " + creneau.Id; NpgsqlCommand Lcmd = new NpgsqlCommand(search, con); NpgsqlDataReader lect = Lcmd.ExecuteReader(); Entete a = new Entete(); if (lect.HasRows) { while (lect.Read()) { a.Id = Convert.ToInt64(lect["id"].ToString()); a.Etat = lect["etat"].ToString(); a.DateEntete = Convert.ToDateTime((lect["date_entete"] != null) ? (!lect["date_entete"].ToString().Trim().Equals("") ? lect["date_entete"].ToString().Trim() : "00/00/0000") : "00/00/0000"); a.Creneau = (lect["creneau"] != null ? (!lect["creneau"].ToString().Trim().Equals("") ? BLL.CreneauBll.One(Convert.ToInt64(lect["creneau"].ToString())) : new Creneau()) : new Creneau()); a.FacturesRegle = BLL.FactureBll.Liste("select * from yvs_com_doc_ventes where entete_doc = " + a.Id + " and type_doc = '" + Constantes.TYPE_FV + "' and statut = '" + Constantes.ETAT_REGLE + "'"); foreach (Facture f in a.FacturesRegle) { a.Montant += f.MontantTTC; } a.FacturesEnAttente = BLL.FactureBll.Liste("select * from yvs_com_doc_ventes where entete_doc = " + a.Id + " and type_doc = '" + Constantes.TYPE_FV + "' and statut = '" + Constantes.ETAT_EN_ATTENTE + "'"); foreach (Facture f in a.FacturesEnAttente) { a.Montant += f.MontantTTC; } a.FacturesEnCours = BLL.FactureBll.Liste("select * from yvs_com_doc_ventes where entete_doc = " + a.Id + " and type_doc = '" + Constantes.TYPE_FV + "' and statut = '" + Constantes.ETAT_EN_COURS + "'"); foreach (Facture f in a.FacturesEnCours) { a.Montant += f.MontantTTC; } a.Commandes = BLL.FactureBll.Liste("select * from yvs_com_doc_ventes where entete_doc = " + a.Id + " and type_doc = '" + Constantes.TYPE_BCV + "' and statut = '" + Constantes.ETAT_VALIDE + "'"); foreach (Facture f in a.Commandes) { a.Montant += f.MontantAvance; } a.Update = true; } lect.Close(); } return(a); } catch (NpgsqlException e) { Messages.Exception(e); return(null); } finally { Connexion.Deconnection(con); } }
public EnteteBll(Entete unEntete) { entete = unEntete; }
public string GetEntete() { return(Entete.ToUpper().PadRight(NombreCaracteres)); }