private void listDesSalariesToolStripMenuItem_Click(object sender, EventArgs e) { Salarie s = new Salarie(); List_des_Salarie l = new List_des_Salarie(); l.MdiParent = this; l.dataGridView1.Rows.Clear(); l.dataGridView1.DataSource = s.Act("salarie"); l.Show(); }
private void button2_Click(object sender, EventArgs e) { formulair2 f = new formulair2(); try { Program.cnx.Open(); Program.cmd.Connection = Program.cnx; Program.cmd.CommandText = "select numCongé , Nom , Prenom , nomb from congé as c , salarie as s where c.matricule = s.matricule and numCongé=" + comboBox1.Text; Program.dr = Program.cmd.ExecuteReader(); if (Program.dr.Read()) { f.Show(); f.textBox1.Text = Program.dr[0].ToString(); f.textBox2.Text = Program.dr[1].ToString(); f.textBox3.Text = Program.dr[2].ToString(); f.textBox4.Text = Program.dr[3].ToString(); } Program.dr.Close(); Program.cnx.Close(); Salarie S = new Salarie(); dataGridView2.DataSource = S.Act("Congé"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button1_Click_1(object sender, EventArgs e) { string sexe; try { Salarie S = new Salarie(); if (radioButton_homme.Checked == true) { sexe = "m"; } else { sexe = "f"; } Program.cnx.Open(); Program.cmd.Connection = Program.cnx; Program.cmd.CommandText = "insert into salarie values(" + int.Parse(textBox_matricule.Text) + ",'" + textBox_cin.Text + "','" + textBoxNom.Text + "','" + textBox_prenom.Text + "','" + sexe + "','" + dateTimePicker_datenass.Value.Date.ToString() + "','" + textBoxAdress.Text + "','" + dateTimePicker_dateembuche.Value.Date.ToString() + "','" + comboBox1.SelectedItem + "','" + comboBox_Site.SelectedItem + "','" + comboBox_service.SelectedItem + "'," + comboBox_echel.SelectedItem + ",'" + comboBoxGRADE.SelectedItem + "','" + textBoxLOGIN.Text + "','" + textBoxmodpas.Text + "')"; Program.cmd.ExecuteNonQuery(); Program.cnx.Close(); MessageBox.Show("bien"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }