public void deleteArt(clsArticle art) { try { InitializeConnection(); string q = "delete from article where code_art=@code_art"; cmd = new MySqlCommand(q, con); cmd.Parameters.Add(new MySqlParameter("@code_art", art.CodeArt)); DialogResult result = MessageBox.Show("Voulez-vous vraiment suprimer cet article ?", "Supression", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { if (cmd.ExecuteNonQuery() == 1) { MessageBox.Show("Article suprimé"); cmd.Dispose(); con.Close(); } } }catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void updateStock(clsArticle art, string nbv) { string c = art.CodeArt; float newv = float.Parse(getQteastock(c)) - float.Parse(nbv); try { InitializeConnection(); string q = "update article set nbpieces=@nbpieces where code_art=@code_art"; cmd = new MySqlCommand(q, con); cmd.Parameters.Add(new MySqlParameter("@code_art", art.CodeArt)); cmd.Parameters.Add(new MySqlParameter("@nbpieces", newv)); if (cmd.ExecuteNonQuery() == 1) { MessageBox.Show("Operation effectuee avec succes!!"); } }catch (Exception ex) { MessageBox.Show(ex.Message); } finally { cmd.Dispose(); con.Close(); } }
public void insertTableFantome(clsArticle art) { try { InitializeConnection(); string q = "insert into table_fantome(ref_art,designation,typemvt,nbpieces,prix_gros,prix_u,totalpaie,typepaie,ref_agent,action) values(@ref_art,@designation,@typemvt,@nbpieces,@prix_gros,@prix_u,@totalpaie,@typepaie,@ref_agent,@action)"; cmd = new MySqlCommand(q, con); cmd.Parameters.Add(new MySqlParameter("@ref_art", art.CodeArt)); cmd.Parameters.Add(new MySqlParameter("@designation", art.Designation)); cmd.Parameters.Add(new MySqlParameter("@typemvt", art.Mvt)); cmd.Parameters.Add(new MySqlParameter("@nbpieces", art.Nbpieces)); cmd.Parameters.Add(new MySqlParameter("@prix_gros", art.Prix_gros)); cmd.Parameters.Add(new MySqlParameter("@prix_u", art.Prix_u)); cmd.Parameters.Add(new MySqlParameter("@totalpaie", art.PrixTotal)); cmd.Parameters.Add(new MySqlParameter("@typepaie", art.TypePaie)); cmd.Parameters.Add(new MySqlParameter("@ref_agent", art.Ref_agent)); cmd.Parameters.Add(new MySqlParameter("@action", art.Action)); if (cmd.ExecuteNonQuery() == 1) { //MessageBox.Show("Insertion mvt"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void MOdifierArt(clsArticle art) { try { InitializeConnection(); string q = "update article set designation=@designation,nbpieces=@nbpieces,fss=@fss,provenance=@provenance,prix_u=@prix_u,prix_gros=@prix_gros,prix_total=@prix_total,image=@image,last_date=date_Format(Now(), '%Y-%m-%d') where code_art=@code_art"; cmd = new MySqlCommand(q, con); cmd.Parameters.Add(new MySqlParameter("@code_art", art.CodeArt)); cmd.Parameters.Add(new MySqlParameter("@designation", art.Designation)); cmd.Parameters.Add(new MySqlParameter("@nbpieces", art.Nbpieces)); cmd.Parameters.Add(new MySqlParameter("@fss", art.Fss)); cmd.Parameters.Add(new MySqlParameter("@provenance", art.Provenance)); cmd.Parameters.Add(new MySqlParameter("@prix_u", art.Prix_u)); cmd.Parameters.Add(new MySqlParameter("@prix_gros", art.Prix_gros)); cmd.Parameters.Add(new MySqlParameter("@prix_total", art.PrixTotal)); cmd.Parameters.Add(new MySqlParameter("@image", art.image)); if (cmd.ExecuteNonQuery() == 1) { MessageBox.Show("Modification article a reussi"); cmd.Dispose(); con.Close(); } }catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void InsertArt(clsArticle art) { try { InitializeConnection(); string q = "INSERT INTO article (code_art,designation,nbpieces,fss,provenance,prix_u,prix_gros,prix_total,image) VALUES (@code_art,@designation,@nbpieces,@fss,@provenance,@prix_u,@prix_gros,@prix_total,@image)"; cmd = new MySqlCommand(q, con); cmd.Parameters.Add(new MySqlParameter("@code_art", art.CodeArt)); cmd.Parameters.Add(new MySqlParameter("@designation", art.Designation)); cmd.Parameters.Add(new MySqlParameter("@nbpieces", art.Nbpieces)); cmd.Parameters.Add(new MySqlParameter("@fss", art.Fss)); cmd.Parameters.Add(new MySqlParameter("@provenance", art.Provenance)); cmd.Parameters.Add(new MySqlParameter("@prix_u", art.Prix_u)); cmd.Parameters.Add(new MySqlParameter("@prix_gros", art.Prix_gros)); cmd.Parameters.Add(new MySqlParameter("@prix_total", art.PrixTotal)); cmd.Parameters.Add(new MySqlParameter("@image", art.image)); if (cmd.ExecuteNonQuery() == 1) { MessageBox.Show("Insertion article a reussi"); cmd.Dispose(); con.Close(); } } catch (MySqlException ex) { MessageBox.Show(ex.Message); } }
public Boolean InsertMvt(clsmvt mvt) { try { InitializeConnection(); string q = "insert into mouvement(ref_art,libeleMvt,typeMvt,nbrpieces,prix_gros,prix_u,totalpaie,typepaie,ref_client,ref_agent,voirBoss) values(@ref_art,@libeleMvt,@typeMvt,@nbrpieces,@prix_gros,@prix_u,@totalpaie,@typepaie,@ref_client,@ref_agent,@voirBoss)"; cmd = new MySqlCommand(q, con); cmd.Parameters.Add(new MySqlParameter("@ref_art", mvt.Ref_art)); cmd.Parameters.Add(new MySqlParameter("@libeleMvt", mvt.Lblmvt)); cmd.Parameters.Add(new MySqlParameter("@typeMvt", mvt.Typemvt)); cmd.Parameters.Add(new MySqlParameter("@nbrpieces", mvt.Nbpieces)); cmd.Parameters.Add(new MySqlParameter("@prix_gros", mvt.Prix_gro)); cmd.Parameters.Add(new MySqlParameter("@prix_u", mvt.Prix_U)); cmd.Parameters.Add(new MySqlParameter("@totalpaie", mvt.Totalpaie)); cmd.Parameters.Add(new MySqlParameter("@typepaie", mvt.Typepaie)); cmd.Parameters.Add(new MySqlParameter("@ref_client", mvt.Ref_cl)); cmd.Parameters.Add(new MySqlParameter("@ref_agent", mvt.Ref_agent)); cmd.Parameters.Add(new MySqlParameter("@voirBoss", mvt.VoirBoss)); DialogResult result = MessageBox.Show("Voulez-vous vraiment passer cette vente ?", "VENTE", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { if (cmd.ExecuteNonQuery() == 1) { clsArticle ar = new clsArticle(); ar.CodeArt = mvt.Ref_art; //MessageBox.Show("" + ar.CodeArt); updateStock(ar, mvt.Nbpieces); if (mvt.Typepaie == "Credit") { clsCredit cr = new clsCredit(); cr.Ref_cl = mvt.Ref_cl; cr.Ref_Art = mvt.Ref_art; cr.Qte = mvt.Nbpieces; cr.Montant = mvt.Totalpaie; insertCredit(cr); } return(true); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { cmd.Dispose(); con.Close(); } return(false); }
protected void Submit_Click(object sender, EventArgs e) { clsArticle objArticle = new clsArticle(); objArticle.Topicname = txtTopicname.Text.Trim(); objArticle.TopicDescription = txtTopicdescription.Text.Trim(); objArticle.PostBy = lblHeaderMessage.Text.Trim(); objArticle.Insert(); Response.Redirect("Articles.aspx"); }
private clsPanier AttribuerValeur(DataSet dataSet) { clsPanier resultat = new clsPanier(); if (dataSet?.Tables[0]?.Rows.Count > 0) { resultat.objPersonnes = new clsPersonne() { iID = Convert.ToInt32(dataSet.Tables[0].Rows[0][0]), eNiveau = RecupereNiveauUtilisateur(Convert.ToInt32(dataSet.Tables[0].Rows[0][1])), sNom = dataSet.Tables[0].Rows[0][2].ToString(), sPrenom = dataSet.Tables[0].Rows[0][3].ToString(), eSexe = RecupereSexe(dataSet.Tables[0].Rows[0][4].ToString()), sAdresse = dataSet.Tables[0].Rows[0][5].ToString(), dDateNaissance = Convert.ToDateTime(dataSet.Tables[0].Rows[0][6].ToString()), }; } if (dataSet?.Tables[1]?.Rows.Count > 0) { resultat.lstArticles = new List <clsArticle>(); foreach (DataRow item in dataSet.Tables[1].Rows) { clsArticle article = new clsArticle() { sNom = item[0].ToString(), iQuantite = Convert.ToInt32(item[1]), rPrix = Convert.ToDecimal(item[2]), }; article.rPrixTotal = article.rPrix * article.iQuantite; resultat.lstArticles.Add(article); } } return(resultat); }