Esempio n. 1
0
 public static List<Dictionnaire> getListDictionnaire(String query)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         List<Dictionnaire> l = new List<Dictionnaire>();
         NpgsqlCommand Lcmd = new NpgsqlCommand(query, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 Dictionnaire a = new Dictionnaire();
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Libelle = lect["libele"].ToString();
                 l.Add(a);
             }
             lect.Close();
         }
         return l;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
Esempio n. 2
0
 public static Dictionnaire getAjoutDictionnaire(Dictionnaire 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);
     }
 }
Esempio n. 3
0
 public static Dictionnaire getOneDictionnaire(long id)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         String search = "select * from yvs_dictionnaire where id = " + id + "";
         NpgsqlCommand Lcmd = new NpgsqlCommand(search, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         Dictionnaire a = new Dictionnaire();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Libelle = lect["libele"].ToString();
             }
             lect.Close();
         }
         return a;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
Esempio n. 4
0
 public static bool getUpdateDictionnaire(Dictionnaire 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);
     }
 }
Esempio n. 5
0
 public DictionnaireBll(Dictionnaire unDictionnaire)
 {
     dictionnaire = unDictionnaire;
 }