public void Modifier(string code_emp, string nom, string prenom, string sexe, string date_naissance,
                             string telephone, string email, string adresse, string surplus_salaire,
                             string code_dep, string code_grade, string code_poste, string debut, string motif)
        {
            try
            {
                double surplus = 0.0;
                if (surplus_salaire.Length > 0)
                {
                    surplus = Double.Parse(surplus_salaire);
                }

                DateTime naissance = DateTime.Parse("1/1/0001");
                if (date_naissance.Length > 0)
                {
                    naissance = DateTime.Parse(date_naissance);
                }
                Employe e = new Employe(code_emp, nom, prenom, sexe, naissance, telephone, email, adresse, surplus);

                StatutCarriere s = new StatutCarriere(code_dep, code_emp, int.Parse(code_grade), int.Parse(code_poste), DateTime.Parse(debut), motif);

                EmployeDAL.Update(e, s);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message + " - Couche(APP)");
            }
        }
        public static StatutCarriere GetStatutCarriereActuel(string code)
        {
            StatutCarriere s  = new StatutCarriere();
            Connecteur     ct = new Connecteur();

            try
            {
                SqlDataAdapter dae = new SqlDataAdapter(StatutCarriereDAL.selectActualEmployeStatutCarriere, ct.Connection);
                dae.SelectCommand.Parameters.AddWithValue("@CodeEmploye", code);

                DataTable dt = new DataTable("StatutCarriere");

                ct.Connection.Open();
                dae.Fill(dt);

                if (dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];
                    StatutCarriereDAL.Hydrate(s, dr);
                }

                return(s);
            }
            catch (SqlException ex)
            {
                throw new Exception("Error: " + ex.Message + " - Code: " + ex.Number + " - Couche(DAL)");
            }
            finally
            {
                ct.Connection.Close();
            }
        }
        private void RemplirEmploye(Employe e)
        {
            StatutCarriere s = e.getStatutActuel();

            tbCode.Text = e.CodeEmploye;

            tbNom.Text            = e.Nom;
            tbPrenom.Text         = e.Prenom;
            cboSexe.SelectedValue = e.Sexe;

            if (!e.DateNaissance.ToString().Equals(""))
            {
                dpDateNaissance.SelectedDate = e.DateNaissance;
                dpDateNaissance.DisplayDate  = e.DateNaissance;
            }

            tbTelephone.Text = e.Telephone;
            tbEmail.Text     = e.Email;
            tbAdresse.AppendText(e.Adresse);
            tbSurplusSalaire.Text = e.SurplusSalaire.ToString();

            cboDepartement.SelectedValue = s.CodeDepartement;
            cboGrade.SelectedValue       = s.CodeGrade;
            cboPoste.SelectedValue       = s.CodePoste;

            if (!s.Debut.ToString().Equals(""))
            {
                dpDebutStatut.SelectedDate = s.Debut;
            }

            cboMotifStatut.SelectedValue = s.Motif;
        }
        public static List <StatutCarriere> GetStatutCarrieres(string code)
        {
            List <StatutCarriere> lCarriere = new List <StatutCarriere>();
            Connecteur            ct        = new Connecteur();

            try
            {
                SqlDataAdapter dae = new SqlDataAdapter(StatutCarriereDAL.selectEmployeStatutCarrieres, ct.Connection);
                dae.SelectCommand.Parameters.AddWithValue("@CodeEmploye", code);

                DataTable dt = new DataTable("StatutCarriere");

                ct.Connection.Open();
                dae.Fill(dt);

                StatutCarriere s;

                foreach (DataRow dr in dt.Rows)
                {
                    s = new StatutCarriere();
                    StatutCarriereDAL.Hydrate(s, dr);
                    lCarriere.Add(s);
                }

                return(lCarriere);
            }
            catch (SqlException ex)
            {
                throw new Exception("Error: " + ex.Message + " - Code: " + ex.Number + " - Couche(DAL)");
            }
            finally
            {
                ct.Connection.Close();
            }
        }
        private void RemplirEmploye(Employe e)
        {
            StatutCarriere s = e.getStatutActuel();

            tbCode.Text = e.CodeEmploye;

            tbNom.Text            = e.Nom;
            tbPrenom.Text         = e.Prenom;
            ddlSexe.SelectedValue = e.Sexe;

            if (!e.DateNaissance.ToString().Equals(""))
            {
                tbDateNaissance.Text = e.DateNaissance.ToString();
            }

            tbTelephone.Text      = e.Telephone;
            tbEmail.Text          = e.Email;
            tbAdresse.Text        = e.Adresse;
            tbSurplusSalaire.Text = e.SurplusSalaire.ToString();

            ddlDepartement.SelectedValue = s.CodeDepartement;
            ddlGrade.SelectedValue       = s.CodeGrade.ToString();
            ddlPoste.SelectedValue       = s.CodePoste.ToString();

            if (!s.Debut.ToString().Equals(""))
            {
                tbDebutStatut.Text = s.Debut.ToString();
            }

            ddlMotifStatut.SelectedValue = s.Motif;
        }
        public static void setStatutCarriereParameters(SqlParameterCollection pc, StatutCarriere s)
        {
            pc.AddWithValue("@CodeDepartement", s.CodeDepartement);
            pc.AddWithValue("@CodeEmploye", s.CodeEmploye);
            pc.AddWithValue("@CodeGrade", s.CodeGrade);
            pc.AddWithValue("@CodePoste", s.CodePoste);
            pc.AddWithValue("@DebutStatut", s.Debut);

            pc.AddWithValue("@MotifStatut", s.Motif);
        }
示例#7
0
        private void RemplirEmploye(Employe emp)
        {
            StatutCarriere stc = emp.getStatutActuel();

            this.lbCodeEmploye.Content = emp.CodeEmploye;
            this.lbNom.Content         = emp.Nom;
            this.lbPrenom.Content      = emp.Prenom;
            this.lbSexe.Content        = emp.Sexe;

            this.lbDepartement.Content = stc.getDepartement().Name;
            this.lbPoste.Content       = stc.getPoste().Name + " / " + stc.getGrade().Name;
        }
        public void InsererStatutCarriere(string code_emp, string code_dep, string code_grade, string code_poste, string debut, string motif)
        {
            try
            {
                StatutCarriere s = new StatutCarriere(code_dep, code_emp, int.Parse(code_grade), int.Parse(code_poste), DateTime.Parse(debut), motif);


                StatutCarriereDAL.AjouterStatut(s);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message + " - Couche(APP)");
            }
        }
示例#9
0
        public static void Insert(Employe emp, StatutCarriere stc)
        {
            Connecteur ct = new Connecteur();


            if (ct.Connection.State == ConnectionState.Closed)
            {
                ct.Connection.Open();
            }

            //----Begin Transaction---
            SqlTransaction trans = ct.Connection.BeginTransaction();

            try
            {
                //Proceed Database Command-------------------------------------
                SqlCommand employeCmd =
                    new SqlCommand(EmployeDAL.insertEmploye, ct.Connection, trans);

                SqlCommand carriereCmd =
                    new SqlCommand(StatutCarriereDAL.InsertStatutCarriere, ct.Connection, trans);

                //1 - INSERT Employe
                //Employe Params - Insert
                EmployeDAL.setEmployeParameters(employeCmd.Parameters, emp);
                employeCmd.ExecuteNonQuery();

                //2 - INSERT StatutCarriere
                //StatutCarriere Params  - Insert
                StatutCarriereDAL.setStatutCarriereParameters(carriereCmd.Parameters, stc);
                carriereCmd.ExecuteNonQuery();

                //Commit Transaction
                trans.Commit();

                //-------------------------------------------------------------
            }
            catch (SqlException ex)
            {
                trans.Rollback();
                throw new Exception("Error: " + ex.Message + " - Code: " + ex.Number + " - Couche(DAL)");
            }
            finally
            {
                ct.Connection.Close();
            }
        }
        public static void AjouterStatut(StatutCarriere stc)
        {
            Connecteur ct = new Connecteur();

            //Proceed Database Command-------------------------------------
            if (ct.Connection.State == ConnectionState.Closed)
            {
                ct.Connection.Open();
            }

            //----Begin Transaction---
            SqlTransaction trans = ct.Connection.BeginTransaction();

            SqlCommand ancienCarriereCmd =
                new SqlCommand(StatutCarriereDAL.updateAncienStatut, ct.Connection, trans);

            SqlCommand carriereCmd =
                new SqlCommand(StatutCarriereDAL.insertStatutCarriere, ct.Connection, trans);

            try
            {
                //1 - Update FinStatut de l'Ancien Statut
                //Employe Params - Insert
                ancienCarriereCmd.Parameters.AddWithValue("@CodeEmploye", stc.CodeEmploye);
                ancienCarriereCmd.Parameters.AddWithValue("@FinStatut", stc.Debut);
                ancienCarriereCmd.ExecuteNonQuery();

                //2 - INSERT StatutCarriere
                //StatutCarriere Params  - Insert
                StatutCarriereDAL.setStatutCarriereParameters(carriereCmd.Parameters, stc);
                carriereCmd.ExecuteNonQuery();

                //Commit Transaction
                trans.Commit();

                //-------------------------------------------------------------
            }
            catch (SqlException ex)
            {
                trans.Rollback();
                throw new Exception("Error: " + ex.Message + " - Code: " + ex.Number + " - Couche(DAL)");
            }
            finally
            {
                ct.Connection.Close();
            }
        }
        public static void Hydrate(StatutCarriere s, DataRow dr)
        {
            //Statut Carriere
            s.CodeEmploye     = dr["CodeEmploye"].ToString();
            s.CodeDepartement = dr["CodeDepartement"].ToString();
            s.CodeGrade       = (int)dr["CodeGrade"];
            s.CodePoste       = (int)dr["CodePoste"];

            if (!dr["DebutStatut"].ToString().Equals(""))
            {
                s.Debut = (DateTime)dr["DebutStatut"];
            }

            if (!dr["FinStatut"].ToString().Equals(""))
            {
                s.Fin = (DateTime)dr["FinStatut"];
            }

            s.Motif = dr["MotifStatut"].ToString();
        }
示例#12
0
        private void RemplirEmploye(Employe emp, CarriereMotif motif)
        {
            this.lbEspaceEmploye.Content = motif + " de l'Employé : (" + emp.CodeEmploye + ") " + emp.Prenom + " " + emp.Nom;
            try
            {
                StatutCarriere stc = emp.getStatutActuel();

                this.lbDepartement.Content = stc.getDepartement().Name;
                this.lbGrade.Content       = stc.getGrade().Name;
                this.lbPoste.Content       = stc.getPoste().Name;
                this.lbDebut.Content       = stc.Debut;
                this.lbMotif.Content       = stc.Motif;

                this.dgCarriere.ItemsSource = emp.getStatutCarrieres();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#13
0
        private void RemplirEmploye(Employe emp, CarriereMotif motif)
        {
            this.lbEspaceEmploye.Text = motif + " de l'Employé : (" + emp.CodeEmploye + ") " + emp.Prenom + " " + emp.Nom;
            try
            {
                StatutCarriere stc = emp.getStatutActuel();

                this.lbDepartement.Text = stc.getDepartement().Name;
                this.lbGrade.Text       = stc.getGrade().Name;
                this.lbPoste.Text       = stc.getPoste().Name;
                this.lbDebut.Text       = stc.Debut.ToString();
                this.lbMotif.Text       = stc.Motif;

                this.dgCarriere.DataSource = emp.getStatutCarrieres();
                this.dgCarriere.DataBind();
            }
            catch (Exception ex)
            {
                this.lblFailure.Text = ex.Message;
            }
        }
示例#14
0
        private void PreparerInfo(Employe emp, CarriereMotif motif)
        {
            switch (motif)
            {
            case CarriereMotif.Promotion:
                this.cboMotifStatut.SelectedValue   = "Promotion";
                this.cboMotifStatut.IsEnabled       = false;
                this.btnValiderPromotion.Visibility = Visibility.Visible;
                break;

            case CarriereMotif.Transfert:
                StatutCarriere stc = emp.getStatutActuel();
                this.cboMotifStatut.SelectedValue = "Transfert";
                this.cboMotifStatut.IsEnabled     = false;
                //Garde le meme Grade
                this.cboGrade.SelectedValue = stc.CodeGrade;
                this.cboGrade.IsEnabled     = false;
                //Garde le meme Poste
                this.cboPoste.SelectedValue = stc.CodePoste;
                this.cboPoste.IsEnabled     = false;

                this.btnValiderTransfert.Visibility = Visibility.Visible;
                break;

            case CarriereMotif.Revocation:
                this.lbFinStatut.Visibility = Visibility.Visible;
                this.dpFinStatut.Visibility = Visibility.Visible;

                this.cboDepartement.IsEnabled = false;
                this.cboGrade.IsEnabled       = false;
                this.cboPoste.IsEnabled       = false;
                this.dpDebutStatut.IsEnabled  = false;
                this.cboMotifStatut.IsEnabled = false;

                this.btnValiderRevocation.Visibility = Visibility.Visible;
                break;
            }
        }