//insersion dans association au region protected void Button1_Click(object sender, EventArgs e) { string[] region = DropDownListereg.SelectedItem.ToString().Split(' '); string[] service = DropDownListlisteservices.SelectedItem.ToString().Split(' '); string[] poste = DropDownListlisteposte.SelectedItem.ToString().Split(' '); //, CultureInfo.CreateSpecificCulture("fr-FR")); if (region[0].Length > 0 && service[0].Length > 0 && poste[0].Length > 0) { con = new connexion(); if (con.modifierData("insert into association_au_region(id_region,id_service,id_poste,date_associe) values('" + Int32.Parse(region[0]) + "','" + Int32.Parse(service[0]) + "','" + Int32.Parse(poste[0]) + "','" + datenow() + "')") > 0) { Response.Redirect("Admin_entreprise.aspx"); } else { Response.Write("<script language='Javascript'>alert('echec d enregistrement veuillez selectionner dans les choix')</script>"); } } else { Response.Write("<script language='Javascript'>alert('echec d enregistrement veuillez selectionner dans les choix du drop down list')</script>"); } }
protected void Button3_Click(object sender, EventArgs e) { con = new connexion(); if (TextBox2.Text.Length > 0) { if (con.modifierData("insert into region (nom_region) values ('" + TextBox2.Text + "') ") > 0) { Response.Redirect("Admin_entreprise.aspx"); } else { Response.Write("<script language='Javascript'>alert('echec d enregistrement du région peut etre que région existe')</script>"); } } }
void charger_poste() { if (!IsPostBack) { con = new connexion(); //selection du poste DropDownListlisteposte.Items.Clear(); rd = null; rd = con.selectData("select id_poste,nom_poste from poste"); DropDownListlisteposte.Items.Add(""); while (rd.Read()) { DropDownListlisteposte.Items.Add(rd.GetInt32(0) + " " + rd.GetString(1)); } rd.Close(); } }
//je veux charger le service void charger_servce() { if (!IsPostBack) { con = new connexion(); //selection du service DropDownListlisteservices.Items.Clear(); rd = null; rd = con.selectData("select id_service,nom_service from service"); DropDownListlisteservices.Items.Add(""); while (rd.Read()) { DropDownListlisteservices.Items.Add(rd.GetInt32(0) + " " + rd.GetString(1)); } } }
//charger la choix des regions void charger_region() { if (!IsPostBack) { con = new connexion(); //selection des regions DropDownListereg.Items.Clear(); DropDownListereg.Items.Add(""); rd = null; rd = con.selectData("select id_region,nom_region from region"); while (rd.Read()) { DropDownListereg.Items.Add(rd.GetInt32(0) + " " + rd.GetString(1)); } } }