protected void Page_Load(object sender, EventArgs e) { Label1.Text = Session["userName"].ToString(); int idUser = Int32.Parse(Session["id"].ToString()); if (!Page.IsPostBack) { SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BMM_SHConnectionString"].ConnectionString); listeValide = new List <BMM>(); conn.Open(); int valid1 = 0, valid2 = 0; string query1 = "SELECT Code,Valid1,Valid2,IdGestionnaire,DateCreation FROM BMM WHERE UtilisateurId=" + idUser + ""; SqlCommand cmd = new SqlCommand(query1, conn); BMM b; SqlDataReader dr1 = cmd.ExecuteReader(); string s = ""; int code; string validation1 = "validé", validation2 = "validé", livr = "livré"; while (dr1.Read()) { code = dr1.GetInt32(0); validation1 = "non validé"; validation2 = "non validé"; livr = "non livré"; code = dr1.GetInt32(0); if (dr1[1] != null) { if (dr1[1].ToString() != "False") { if (dr1["IdValidateur2"].ToString() != s) { if (dr1["IdGestionnaire"].ToString() != s) { b = new BMM(code, validation1, validation2, livr, dr1["DateCreation"].ToString()); listeValide.Add(b); } } } } } } }
protected void Page_Load(object sender, EventArgs e) { Label1.Text = Session["userName"].ToString(); DateTime date = DateTime.Now; int idUser = Int32.Parse(Session["id"].ToString()); if (!Page.IsPostBack) { SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BMM_SHConnectionString"].ConnectionString); listeValide = new List <BMM>(); int user; conn.Open(); int valid1 = 0; string Nom = "", prenom = "", tel = ""; string modele = ""; int verif = 0; string query1 = "SELECT * FROM BMM WHERE IdValidateur1=" + idUser + " AND Valid1=1"; string cordonne = ""; SqlCommand cmd = new SqlCommand(query1, conn); BMM b; string query = ""; SqlDataReader dr1 = cmd.ExecuteReader(); string s = ""; int code; string validation1 = "non validé", validation2 = "non validé", livr = "non livré"; while (dr1.Read()) { verif = 0; user = dr1.GetInt32(8); query = "SELECT NOM , PRENOM , TEL FROM Utilisateur WHERE Id=" + user + ""; SqlCommand cmd2 = new SqlCommand(query, conn); SqlDataReader dr2 = cmd2.ExecuteReader(); while (dr2.Read()) { Nom = dr2[0].ToString(); prenom = dr2[1].ToString(); tel = dr2[2].ToString(); } cordonne = Nom + " " + " | Tel: " + tel + ""; dr2.Close(); query = "SELECT modele FROM Descriptionbmm WHERE BMMId =" + dr1.GetInt32(0) + " "; cmd2 = new SqlCommand(query, conn); dr2 = cmd2.ExecuteReader(); while (dr2.Read()) { if (verif == 0) { modele += dr2[0].ToString(); } else { modele += " , " + dr2[0].ToString(); } } dr2.Close(); code = dr1.GetInt32(7); if (dr1[3].ToString() != "") { livr = "Livré"; } if (dr1[10].ToString() == "True") { validation2 = "validé"; } b = new BMM(code, cordonne, modele, validation2, livr, date.ToString()); listeValide.Add(b); } } }
protected void Page_Load(object sender, EventArgs e) { Label1.Text = Session["userName"].ToString(); int idUser = Int32.Parse(Session["id"].ToString()); if (!Page.IsPostBack) { BMM b; ListItem item = new ListItem(); DropDownList1.Items.Add(new ListItem("select your choice", "id0")); listeValide = new List <BMM>(); int code; string validation1 = "", validation2 = "", livr = ""; SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BMM_SHConnectionString"].ConnectionString); conn.Open(); string query1 = "SELECT * FROM BMM WHERE Valid2='False' AND Valid1='True'"; SqlCommand cmd = new SqlCommand(query1, conn); SqlDataReader dr1 = cmd.ExecuteReader(); while (dr1.Read()) { code = dr1.GetInt32(7); item = new ListItem(); item.Text = code.ToString(); item.Value = code.ToString(); b = new BMM(code, "Validé", "non validé", "non livré", dr1["DateCreation"].ToString()); listeValide.Add(b); DropDownList1.Items.Add(item); } conn.Close(); } }
protected void Page_Load(object sender, EventArgs e) { Label1.Text = Session["userName"].ToString(); int idUser = Int32.Parse(Session["id"].ToString()); if (!Page.IsPostBack) { SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BMM_SHConnectionString"].ConnectionString); listeValide = new List <BMM>(); conn.Open(); int valid1 = 0; string query1 = "SELECT * FROM BMM WHERE Valid2='True'"; SqlCommand cmd = new SqlCommand(query1, conn); BMM b; SqlDataReader dr1 = cmd.ExecuteReader(); string s = ""; int code; string validation1 = "non validé", validation2 = "non validé", livr = "non livré"; while (dr1.Read()) { code = dr1.GetInt32(7); if (dr1[3].ToString() != "") { livr = "Livré"; } b = new BMM(code, "Validé", "validé", livr, dr1[4].ToString()); listeValide.Add(b); } } }
protected void Page_Load(object sender, EventArgs e) { Label1.Text = Session["userName"].ToString(); int idUser = Int32.Parse(Session["id"].ToString()); Id = idUser; if (!Page.IsPostBack) { BMM b; ListItem item = new ListItem(); DropDownList1.Items.Add(new ListItem("select your choice", "id0")); listeValide = new List <BMM>(); int code = 0; // SqlCommand cmd2; // string query2 = "UPDATE BMM SET IdGestionnaire=" + idUser + " WHERE Code=" + code + ""; SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BMM_SHConnectionString"].ConnectionString); conn.Open(); string query1 = "SELECT * FROM BMM WHERE Valid2='True' AND Valid1='True'"; SqlCommand cmd = new SqlCommand(query1, conn); SqlDataReader dr1 = cmd.ExecuteReader(); while (dr1.Read()) { if (dr1[3].ToString() == "") { code = dr1.GetInt32(7); item = new ListItem(); item.Text = code.ToString(); item.Value = code.ToString(); b = new BMM(code, "Validé", "validé", "non livré", dr1[4].ToString()); listeValide.Add(b); DropDownList1.Items.Add(item); } } dr1.Close(); conn.Close(); if (DropDownList1.Text != "select your choice") { LivrerButton.Enabled = true; } } }
protected void myButton_Click(object sender, EventArgs e) { //Response.Redirect(Request.RawUrl, true); produit p; int idbmm = 0; SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BMM_SHConnectionString"].ConnectionString); conn.Open(); if (IsPostBack) { if (DropDownList1.SelectedValue.ToString() != "id0") { //Label2.Text = DropDownList1.SelectedValue.ToString(); string query2 = "SELECT Id FROM BMM WHERE Code=" + DropDownList1.Text + ""; SqlCommand cmd2 = new SqlCommand(query2, conn); SqlDataReader dr2 = cmd2.ExecuteReader(); while (dr2.Read()) { idbmm = dr2.GetInt32(0); } dr2.Close(); string query = "SELECT* FROM Descriptionbmm WHERE BMMId=" + idbmm + ""; SqlCommand cmd4 = new SqlCommand(query, conn); SqlDataReader dr1 = cmd4.ExecuteReader(); while (dr1.Read()) { p = new produit(dr1[0].ToString(), dr1[1].ToString(), dr1[2].ToString(), dr1[3].ToString()); ListeProduit.Add(p); } string temp = ""; foreach (var pr in ListeProduit) { temp += string.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td></tr>", pr.getModele(), pr.getMarque(), pr.getDesignation(), pr.getReference()); } BmmBody.InnerHtml = temp; table4.Visible = true; dr1.Close(); } DropDownList1.Items.Clear(); DropDownList1.Items.Add(new ListItem("Selectionner un code", "id0")); listeValide.Clear(); listeValide = new List <BMM>(); ListItem item; int valid1 = 0; string query4 = "SELECT Code,Valid1,Valid2,IdGestionnaire,DateCreation,IdValidateur2 FROM BMM WHERE UtilisateurId=" + idUser + ""; SqlCommand cmd = new SqlCommand(query4, conn); BMM b; SqlDataReader dr4 = cmd.ExecuteReader(); string s = ""; int code; string validation1 = "non validé", validation2 = "non validé", livr = "non livré"; while (dr4.Read()) { validation1 = "non validé"; validation2 = "non validé"; livr = "non livré"; code = dr4.GetInt32(0); if (dr4[1] != null) { if (dr4[1].ToString() != "False") { validation1 = "Validé"; if (dr4["IdValidateur2"].ToString() != s) { validation2 = "Validé"; if (dr4["IdGestionnaire"].ToString() != s) { } else { b = new BMM(code, validation1, validation2, livr, dr4["DateCreation"].ToString()); listeValide.Add(b); code = dr4.GetInt32(0); item = new ListItem(); item.Text = code.ToString(); item.Value = code.ToString(); DropDownList1.Items.Add(item); } } else { b = new BMM(code, validation1, validation2, livr, dr4["DateCreation"].ToString()); listeValide.Add(b); code = dr4.GetInt32(0); item = new ListItem(); item.Text = code.ToString(); item.Value = code.ToString(); DropDownList1.Items.Add(item); } } else { b = new BMM(code, validation1, validation2, livr, dr4["DateCreation"].ToString()); listeValide.Add(b); code = dr4.GetInt32(0); item = new ListItem(); item.Text = code.ToString(); item.Value = code.ToString(); DropDownList1.Items.Add(item); } } } dr4.Close(); ListeProduit.Clear(); conn.Close(); } }