Esempio n. 1
0
 public int UpdateEmploye(EmployeDTO employeDTO,int id)
 {
     try
     {
         return employeDAO.Update(employeDTO,id);
     }
     catch (DAOException daoException)
     {
         throw new ServiceException(daoException.Message);
     }
 }
Esempio n. 2
0
 /// <inheritdoc />
 public int AddEmploye(EmployeDTO employeDTO)
 {
     try
     {
         return employeDAO.Add(employeDTO);
     }
     catch (DAOException daoException)
     {
         throw new ServiceException(daoException.Message);
     }
 }
Esempio n. 3
0
        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();
            //}
        }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        public int Add(EmployeDTO employeDTO)
        {
            int n = 0;
            try
            {
                connexion.Open();
                command.CommandText = ADD_REQUEST;

                command.Parameters.Add(new MySqlParameter("@nom", employeDTO.Nom));
                command.Parameters.Add(new MySqlParameter("@poste", employeDTO.Poste));
                command.Parameters.Add(new MySqlParameter("@matricule", employeDTO.Matricule));
                command.Parameters.Add(new MySqlParameter("@motPasse", employeDTO.MotPasse));
                n = command.ExecuteNonQuery();
            }
            catch (MySqlException mySqlException)
            {
                throw new DAOException(mySqlException.Message);
            }
            finally
            {
                connexion.Close();
            }
            return n;
        }
Esempio n. 6
0
        public EmployeDTO Read(int id)
        {
            EmployeDTO employeDTO = new EmployeDTO();
            try
            {
                connexion.Open();
                command.CommandText = READ_REQUEST;

                command.Parameters.Add(new MySqlParameter("@idEmploye", id));
                MySqlDataReader dr = command.ExecuteReader();

                while (dr.Read())
                {
                    employeDTO.IdEmploye = dr.GetInt32(0);
                    employeDTO.Nom = dr.GetString(1);
                    employeDTO.Poste = dr.GetString(2);
                    employeDTO.Matricule = dr.GetInt32(3);
                    employeDTO.MotPasse = dr.GetString(4);
                }
            }
            catch (MySqlException mySqlException)
            {
                throw new DAOException(mySqlException.Message);
            }
            finally
            {
                connexion.Close();
            }
            return employeDTO;
        }
Esempio n. 7
0
        public List<EmployeDTO> GetAll()
        {
            List<EmployeDTO> employes = new List<EmployeDTO>();
            try
            {
                EmployeDTO employeDTO = new EmployeDTO();
                connexion.Open();
                command.CommandText = GET_ALL_REQUEST;

                MySqlDataReader dr = command.ExecuteReader();

                while (dr.Read())
                {
                    employeDTO.IdEmploye = dr.GetInt32(0);
                    employeDTO.Nom = dr.GetString(1);
                    employeDTO.Poste = dr.GetString(2);
                    employeDTO.Matricule = dr.GetInt32(3);
                    employeDTO.MotPasse = dr.GetString(4);
                    employes.Add(employeDTO);
                }
            }
            catch (MySqlException mySqlException)
            {
                throw new DAOException(mySqlException.Message);
            }
            finally
            {
                connexion.Close();
            }
            return employes;
        }