Exemple #1
0
 public void insertStock(ClsStock cb)
 {
     try
     {
         innitialiseConnect();
         if (!con.State.ToString().ToLower().Equals("open"))
         {
             con.Open();
         }
         cmd = new SqlCommand("exec InsertSI @Article,@Quantite,@DateStock", con);
         setParameter(cmd, "@Article", DbType.String, 20, cb.RefArticle1);
         setParameter(cmd, "@Quantite", DbType.String, 500, cb.Quantite);
         setParameter(cmd, "@DateStock", DbType.DateTime, 20, cb.DateSock);
         cmd.ExecuteNonQuery();
         con.Close();
         //MessageBox.Show("Message Envoyé ");
     }
     catch (Exception ex)
     {
         //MessageBox.Show(ex.Message);
     }
 }
Exemple #2
0
        public void InsertArticleSI()
        {
            bool     teste = true;
            ClsStock cb    = new ClsStock();

            innitialiseConnect();
            if (!con.State.ToString().ToLower().Equals("open"))
            {
                con.Open();
            }
            SqlCommand    cmd = new SqlCommand("select codeArt,quantiteArt from tArticle", con);
            SqlDataReader dr;

            dr = cmd.ExecuteReader();
            int count = 0;

            while (dr.Read())
            {
                cb.RefArticle1 = int.Parse(dr["codeArt"].ToString());
                cb.Quantite    = double.Parse(dr["quantiteArt"].ToString());
                cb.DateSock    = DateTime.Now;
                insertStock(cb);
                //count += 1;
            }
            //if (count == 1)
            //{
            //    teste = true;
            //}

            //else
            //{
            //    teste = false;
            //}

            //return teste;
        }