private void Command1_Click(object sender, System.EventArgs e) { if (Agence_Type.SelectedIndex == 0) { string sql0 = "Select Intituler, Code_Ville " + "From Ville Where Pays = 'DZ'"; SqlConnection connection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]); connection.Open(); SqlDataAdapter adapterSrc = new SqlDataAdapter(sql0, connection); DataSet dsSrc = new DataSet(); adapterSrc.Fill(dsSrc); ListVille.DataSource = dsSrc; ListVille.DataTextField = "Intituler"; ListVille.DataValueField = "Code_Ville"; ListVille.DataBind(); connection.Close(); ActiveForm = FrmVille; } else { string sql0 = "SELECT Code_Pays, Intituler From Pays"; SqlConnection connection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]); connection.Open(); SqlDataAdapter adapter = new SqlDataAdapter(sql0, connection); DataSet ds = new DataSet(); adapter.Fill(ds); ListPays.DataSource = ds; ListPays.DataTextField = "Intituler"; ListPays.DataValueField = "Code_Pays"; ListPays.DataBind(); ActiveForm = FrmPays; } }
private void Command1_Click(object sender, System.EventArgs e) { if (Vol_Type.SelectedIndex == 0) { string sql0 = "Select DISTINCT Ville.Intituler, Code_Ville " + "From Aeroport, Ville , Trajet " + "Where (APT_Src=APT"+ " and Ville = Code_Ville"+ " and Pays = 'DZ')"; string sql1 = "Select DISTINCT Ville.Intituler, Code_Ville " + "From Aeroport, Ville , Trajet " + "Where (APT_Dest=APT"+ " and Ville = Code_Ville"+ " and Pays = 'DZ')"; SqlConnection connection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]); connection.Open(); SqlDataAdapter adapterSrc = new SqlDataAdapter(sql0, connection); DataSet dsSrc = new DataSet(); adapterSrc.Fill(dsSrc); ListVilleSrc.DataSource = dsSrc; ListVilleSrc.DataTextField = "Intituler"; ListVilleSrc.DataValueField = "Code_Ville"; ListVilleSrc.DataBind(); SqlDataAdapter adapterDest = new SqlDataAdapter(sql1, connection); DataSet dsDest = new DataSet(); adapterDest.Fill(dsDest); ListVilleDest.DataSource = dsDest; ListVilleDest.DataTextField = "Intituler"; ListVilleDest.DataValueField = "Code_Ville"; ListVilleDest.DataBind(); connection.Close(); ActiveForm = FrmVille; } else { string sql0 = "SELECT Code_Pays, Intituler From Pays"; SqlConnection connection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]); connection.Open(); SqlDataAdapter adapter = new SqlDataAdapter(sql0, connection); DataSet ds = new DataSet(); adapter.Fill(ds); ListPaysSrc.DataSource = ds; ListPaysSrc.DataTextField = "Intituler"; ListPaysSrc.DataValueField = "Code_Pays"; ListPaysSrc.DataBind(); ListPaysDest.DataSource = ds; ListPaysDest.DataTextField = "Intituler"; ListPaysDest.DataValueField = "Code_Pays"; ListPaysDest.DataBind(); connection.Close(); ActiveForm = FrmPays; } }
private void SelectionListForm_Activate(object sender, System.EventArgs e) { DataSet ds = GetCustomersData(); SelectionList1.DataSource = ds; SelectionList1.DataMember = "Customers"; SelectionList1.DataTextField = "ContactName"; SelectionList1.DataBind(); }
private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { string sql = "SELECT Nu_Red, Categorie from Reduction"; SqlConnection connection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]); connection.Open(); SqlDataAdapter adapter = new SqlDataAdapter(sql, connection); DataSet ds = new DataSet(); adapter.Fill(ds); ListReduc.DataSource = ds; ListReduc.DataTextField = "Categorie"; ListReduc.DataValueField = "Nu_Red"; ListReduc.DataBind(); connection.Close(); } }
private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { string sql = "SELECT Nu_Actualite, Intituler, Description from Actualite order by DateHeure"; SqlConnection connection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]); connection.Open(); SqlDataAdapter adapter = new SqlDataAdapter(sql, connection); DataSet ds = new DataSet(); adapter.Fill(ds); ListNews.DataSource = ds; ListNews.DataTextField = "Intituler"; ListNews.DataValueField = "Nu_Actualite"; ListNews.DataBind(); connection.Close(); } }
private void Command3_Click(object sender, System.EventArgs e) { string Code_Src = ListVille.Items[ListVille.SelectedIndex].Value; string sql0 = "Select Intituler, Code_Agence " + "From Agence Where (Ville = '" + Code_Src + "')"; SqlConnection connection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]); connection.Open(); SqlDataAdapter adapterSrc = new SqlDataAdapter(sql0, connection); DataSet dsSrc = new DataSet(); adapterSrc.Fill(dsSrc); ListAgence.DataSource = dsSrc; ListAgence.DataTextField = "Intituler"; ListAgence.DataValueField = "Code_Agence"; ListAgence.DataBind(); ActiveForm = FrmAgence; }
private void Command3_Click(object sender, System.EventArgs e) { string Code_Src = ListVilleSrc.Items[ListVilleSrc.SelectedIndex].Value; string Code_Dest = ListVilleDest.Items[ListVilleDest.SelectedIndex].Value; string sql0 = "Select DISTINCT Intituler, APT " + "From Aeroport, Trajet " + "Where (APT_Src=APT"+ " and Ville = '"+ Code_Src + "')"; string sql1 = "Select DISTINCT Intituler, APT " + "From Aeroport, Trajet " + "Where (APT_Dest=APT"+ " and Ville = '"+ Code_Dest + "')"; SqlConnection connection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]); connection.Open(); SqlDataAdapter adapterSrc = new SqlDataAdapter(sql0, connection); DataSet dsSrc = new DataSet(); adapterSrc.Fill(dsSrc); ListAPTSrc.DataSource = dsSrc; ListAPTSrc.DataTextField = "Intituler"; ListAPTSrc.DataValueField = "APT"; ListAPTSrc.DataBind(); SqlDataAdapter adapterDest = new SqlDataAdapter(sql1, connection); DataSet dsDest = new DataSet(); adapterDest.Fill(dsDest); ListAPTDest.DataSource = dsDest; ListAPTDest.DataTextField = "Intituler"; ListAPTDest.DataValueField = "APT"; ListAPTDest.DataBind(); connection.Close(); ActiveForm = FrmAPT; }
private void Command4_Click(object sender, System.EventArgs e) { string APTSRC = ListAPTSrc.Items[ListAPTSrc.SelectedIndex].Value; string APTDEST = ListAPTDest.Items[ListAPTDest.SelectedIndex].Value; string APT_SRC = ListAPTSrc.Items[ListAPTSrc.SelectedIndex].Text; string APT_DEST = ListAPTDest.Items[ListAPTDest.SelectedIndex].Text; int NuVol = 0; SqlConnection connection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]); try { connection.Open(); SqlCommand command = new SqlCommand("select Nu_Vol from Trajet where APT_Src = '" + APTSRC + "' and APT_Dest = '" + APTDEST + "'", connection); NuVol = (short)command.ExecuteScalar(); } catch { NuVol = 0; } finally { connection.Close(); } if (NuVol > 0) { connection.Open(); SqlDataAdapter adapter = new SqlDataAdapter("select DISTINCT Jours From Programme ,Vol Where Vol=Ref_Vol and Nu_Vol=" + NuVol, connection); DataSet ds = new DataSet(); adapter.Fill(ds); DataTable dtt = ds.Tables[0]; ArrayList all = new ArrayList(); foreach (DataRow row in dtt.Rows) { all.Add(row[0].ToString()); } connection.Close(); if (all.Count <= 0) { Lab_Result.Text = "Pas de vols disponibles dans le trajet " + APT_SRC + " - " + APT_DEST; ListResult.Items.Clear(); ActiveForm = FrmResult; } else { connection.Open(); SqlCommand cmd = new SqlCommand("select DISTINCT Heure_Depart, Heure_Arrive, Avion From Vol Where Nu_Vol=" + NuVol, connection); SqlDataReader readerdata = cmd.ExecuteReader(); while (readerdata.Read()) { Lab_Avion.Text = readerdata[2].ToString(); Lab_HD.Text = readerdata.GetDateTime(0).ToString("hh:mm"); Lab_HA.Text = readerdata.GetDateTime(1).ToString("hh:mm"); } connection.Close(); //probléme de variable globale Lab_NuVol.Text = NuVol.ToString(); ListResult.DataSource = all; ListResult.DataBind(); ActiveForm = FrmDate; } } else { Lab_Result.Text = "Pas de trajet disponible entre " + APT_SRC + " et " + APT_DEST; ListResult.Items.Clear(); ActiveForm = FrmResult; } }