Beispiel #1
0
 public bool Control(ArticleCom bean)
 {
     if (bean == null)
     {
         Messages.ShowErreur("L'article ne peut pas être null");
         return(false);
     }
     if ((bean.article == null) ? bean.article.Id < 1 : true)
     {
         Messages.ShowErreur("L'article ne peut pas être null");
         return(false);
     }
     return(true);
 }
Beispiel #2
0
 public static ArticleCom getAjoutArticleCom(ArticleCom 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);
     }
 }
Beispiel #3
0
 public static List<ArticleCom> getListArticleCom(String query)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         List<ArticleCom> l = new List<ArticleCom>();
         NpgsqlCommand Lcmd = new NpgsqlCommand(query, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 ArticleCom a = new ArticleCom();
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 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.Image = a.Article.Image;
                 a.Update = true;
                 l.Add(a);
             }
             lect.Close();
         }
         return l;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
Beispiel #4
0
 public static bool getUpdateArticleCom(ArticleCom 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);
     }
 }
Beispiel #5
0
 public static ArticleCom getOneArticleCom(ArticleDepot article)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         String search = "select * from yvs_com_article where article = " + article.Article.Id + " limit 1";
         NpgsqlCommand Lcmd = new NpgsqlCommand(search, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         ArticleCom a = new ArticleCom();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 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.Image = a.Article.Image;
             }
             a.Stock = article.Stock;
             a.Update = true;
             lect.Close();
         }
         return a;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
Beispiel #6
0
 public bool Control(ArticleCom bean)
 {
     if (bean == null)
     {
         Messages.ShowErreur("L'article ne peut pas être null");
         return false;
     }
     if ((bean.article == null) ? bean.article.Id < 1 : true)
     {
         Messages.ShowErreur("L'article ne peut pas être null");
         return false;
     }
     return true;
 }
Beispiel #7
0
 public ArticleComBll(ArticleCom unArticleCom)
 {
     article = unArticleCom;
 }