Ejemplo n.º 1
0
 public static Agence getAjoutAgence(Agence 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);
     }
 }
Ejemplo n.º 2
0
 public static List<Agence> getListAgence(String query)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         List<Agence> l = new List<Agence>();
         NpgsqlCommand Lcmd = new NpgsqlCommand(query, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 Agence a = new Agence();
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Adresse = lect["adresse"].ToString();
                 a.Abbreviation = lect["abbreviation"].ToString();
                 a.CodeAgence = lect["codeagence"].ToString();
                 a.Designation = lect["designation"].ToString();
                 a.Societe = (lect["societe"] != null
                     ? (!lect["societe"].ToString().Trim().Equals("")
                     ? BLL.SocieteBll.One(Convert.ToInt32(lect["societe"].ToString()))
                     : new Societe())
                     : new Societe());
                 l.Add(a);
             }
             lect.Close();
         }
         return l;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
Ejemplo n.º 3
0
 public static Agence getOneAgence(long id)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         String search = "select * from yvs_agences where id = " + id + "";
         NpgsqlCommand Lcmd = new NpgsqlCommand(search, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         Agence a = new Agence();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Adresse = lect["adresse"].ToString();
                 a.Abbreviation = lect["abbreviation"].ToString();
                 a.CodeAgence = lect["codeagence"].ToString();
                 a.Designation = lect["designation"].ToString();
                 a.Ville = (lect["ville"] != null
                     ? (!lect["ville"].ToString().Trim().Equals("")
                     ? BLL.DictionnaireBll.One(Convert.ToInt32(lect["ville"].ToString()))
                     : new Dictionnaire())
                     : new Dictionnaire());
                 a.Societe = (lect["societe"] != null
                     ? (!lect["societe"].ToString().Trim().Equals("")
                     ? BLL.SocieteBll.One(Convert.ToInt32(lect["societe"].ToString()))
                     : new Societe())
                     : new Societe());
             }
             lect.Close();
         }
         return a;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
Ejemplo n.º 4
0
 public static bool getUpdateAgence(Agence 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);
     }
 }
Ejemplo n.º 5
0
 public AgenceBll(Agence unAgence)
 {
     agence = unAgence;
 }