public chef_gestion_module() { InitializeComponent(); conn = new connection(); conn.conn.Open(); refreshGrid(); }
private void button2_Click(object sender, EventArgs e) { try { connection conn = new connection(); SqlCommand cmd = new SqlCommand("CheckLogin", conn.conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@UserN", SqlDbType.VarChar).Value = textBox1.Text; cmd.Parameters.Add("@PassW", SqlDbType.VarChar).Value = textBox2.Text; var returnParametre = cmd.Parameters.Add("@ReturnVal", SqlDbType.Bit); returnParametre.Direction = ParameterDirection.ReturnValue; conn.conn.Open(); cmd.ExecuteNonQuery(); var result = returnParametre.Value; int i = Convert.ToInt32(result); if (i != 0) { // MessageBox.Show("login successe"); errolabel.Text = "welcome Admin"; LoginAcceuill obj = (LoginAcceuill)Application.OpenForms["LoginAcceuill"]; obj.Hide(); new admin_acceuil(i).Show(); } else { // MessageBox.Show("the user doesn't existe"); // label3.Text = "user dosen't existe "; errolabel.Text = "username ou mot de passe incorect !!"; } } catch (SqlException ex) { MessageBox.Show(ex.Message); } }
private void button4_Click(object sender, EventArgs e) { string elemntN, moduleN, enseignantN; elemntN = textBox1.Text; enseignantN = comboBox2.Text; moduleN = comboBox1.Text; DataTable dt1 = new DataTable(); dt1 = conn.query("select m.id_module,es.id_enseignant from Module m ,Enseignant es where m.nom_module='" + moduleN + "' and es.nom_enseignant='" + enseignantN + "'"); int n = (Int32)dt1.Rows[0]["id_module"]; int b = (Int32)dt1.Rows[0]["id_enseignant"]; DataGridViewRow selectedRow = dataGridView1.Rows[index]; string vv = "update Element set nom_element='" + elemntN + "',id_module='" + n + "',id_enseignant='" + b + "' where id_element='" + selectedRow.Cells[0].Value.ToString() + "'"; /* MessageBox.Show(vv);*/ conn = new connection(); conn.conn.Open(); SqlCommand re = new SqlCommand(vv, conn.conn); re.ExecuteNonQuery(); // conn.execute_query("update Element set nom_element ='"+elemntN+"' where id_element ='"+vv+"'"); MessageBox.Show("Bien modifier"); refreshGrid(); }
private void button1_Click(object sender, EventArgs e) { try { conn = new connection(); SqlCommand cmd = new SqlCommand("ajt_element", conn.conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@element_N", SqlDbType.VarChar).Value = textBox1.Text; cmd.Parameters.Add("@module_N", SqlDbType.VarChar).Value = comboBox1.Text; cmd.Parameters.Add("@enseignat_N", SqlDbType.VarChar).Value = comboBox2.Text; conn.conn.Open(); cmd.ExecuteNonQuery(); sqlAdapter = new SqlDataAdapter("SELECT id_element as [Id],nom_element as [Nom],M.nom_module as [Module],es.nom_enseignant as [Enseignant] FROM Element E ,Module M,Enseignant es where E.id_enseignant=es.id_enseignant and E.id_module=m.id_module", conn.conn); sqlCommand = new SqlCommandBuilder(sqlAdapter); dataset = new DataSet(); sqlAdapter.Fill(dataset, "Element"); dataGridView1.DataSource = null; dataGridView1.DataSource = dataset.Tables["Element"]; for (int i = 0; i < dataGridView1.Rows.Count; i++) { DataGridViewLinkCell linkCell = new DataGridViewLinkCell(); dataGridView1[0, i] = linkCell; } } catch (SqlException ex) { MessageBox.Show(ex.Message); } }
public admin_acceuil(int id) { InitializeComponent(); cn = new connection(); this.ida = id; DataTable dt = cn.query("select * from Administrateur where id_admin='" + ida + "'"); nom = (string)dt.Rows[0]["nom"]; prenom = (string)dt.Rows[0]["prenom"]; username = (string)dt.Rows[0]["admin_username"]; email = (string)dt.Rows[0]["email"]; portable = (string)dt.Rows[0]["portable"]; }
private void button2_Click(object sender, EventArgs e) { try { connection conn = new connection(); SqlCommand cmd = new SqlCommand("CheckLogin_E", conn.conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@UserN", SqlDbType.VarChar).Value = textBox1.Text; cmd.Parameters.Add("@PassW", SqlDbType.VarChar).Value = textBox2.Text; var returnParametre = cmd.Parameters.Add("@ReturnVal", SqlDbType.Int); returnParametre.Direction = ParameterDirection.ReturnValue; conn.conn.Open(); cmd.ExecuteNonQuery(); var result = returnParametre.Value; int i = Convert.ToInt32(result); if (i != 0) { errorlabel.Text = "welcome Enseignant"; //MessageBox.Show("Login suuccesse"); LoginAcceuill obj = (LoginAcceuill)Application.OpenForms["LoginAcceuill"]; obj.Hide(); new ens_acceuil(i).Show(); } else { // MessageBox.Show("the user doesn't existe"); errorlabel.Text = "username ou mot de passe incorect !"; } /* cmd.Parameters.Add("@ens", SqlDbType.Int).Value = ensbox.SelectedValue; * cmd.Parameters.Add("@semestre", SqlDbType.Int).Value = semestrebox.SelectedValue; * cmd.Parameters.Add("@element", SqlDbType.Int).Value = elementbox.SelectedValue; * cmd.Parameters.Add("@module", SqlDbType.Int).Value = modulebox.SelectedValue; * cmd.Parameters.Add("@groupe", SqlDbType.Int).Value = groupebox.SelectedValue; * cmd.Parameters.Add("@salle", SqlDbType.Int).Value = sallebox.SelectedValue; * cmd.Parameters.Add("@filiere", SqlDbType.Int).Value = idf; * cmd.Parameters.Add("@type", SqlDbType.VarChar).Value = typebox.Text;*/ // MessageBox.Show("Login successe"); } catch (SqlException ex) { MessageBox.Show(ex.Message); } }
private void button4_Click(object sender, EventArgs e) { conn = new connection(); string moduleN; moduleN = textBox1.Text; string semestre; semestre = comboBox1.SelectedValue.ToString(); DataGridViewRow selectedRow = dataGridView1.Rows[index]; string idmodule = selectedRow.Cells[0].Value.ToString(); int i = Convert.ToInt32(idmodule); string vv = "update Module set nom_module='" + moduleN + "' ,id_semestre='" + semestre + "' where id_module='" + i + "'"; conn.conn.Open(); SqlCommand cmd = new SqlCommand(vv, conn.conn); cmd.ExecuteNonQuery(); refreshGrid(); }
public admin_gestion_filiere() { cn = new connection(); InitializeComponent(); }
public chef_gestion_salle() { InitializeComponent(); cn = new connection(); }
public admin_gestion_chef() { cn = new connection(); InitializeComponent(); }