private void VerificationLogin() { EmployeService employe = new EmployeService(); EmployeDTO emp = new EmployeDTO(); int id = Int32.Parse(txtID.Text); string motPasse = txtPassword.Text; try { //connexion.Open(); emp = employe.ReadEmploye(id); if (txtID.Equals(null)) { IDRequis.Visible = true; }else if(motPasse.Equals(null)){ passRequis.Visible = true; } else if (emp.IdEmploye != id || emp.MotPasse != motPasse) { IDRequis.Visible = false; passRequis.Visible = false; MessageBox.Show("Votre ID ou votre mot de passe est invalide!"); // INVALID PASS } else { // SUCCESSFUL LOGIN Session["UserAuthentication"] = emp.IdEmploye; Response.Redirect("Manage.aspx"); } } catch (MySqlException mySqlException) { throw new Exception(mySqlException.Message); } //finally //{ // //connexion.Close(); //} }
private void VerifierLogin() { EmployeService employe = new EmployeService(); EmployeDTO emp = new EmployeDTO(); UserId = Int32.Parse(txtID.Text); string motPasse = txtPassword.Text; try { emp = employe.ReadEmploye(UserId); if (txtID.Text == string.Empty) { IDRequis.Show(); } else if (txtPassword.Text == string.Empty) { passRequis.Show(); } else if (emp.IdEmploye != UserId || emp.MotPasse != motPasse) { IDRequis.Hide(); passRequis.Hide(); MessageBox.Show("Votre ID ou votre mot de passe est invalide!"); } else { this.Hide(); Form1 form1 = new Form1(); form1.Show(); } } catch (MySqlException mySqlException) { throw new Exception(mySqlException.Message); } }