Example #1
0
 public static Tiers getAjoutTiers(Tiers 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);
     }
 }
Example #2
0
 public static List<Tiers> getListTiers(String query)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         List<Tiers> l = new List<Tiers>();
         NpgsqlCommand Lcmd = new NpgsqlCommand(query, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 Tiers a = new Tiers();
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Adresse = lect["adresse"].ToString();
                 a.Civilite = lect["civilite"].ToString();
                 a.CodeTiers = lect["code_tiers"].ToString();
                 a.Logo = lect["logo"].ToString();
                 a.Nom = lect["nom"].ToString();
                 a.Prenom = lect["prenom"].ToString();
                 a.Tel = lect["tel"].ToString();
                 a.Nom_prenom = a.Prenom + " " + a.Nom;
                 a.Update = true;
                 l.Add(a);
             }
             lect.Close();
         }
         return l;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
Example #3
0
 public static Tiers getOneTiers(long id)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         String search = "select * from yvs_tiers where id = " + id + "";
         NpgsqlCommand Lcmd = new NpgsqlCommand(search, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         Tiers a = new Tiers();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Adresse = lect["adresse"].ToString();
                 a.Civilite = lect["civilite"].ToString();
                 a.CodeTiers = lect["code_tiers"].ToString();
                 a.Logo = lect["logo"].ToString();
                 a.Nom = lect["nom"].ToString();
                 a.Prenom = lect["prenom"].ToString();
                 a.Tel = lect["tel"].ToString();
                 a.Nom_prenom = a.Prenom + " " + a.Nom;
                 a.Update = true;
             }
             lect.Close();
         }
         return a;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
Example #4
0
 public static bool getUpdateTiers(Tiers 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);
     }
 }
Example #5
0
 public TiersBll(Tiers unTiers)
 {
     tiers = unTiers;
 }