private void btnPersonalSave_Click(object sender, EventArgs e) { if (txtEmpname.Text == "") { MessageBox.Show("Entrer le nom Employee !"); txtEmpname.Focus(); } else if (txtNatioanlity.Text == "") { MessageBox.Show("Entrer Nationalite Employee !"); txtNatioanlity.Focus(); } else if (cboGender.Text == "") { MessageBox.Show("Selectionner Genre !"); cboGender.Focus(); } else if (txtPanno.Text == "") { MessageBox.Show("Enter Telephone Employee !"); txtPanno.Focus(); } else if (txtReligion.Text == "") { MessageBox.Show("Enter Religion Employee !"); txtReligion.Focus(); } else if (cboBloodGroup.Text == "") { MessageBox.Show("Enter Group Sanguin Employee!"); } else { try { obj.connect(); obj.com.CommandText = "insert into tblDetailPersonnel values('" + txtEmpid.Text + "','" + txtEmpname.Text + "','" + cboGender.Text + "','" + txtPanno.Text + "',@date,'" + txtNatioanlity.Text + "','" + txtReligion.Text + "','" + cboBloodGroup.Text + "')"; obj.com.Parameters.AddWithValue("@date", dtpDOB.Value); obj.com.ExecuteNonQuery(); obj.com.Parameters.Clear(); MessageBox.Show("Detail Personnel a Bien Ajouté !"); grpPersonal.Visible = false; grpContact.Visible = true; txtAddress.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { obj.con.Close(); } } }
private void button1_Click_1(object sender, EventArgs e) { if (txtUname.Text == "") { MessageBox.Show(" ENTREZ LE NOM D'UTILISATEUR !!"); txtUname.Focus(); } else if (txtPassword.Text == "") { MessageBox.Show("ENTREZ LE MOT DE PASSE !!"); txtPassword.Focus(); } else { try { obj.connect(); obj.com.CommandText = "select * from tblLogin where Username='******' and Password='******'"; obj.dr = obj.com.ExecuteReader(); if (obj.dr.Read()) { string role = obj.dr[2].ToString(); if (role == "admin") { MessageBox.Show("Bienvenu,Monsieur Admin !!!", "Gestion de la Paie"); this.Hide(); frmAdmin fam = new frmAdmin(); fam.Show(); } else { MessageBox.Show("Bienvenue votre session !!", "Gestion de la Paie"); this.Hide(); // frmUserMdi fum = new frmUserMdi(); // fum.Show(); } } else { MessageBox.Show("Erreur de Connexion !!"); txtUname.Clear(); txtPassword.Clear(); txtUname.Focus(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { obj.con.Close(); } } }
public void fillCboId() { try { obj.connect(); obj.com.CommandText = "select * from tblDetailPersonnel"; obj.dr = obj.com.ExecuteReader(); while (obj.dr.Read()) { cboId.Items.Add(obj.dr[0].ToString()); } } catch { } finally { obj.con.Close(); } }
public void fillNo() { ConnexionBD obj = new ConnexionBD(); obj.connect(); obj.com.CommandText = "select COUNT (*) from tblFichePaie"; int maxrow = (int)obj.com.ExecuteScalar(); maxrow = maxrow + 1; lblSlipNo.Text = maxrow.ToString(); obj.con.Close(); }
public void fillgrid() { try { obj.connect(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); ds.Tables.Add(dt); SqlDataAdapter da = new SqlDataAdapter(); da = new SqlDataAdapter("select tblDetailPersonnel.EmployeeId,tblDetailPersonnel.EmployeNom,tblDetailTravail.Departement from tblDetailPersonnel,tblDetailTravail where tblDetailTravail.EmployeeId=tblDetailPersonnel.EmployeeId", obj.con); da.Fill(dt); dataGridView.DataSource = dt.DefaultView; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { } }
private void fillId() { ConnexionBD obj = new ConnexionBD(); obj.connect(); obj.com.CommandText = "select COUNT (EmployeeId) from tblDetailPersonnel"; int maxrow = (int)obj.com.ExecuteScalar(); maxrow = maxrow + 1; txtEmpid.Text = maxrow.ToString(); txtEmpIdContct.Text = maxrow.ToString(); txtIdQualication.Text = maxrow.ToString(); txtEmpIdJob.Text = maxrow.ToString(); obj.con.Close(); }
private void button1_Click(object sender, EventArgs e) { if (txtUsername.Text == "") { MessageBox.Show("Entrer le nom d'utilisateur!"); txtUsername.Focus(); } else if (txtPass1.Text == "") { MessageBox.Show("Entrez le mot de passe !"); txtPass1.Focus(); } else if (txtPass2.Text == "") { MessageBox.Show("Confirme mot de passe !"); txtPass2.Focus(); } else if (txtPass1.Text != txtPass2.Text) { MessageBox.Show("Retapez le mot de passe!!"); txtPass2.Focus(); } else { try { obj.connect(); //obj.com.CommandText = "insert into tblLogin values('" + txtUsername.Text + "','" + txtPass1.Text + "','" + comboBox1.Text + "')"; obj.com.CommandText = " exec ajouterUtilisateur '" + txtUsername.Text + "','" + txtPass1.Text + "','" + comboBox1.Text + "'"; obj.com.ExecuteNonQuery(); MessageBox.Show("User a Bien Ajoute !!"); txtUsername.Clear(); txtPass1.Clear(); txtPass2.Clear(); txtUsername.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { obj.con.Close(); } } }
private void button1_Click(object sender, EventArgs e) { if (txtUname.Text == "") { MessageBox.Show("Entrez le Nom d'Utilisateur !"); txtUname.Focus(); } else if (txtOpass.Text == "") { MessageBox.Show("Entrez Ancien Mot de Passe !"); txtOpass.Focus(); } else if (txtNpass.Text == "") { MessageBox.Show("Enter Nouveau Mot de Passe !"); txtNpass.Focus(); } else { obj.connect(); obj.com.CommandText = "select * from tblLogin where Username='******' and Password='******'"; obj.dr = obj.com.ExecuteReader(); if (obj.dr.Read()) { obj.dr.Close(); //obj.com.CommandText = "update tblLogin set Password='******' where Username='******'"; obj.com.CommandText = "exec ModifierUtilisateur " + txtUname.Text + "," + txtNpass.Text; obj.com.ExecuteNonQuery(); MessageBox.Show("Mot de Passe a Bien Change!!"); txtUname.Clear(); txtNpass.Clear(); txtOpass.Clear(); txtUname.Focus(); } else { MessageBox.Show("Nom d'Utilisateur/Mot de Passe non Correcte!!"); txtUname.Clear(); txtNpass.Clear(); txtOpass.Clear(); txtUname.Focus(); } obj.con.Close(); } }
public void showAll() { try { obj.connect(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); ds.Tables.Add(dt); SqlDataAdapter da = new SqlDataAdapter(); da = new SqlDataAdapter("select [tblDetailPersonnel].EmployeeID as [Employee Id],[tblDetailPersonnel].EmployeNom as [Nom],[tblDetailTravail].Departement,[tblDetailTravail].Designation,[tblDetailTravail].SalaireBase as [Salaire] from tblDetailPersonnel,tblDetailTravail where tblDetailPersonnel.EmployeeID=tblDetailTravail.EmployeeID", obj.con); da.Fill(dt); dataGridView1.DataSource = dt.DefaultView; } catch { } finally { obj.con.Close(); } }