Example #1
0
        private Articles RecuperationArticles(IDataReader dr)
        {
            Articles art = new Articles();

            i               = i + 1;
            art.Num         = i;
            art.Id          = Convert.ToInt32(dr["Id"].ToString());
            art.Code        = dr["Code"].ToString();
            art.Designation = dr["Articles"].ToString();
            art.CodeCateg   = dr["CodeCateg"].ToString();
            art.Categorie   = dr["Categorie"].ToString();
            art.QuantiteS   = dr["Quantite"].ToString();
            art.PVu         = Convert.ToDouble(dr["PVu"].ToString());
            art.PVt         = dr["PVT"].ToString();
            art.DateAjout   = Convert.ToDateTime(dr["DateAjout"].ToString());


            return(art);
        }
Example #2
0
        public void Enregistrer(Articles art)
        {
            if (ImplementeConnexion.Instance.Conn.State == ConnectionState.Closed)
            {
                ImplementeConnexion.Instance.Conn.Open();
            }
            using (IDbCommand cmd = ImplementeConnexion.Instance.Conn.CreateCommand())
            {
                cmd.CommandText = "INSERT_ARTICLE";
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(Parametre.Instance.AddParametres(cmd, "@id", 5, DbType.Int32, art.Id));
                cmd.Parameters.Add(Parametre.Instance.AddParametres(cmd, "@designation", 100, DbType.String, art.Designation));
                cmd.Parameters.Add(Parametre.Instance.AddParametres(cmd, "@pv", 20, DbType.Double, art.PVu));
                cmd.Parameters.Add(Parametre.Instance.AddParametres(cmd, "@unite", 100, DbType.String, art.Unite));
                cmd.Parameters.Add(Parametre.Instance.AddParametres(cmd, "@refcateg", 5, DbType.Int32, art.RefCategorie));
                cmd.Parameters.Add(Parametre.Instance.AddParametres(cmd, "@code", 50, DbType.String, art.Code));

                cmd.ExecuteNonQuery();
            }
        }