Exemplo n.º 1
0
        public static List <ArticleComptable> getListArticleComptable(String query)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                List <ArticleComptable> l    = new List <ArticleComptable>();
                NpgsqlCommand           Lcmd = new NpgsqlCommand(query, con);
                NpgsqlDataReader        lect = Lcmd.ExecuteReader();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        ArticleComptable a = new ArticleComptable();
                        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"] != null
                            ? (!lect["article"].ToString().Trim().Equals("")
                            ? BLL.ArticleBll.One(Convert.ToInt64(lect["article"].ToString()))
                            : new Article())
                            : new Article());
                        a.Designation = a.Article.Designation;
                        a.RefArt      = a.Article.RefArt;
                        a.CodeBarre   = a.Article.CodeBarre;
                        a.Compte      = (lect["compte"] != null
                            ? (!lect["compte"].ToString().Trim().Equals("")
                            ? BLL.CompteBll.One(Convert.ToInt64(lect["compte"].ToString()))
                            : new Compte())
                            : new Compte());
                        a.Categorie = (lect["categorie"] != null
                            ? (!lect["categorie"].ToString().Trim().Equals("")
                            ? new CategorieComptable(Convert.ToInt64(lect["categorie"].ToString()))
                            : new CategorieComptable())
                            : new CategorieComptable());
                        a.Articles = BLL.ArticleTaxeBll.Liste("select * from yvs_base_article_categorie_comptable_taxe where article_categorie = " + a.Id);
                        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 ArticleComptable getAjoutArticleComptable(ArticleComptable 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 bool getUpdateArticleComptable(ArticleComptable 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.º 4
0
 public ArticleComptableBll(ArticleComptable unArticleComptable)
 {
     article = unArticleComptable;
 }