示例#1
0
        public static void addEmploye(Employe settings)
        {
            var bd = new dbProjetE2ProdEntities();
            var ajout = new tblEmploye();
            var lstTypeTest = new List<tblTypeTest>();

            var tt =
                from e in bd.tblTypeTest
                select e;

            int i = 0;
            foreach (tblTypeTest item in tt)
            {
                foreach (TypeTest ty in settings.lstEmTypeTest)
                {
                    if (item.CodeTypeTest == ty.codeTypeTest)
                    {
                        ajout.tblTypeTest.Add(item);
                        i++;
                        break;
                    }
                }
                if (settings.lstEmTypeTest.Count == i)
                    break;
            }

            ajout.IdEmp = settings.idEmp;
            ajout.PrenomEmp = settings.prenomEmp;
            ajout.NomEmp = settings.nomEmp;
            ajout.CourrielEmp = settings.courrielEmp;
            ajout.NoTelPrincipal = settings.noTelPrincipal;
            ajout.NoTelSecondaire = settings.noTelSecondaire;
            ajout.AdressePostale = settings.adressePostale;
            ajout.DateEmbaucheEmp = settings.dateEmbaucheEmp;
            ajout.CompetenceParticuliere = settings.competenceParticuliere;
            ajout.Statut = settings.statut;
            ajout.CommentaireEmp = settings.commentaireEmp;

            //ajout.tblTypeTest = lstTypeTest;

            bd.tblEmploye.Add(ajout);

            try
            {
                bd.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                MessageBox.Show("Une erreur est survenue lors de l'ajout du nouvel employe", "Erreur système", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        public static void addEmploye(Employe settings)
        {
            var bd = new dbProjetE2ProdEntities();
            var add = new tblEmploye();
            var lstTypeTest = new List<tblTypeTest>();

            var tt =
                from e in bd.tblTypeTest
                select e;

            int i = 0;
            foreach (tblTypeTest item in tt)
            {
                foreach (TypeTest ty in settings.lstEmTypeTest)
                {
                    if (item.CodeTypeTest == ty.codeTypeTest)
                    {
                        lstTypeTest.Add(item);
                        i++;
                        break;
                    }
                }
                if (settings.lstEmTypeTest.Count == i)
                    break;
            }

            add.IdEmp = settings.idEmp;
            add.PrenomEmp = settings.prenomEmp;
            add.NomEmp = settings.nomEmp;
            add.CourrielEmp = settings.courrielEmp;
            add.NoTelPrincipal = settings.noTelPrincipal;
            add.NoTelSecondaire = settings.noTelSecondaire;
            add.AdressePostale = settings.adressePostale;
            add.DateEmbaucheEmp = settings.dateEmbaucheEmp;
            add.CompetenceParticuliere = settings.competenceParticuliere;
            add.Statut = settings.statut;
            add.CommentaireEmp = settings.commentaireEmp;
            add.tblTypeTest = lstTypeTest;

            bd.tblEmploye.Add(add);

            try
            {
                bd.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#3
0
 //      Employe existant
 public frmDetEmp(Employe E)
 {
     InitializeComponent();
     ctrlEm = new ctrlEmploye(true);
     btnCopier.Visible = false;
     btnSupprimer.Visible = false;
     this.btnAnnuler.Location = new Point(784, 477);
     this.btnEnregistrer.Location = new Point(10, 477);
     this.btnActiverModif.Location = new Point(125, 477);
     this.btnSupprimer.Location = new Point(240, 477);
     this.btnEnregistrer.Click += new EventHandler(btnEnregistrer_Click);
     this.btnActiverModif.Click += new EventHandler(btnActiverModif_Click);
     chargeEmp(E);
     ChargeTypeTest();
 }
示例#4
0
        public List<Employe> recherche(string cle)
        {
            List<Employe> lstEm = new List<Employe>();

            foreach (var item in rEmployeSQL.rechercheEmploye(cle))
            {
                Employe em = new Employe(item.IdEmp, item.PrenomEmp, item.NomEmp, item.CourrielEmp, item.NoTelPrincipal, item.NoTelSecondaire, item.AdressePostale, item.DateEmbaucheEmp, item.CompetenceParticuliere, item.Statut, item.CommentaireEmp, item);
                lstEm.Add(em);
            }
            return lstEm;
        }
示例#5
0
 private void chargeEmp(Employe _e)
 {
     txtId.Text = _e.idEmp.ToString();
     txtPrenom.Text = _e.prenomEmp;
     txtNom.Text = _e.nomEmp;
     txtCourriel.Text = _e.courrielEmp;
     txtTelPrinc.Text = _e.noTelPrincipal;
     txtTelSec.Text = _e.noTelSecondaire;
     txtAdresPost.Text = _e.adressePostale;
     dateEmbauche.Value = _e.dateEmbaucheEmp;
     txtCompetencePart.Text = _e.competenceParticuliere;
     txtCommentaire.Text = _e.commentaireEmp;
     empSelect = _e;
     this.Tag = _e;
 }
示例#6
0
        private void btnEnregistrer_Click(object sender, EventArgs e)
        {
            Employe enregistrement = new Employe();
            DialogResult resultEnr;
            int NoId;

            bool result = Int32.TryParse(txtId.Text, out NoId);
            if (result == false)
            {
                MessageBox.Show("Le code d'utilisateur est contient des valeur invalide (seulement des chiffres)", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            enregistrement.idEmp = Int32.Parse(txtId.Text.Trim());
            enregistrement.prenomEmp = txtPrenom.Text.Trim();
            enregistrement.nomEmp = txtNom.Text.Trim();
            enregistrement.courrielEmp = txtCourriel.Text.Trim();
            enregistrement.noTelPrincipal = txtTelPrinc.Text.Trim();
            enregistrement.noTelSecondaire = txtTelSec.Text.Trim();
            enregistrement.adressePostale = txtAdresPost.Text.Trim();
            enregistrement.dateEmbaucheEmp = dateEmbauche.Value;
            enregistrement.competenceParticuliere = txtCompetencePart.Text.Trim();
            enregistrement.statut = "A";
            enregistrement.commentaireEmp = txtCommentaire.Text.Trim();

            foreach (var item in chkLstTypeTest.CheckedItems)
            {
                enregistrement.lstEmTypeTest.Add((TypeTest)((List<TypeTest>)chkLstTypeTest.Tag).ElementAt(chkLstTypeTest.Items.IndexOf(item)));
            }

            if (ctrlEm.etat == true)
            {
                // modifier
                if (ctrlEm.verifier(enregistrement, this.Tag) == true)
                {
                    resultEnr = MessageBox.Show("Voulez-vous vraiment enregistrer?", "Enregistrement", MessageBoxButtons.YesNo);
                    if (resultEnr == DialogResult.Yes)
                    {
                        ctrlEm.modifier(enregistrement);
                        this.Tag = enregistrement;
                        this.Close();
                    }
                }
            }
            else
            {
                // ajouter
                if (ctrlEm.verifier(enregistrement, null) == true && ctrlEm.verifSemblable(enregistrement) == true)
                {
                    resultEnr = MessageBox.Show("Voulez-vous vraiment enregistrer?", "Enregistrement", MessageBoxButtons.YesNo);
                    if (resultEnr == DialogResult.Yes)
                    {
                        ctrlEm.ajouter(enregistrement);
                        empSelect = enregistrement;
                        this.Tag = "1";
                        this.Close();
                    }
                }
            }
        }
示例#7
0
        public static void setEmploye(Employe settings)
        {
            var bd = new dbProjetE2ProdEntities();
            var lstTypeTest = new List<tblTypeTest>();

            var r =
                (from e in bd.tblEmploye
                 where e.IdEmp == settings.idEmp
                 select e).First();

            var tt =
                from e in bd.tblTypeTest
                select e;

            int i = 0;
            r.tblTypeTest.Clear();
            foreach (tblTypeTest item in tt)
            {
                foreach (TypeTest ty in settings.lstEmTypeTest)
                {
                    if (item.CodeTypeTest == ty.codeTypeTest)
                    {
                        r.tblTypeTest.Add(item);
                        i++;
                        break;
                    }
                }
                if (settings.lstEmTypeTest.Count == i)
                    break;
            }

            r.PrenomEmp = settings.prenomEmp;
            r.NomEmp = settings.nomEmp;
            r.CourrielEmp = settings.courrielEmp;
            r.NoTelPrincipal = settings.noTelPrincipal;
            r.NoTelSecondaire = settings.noTelSecondaire;
            r.AdressePostale = settings.adressePostale;
            r.DateEmbaucheEmp = settings.dateEmbaucheEmp;
            r.CompetenceParticuliere = settings.competenceParticuliere;
            r.CommentaireEmp = settings.commentaireEmp;

            try
            {
                bd.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                MessageBox.Show("Une erreur est survenue lors de l'enregistrement des modifications", "Erreur système", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#8
0
        public bool verifAjout(Employe nouv)
        {
            lstEmploye.Clear();
            var lstBrut = rEmployeSQL.getEmploye();

            foreach (tblEmploye item in lstBrut)
            {
                lstEmploye.Add(new Employe(item));
            }

            foreach (Employe e in lstEmploye)
            {
                if (nouv.idEmp == e.idEmp &&
                    nouv.prenomEmp == e.prenomEmp &&
                    nouv.nomEmp == e.nomEmp &&
                    nouv.courrielEmp == e.courrielEmp &&
                    nouv.noTelPrincipal == e.noTelPrincipal &&
                    nouv.adressePostale == e.adressePostale &&
                    nouv.dateEmbaucheEmp == e.dateEmbaucheEmp)
                        return true;
            }
            return false;
        }
示例#9
0
        public static void setEmploye(Employe settings)
        {
            var lstTypeTest = new List<tblTypeTest>();

            var tt =
                from e in db.tblTypeTest
                select e;

            int i = 0;
            foreach (tblTypeTest item in tt)
            {
                foreach (TypeTest ty in settings.lstEmTypeTest)
                {
                    if (item.CodeTypeTest == ty.codeTypeTest)
                    {
                        lstTypeTest.Add(item);
                        i++;
                        break;
                    }
                }
                if (settings.lstEmTypeTest.Count == i)
                    break;
            }

            var r =
                (from e in db.tblEmploye
                 where e.IdEmp == settings.idEmp
                 select e).First();

            r.PrenomEmp = settings.prenomEmp;
            r.NomEmp = settings.nomEmp;
            r.CourrielEmp = settings.courrielEmp;
            r.NoTelPrincipal = settings.noTelPrincipal;
            r.NoTelSecondaire = settings.noTelSecondaire;
            r.AdressePostale = settings.adressePostale;
            r.DateEmbaucheEmp = settings.dateEmbaucheEmp;
            r.CompetenceParticuliere = settings.competenceParticuliere;
            r.CommentaireEmp = settings.commentaireEmp;

            //                ca va tu marché ?????????????????????????
            r.tblTypeTest = lstTypeTest;

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }