Exemplo n.º 1
0
 public static List<Societe> getListSociete(String query)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         List<Societe> l = new List<Societe>();
         NpgsqlCommand Lcmd = new NpgsqlCommand(query, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 Societe a = new Societe();
                 a.Id = Convert.ToInt32(lect["id"].ToString());
                 a.AdresseSiege = lect["adress_siege"].ToString();
                 a.CodeAbbreviation = lect["code_abreviation"].ToString();
                 a.Logo = lect["logo"].ToString();
                 a.Designation = lect["name"].ToString();
                 a.Telephone = lect["tel"].ToString();
                 l.Add(a);
             }
             lect.Close();
         }
         return l;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
Exemplo n.º 2
0
 public static Societe getAjoutSociete(Societe 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);
     }
 }
Exemplo n.º 3
0
 public static Societe getOneSociete(long id)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         String search = "select * from yvs_societes where id = " + id + "";
         NpgsqlCommand Lcmd = new NpgsqlCommand(search, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         Societe a = new Societe();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 a.Id = Convert.ToInt32(lect["id"].ToString());
                 a.AdresseSiege = lect["adress_siege"].ToString();
                 a.CodeAbbreviation = lect["code_abreviation"].ToString();
                 a.Logo = lect["logo"].ToString();
                 a.Designation = lect["name"].ToString();
                 a.Telephone = lect["tel"].ToString();
             }
             lect.Close();
         }
         return a;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
Exemplo n.º 4
0
 public static bool getUpdateSociete(Societe 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);
     }
 }
Exemplo n.º 5
0
 public SocieteBll(Societe unSociete)
 {
     societe = unSociete;
 }