Exemplo n.º 1
0
 public static List<Taxe> getListTaxe(String query)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         List<Taxe> l = new List<Taxe>();
         NpgsqlCommand Lcmd = new NpgsqlCommand(query, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 Taxe a = new Taxe();
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.CodeAppel = lect["code_appel"].ToString();
                 a.CodeTaxe = lect["code_taxe"].ToString();
                 a.Designation = lect["designation"].ToString();
                 a.Taux = (Double)((lect["taux"] != null) ? (!lect["taux"].ToString().Trim().Equals("") ? lect["taux"] : 0) : 0);
                 a.Update = true;
                 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 Taxe getAjoutTaxe(Taxe 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 Taxe getOneTaxe(long id)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         String search = "select * from yvs_base_taxes where id = " + id + "";
         NpgsqlCommand Lcmd = new NpgsqlCommand(search, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         Taxe a = new Taxe();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.CodeAppel = lect["code_appel"].ToString();
                 a.CodeTaxe = lect["code_taxe"].ToString();
                 a.Designation = lect["designation"].ToString();
                 a.Taux = (Double)((lect["taux"] != null) ? (!lect["taux"].ToString().Trim().Equals("") ? lect["taux"] : 0) : 0);
                 a.Update = true;
             }
             lect.Close();
         }
         return a;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
Exemplo n.º 4
0
 public static bool getUpdateTaxe(Taxe 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 TaxeBll(Taxe unTaxe)
 {
     taxe = unTaxe;
 }