예제 #1
0
        public static FamilleArticle getOneFamilleArticle_(long id)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                String           search = "select * from yvs_base_famille_article where id = " + id + "";
                NpgsqlCommand    Lcmd   = new NpgsqlCommand(search, con);
                NpgsqlDataReader lect   = Lcmd.ExecuteReader();
                FamilleArticle   a      = new FamilleArticle();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        a.Id          = Convert.ToInt64(lect["id"].ToString());
                        a.Designation = lect["designation"].ToString();
                        a.Description = lect["description"].ToString();
                        a.Reference   = lect["reference"].ToString();
                    }
                    a.Update = true;
                    lect.Close();
                }
                return(a);
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return(null);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
예제 #2
0
        public static List <FamilleArticle> getListFamilleArticle_(String query)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                List <FamilleArticle> l    = new List <FamilleArticle>();
                NpgsqlCommand         Lcmd = new NpgsqlCommand(query, con);
                NpgsqlDataReader      lect = Lcmd.ExecuteReader();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        FamilleArticle a = new FamilleArticle();
                        a.Id          = Convert.ToInt64(lect["id"].ToString());
                        a.Designation = lect["designation"].ToString();
                        a.Description = lect["description"].ToString();
                        a.Reference   = lect["reference"].ToString();
                        a.Update      = true;
                        l.Add(a);
                    }
                    lect.Close();
                }
                return(l);
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return(null);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
예제 #3
0
        public static FamilleArticle getAjoutFamilleArticle(FamilleArticle 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);
            }
        }
예제 #4
0
        public static bool getUpdateFamilleArticle(FamilleArticle 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 FamilleArticleBll(FamilleArticle unFamilleArticle)
 {
     famille = unFamilleArticle;
 }