コード例 #1
0
 public static List<ArticleTaxe> getListArticleTaxe(String query)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         List<ArticleTaxe> l = new List<ArticleTaxe>();
         NpgsqlCommand Lcmd = new NpgsqlCommand(query, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 ArticleTaxe a = new ArticleTaxe();
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Actif = (Boolean)((lect["actif"] != null) ? (!lect["actif"].ToString().Trim().Equals("") ? lect["actif"] : false) : false);
                 a.Article = (lect["article_categorie"] != null
                     ? (!lect["article_categorie"].ToString().Trim().Equals("")
                     ? new ArticleComptable(Convert.ToInt64(lect["article_categorie"].ToString()))
                     : new ArticleComptable())
                     : new ArticleComptable());
                 a.Designation = a.Article.Designation;
                 a.RefArt = a.Article.RefArt;
                 a.CodeBarre = a.Article.CodeBarre;
                 a.Taxe = (lect["taxe"] != null
                     ? (!lect["taxe"].ToString().Trim().Equals("")
                     ? BLL.TaxeBll.One(Convert.ToInt64(lect["taxe"].ToString()))
                     : new Taxe())
                     : new Taxe());
                 a.AppRemise = (Boolean)((lect["app_remise"] != null) ? (!lect["app_remise"].ToString().Trim().Equals("") ? lect["app_remise"] : false) : false);
                 a.Update = true;
                 l.Add(a);
             }
             lect.Close();
         }
         return l;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
コード例 #2
0
 public static ArticleTaxe getAjoutArticleTaxe(ArticleTaxe 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);
     }
 }
コード例 #3
0
 public ArticleTaxeBll(ArticleTaxe unArticleTaxe)
 {
     article = unArticleTaxe;
 }
コード例 #4
0
 public static bool getUpdateArticleTaxe(ArticleTaxe 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);
     }
 }
コード例 #5
0
 public static ArticleTaxe getOneArticleTaxe(long id)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         String search = "select * from yvs_base_article_categorie_comptable_taxe where id = " + id + "";
         NpgsqlCommand Lcmd = new NpgsqlCommand(search, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         ArticleTaxe a = new ArticleTaxe();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Actif = (Boolean)((lect["actif"] != null) ? (!lect["actif"].ToString().Trim().Equals("") ? lect["actif"] : false) : false);
                 a.Article = (lect["article_categorie"] != null
                     ? (!lect["article_categorie"].ToString().Trim().Equals("")
                     ? new ArticleComptable(Convert.ToInt64(lect["article_categorie"].ToString()))
                     : new ArticleComptable())
                     : new ArticleComptable());
                 a.Designation = a.Article.Designation;
                 a.RefArt = a.Article.RefArt;
                 a.CodeBarre = a.Article.CodeBarre;
                 a.Taxe = (lect["taxe"] != null
                     ? (!lect["taxe"].ToString().Trim().Equals("")
                     ? BLL.TaxeBll.One(Convert.ToInt64(lect["taxe"].ToString()))
                     : new Taxe())
                     : new Taxe());
                 a.AppRemise = (Boolean)((lect["app_remise"] != null) ? (!lect["app_remise"].ToString().Trim().Equals("") ? lect["app_remise"] : false) : false);
                 a.Update = true;
             }
             lect.Close();
         }
         return a;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }