/*private bool ValidMail(string adresse)
         * {
         *  System.Text.RegularExpressions.Regex myRegex = new Regex(@"^([\w]+)@([\w]+)\.([\w]+)$");
         *  //([\w]+) ==> caractère alphanumérique apparaissant une fois ou plus
         *  return myRegex.IsMatch(adresse); // retourne true ou false selon la vérification
         * }*/

        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            if (textBoxMotPasse.Text == textBoxMotPasseConfirm.Text)
            {
                /*Regex myRegex = new Regex(@"^([\w]+)@([\w]+)\.([\w]+)$");*/
                /*myRegex.IsMatch(textBoxMotPasse.Text);*/
                /*bool mdpOk = ValidMail("*****@*****.**");*/

                /*if (mdpOk)
                 * {*/
                IGestionEmployes
                    gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

                int         IdRole      = Convert.ToInt32((comboBoxRole.SelectedItem as ComboboxItem).Value);
                int         IdVille     = Convert.ToInt32((comboBoxVille.SelectedItem as ComboboxItem).Value);
                int         IdSociete   = Convert.ToInt32((comboBoxSociete.SelectedItem as ComboboxItem).Value);
                Utilisateur utilisateur = new Utilisateur(IdUtilisateurMod, IdRole, textBoxIdentifiant.Text, textBoxMotPasse.Text, Convert.ToDateTime(dateTimePickerDebut.Text), Convert.ToDateTime(dateTimePickerFin.Text), textBoxPrenom.Text, textBoxNom.Text, IdSociete);
                Adresse     adresse     = new Adresse(0, textBoxNumeroRue.Text, textBoxNomRue.Text, textBoxCodePostal.Text, IdVille, IdUtilisateurMod);

                gestionEmployes.updateUtilisateur(utilisateur);
                gestionEmployes.updateAdresse(adresse);

                this.Close();

                /*}
                 * else
                 * {
                 *  MessageBox.Show("Le mot de passe doit:\n- Contenir entre 8 et 15 caractères.\n- Contenir au moins une majuscule.\n- Contenir au moins un chiffre.", "Erreur lors de la création");
                 * }*/
            }
            else
            {
                MessageBox.Show("Les mots de passe entrés ne sont pas identiques.", "Erreur lors de la création");
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            IGestionEmployes
                gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

            switch (comboBoxAttribut.Text)
            {
            case "Nom":
                dataEmployes.DataSource = gestionEmployes.findUsersByNom(textBoxSearch.Text);
                break;

            case "Prénom":
                dataEmployes.DataSource = gestionEmployes.findUsersByPrenom(textBoxSearch.Text);
                break;

            case "Rôle":
                int IdRole = Convert.ToInt32((comboBoxRole.SelectedItem as ComboboxItem).Value);
                dataEmployes.DataSource = gestionEmployes.findUsersByRole(IdRole);
                break;

            case "Date de début":
                dataEmployes.DataSource = gestionEmployes.findUsersByDateDebut(textBoxSearch.Text);
                break;

            case "Date de fin":
                dataEmployes.DataSource = gestionEmployes.findUsersByDateFin(textBoxSearch.Text);
                break;

            case "Statut":
                bool status = Convert.ToBoolean(comboBoxStatut.Text);
                dataEmployes.DataSource = gestionEmployes.findUsersByStatus(status);
                break;
            }
        }
        public FormAjoutEmploye()
        {
            InitializeComponent();
            IGestionEmployes
                gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

            List <Role>    listeRoles    = gestionEmployes.findAllRoles();
            List <Ville>   listeVilles   = gestionEmployes.findAllVilles();
            List <Societe> listeSocietes = gestionEmployes.findAllSocietes();

            foreach (Role role in listeRoles)
            {
                ComboboxItem item = new ComboboxItem();
                item.Value = role.IdRole;
                item.Text  = role.CodeRole;

                comboBoxRole.Items.Add(item);
            }
            foreach (Ville ville in listeVilles)
            {
                ComboboxItem item = new ComboboxItem();
                item.Value = ville.IdVille;
                item.Text  = ville.CodeVille;

                comboBoxVille.Items.Add(item);
            }
            foreach (Societe societe in listeSocietes)
            {
                ComboboxItem item = new ComboboxItem();
                item.Value = societe.IdSociete;
                item.Text  = societe.NomSociete;

                comboBoxSociete.Items.Add(item);
            }
        }
        public void LoadInfo(int IdUtilisateur)
        {
            IGestionEmployes
                gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

            IdUtilisateurMod = IdUtilisateur;
            object[]    tabInfoUser = gestionEmployes.findUtilisateur(IdUtilisateur);
            Utilisateur utilisateur = (Utilisateur)tabInfoUser[0];
            Adresse     adresse     = (Adresse)tabInfoUser[1];

            comboBoxRole.SelectedIndex    = utilisateur.IdRole - 1;
            textBoxPrenom.Text            = utilisateur.Prenom.Trim();
            textBoxNom.Text               = utilisateur.Nom.Trim();
            textBoxIdentifiant.Text       = utilisateur.Identifiant;
            textBoxMotPasse.Text          = utilisateur.MotPasse;
            textBoxMotPasseConfirm.Text   = utilisateur.MotPasse;
            dateTimePickerDebut.Text      = utilisateur.DateDebut.ToString();
            dateTimePickerFin.Text        = utilisateur.DateFin.ToString();
            textBoxNumeroRue.Text         = adresse.NumeroRue;
            textBoxNomRue.Text            = adresse.NomRue;
            textBoxCodePostal.Text        = adresse.CodePostal;
            comboBoxVille.SelectedIndex   = adresse.IdVille - 1;
            textBoxNumeroRue.Text         = adresse.NumeroRue;
            comboBoxSociete.SelectedIndex = utilisateur.IdSociete - 1;

            this.Show();
        }
예제 #5
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            IGestionEmployes
                gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

            textBoxSearch.Text          = "";
            dataGridAdresses.DataSource = gestionEmployes.findAllAdresses();
        }
        private void button1_Click_1(object sender, EventArgs e)
        {
            IGestionEmployes
                gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

            dataEmployes.DataSource = gestionEmployes.findAllUtilisateurs();
            textBoxSearch.Text      = "";
        }
        public FormGestionVilles()
        {
            InitializeComponent();
            IGestionEmployes
                gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

            dataGridVilles.DataSource = gestionEmployes.findAllVilles();
        }
예제 #8
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            IGestionEmployes
                gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

            Role role = new Role(0, textBoxCodeRole.Text, textBoxDescriptionRole.Text);

            gestionEmployes.createRole(role);

            this.Close();
        }
예제 #9
0
        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            IGestionEmployes
                gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

            Societe societe = new Societe(0, textBoxNomSociete.Text, textBoxDescSociete.Text, textBoxNumeroSiret.Text);

            gestionEmployes.createSociete(societe);

            this.Close();
        }
 private void btnDeleteVille_Click(object sender, EventArgs e)
 {
     if (this.dataGridVilles.SelectedRows.Count > 0)
     {
         int selectedRowIndex = this.dataGridVilles.SelectedRows[0].Index;
         int idVille          = Convert.ToInt32(this.dataGridVilles.Rows[selectedRowIndex].Cells["IdVille"].Value);
         IGestionEmployes
             gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();
         gestionEmployes.deleteVille(idVille);
         dataGridVilles.DataSource = gestionEmployes.findAllVilles();
     }
 }
        private void btnDeleteUser_Click(object sender, EventArgs e)
        {
            IGestionEmployes
                gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

            if (this.dataEmployes.SelectedRows.Count > 0)
            {
                int selectedRowIndex = this.dataEmployes.SelectedRows[0].Index;
                int IdUtilisateur    = Convert.ToInt32(this.dataEmployes.Rows[selectedRowIndex].Cells["IdUtilisateur"].Value);
                gestionEmployes.deleteUtilisateur(IdUtilisateur);
                dataEmployes.DataSource = gestionEmployes.findAllUtilisateurs();
            }
        }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            IGestionEmployes
                gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

            int    IdRole          = Convert.ToInt32(textBoxIdRole.Text);
            string CodeRole        = textBoxCodeRole.Text;
            string DescriptionRole = textBoxDescriptionRole.Text;
            Role   role            = new Role(IdRole, CodeRole, DescriptionRole);

            gestionEmployes.updateRole(role);

            this.Close();
        }
예제 #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            IGestionEmployes
                gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

            int    IdVille          = Convert.ToInt32(textBoxIdVille.Text);
            string CodeVille        = textBoxCodeVille.Text;
            string DescriptionVille = textBoxDescriptionVille.Text;
            Ville  ville            = new Ville(IdVille, CodeVille, DescriptionVille);

            gestionEmployes.updateVille(ville);

            this.Close();
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            IGestionEmployes
                gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

            if (comboBoxAttribut.Text == "Code")
            {
                dataGridVilles.DataSource = gestionEmployes.findVillesByCode(textBoxSearch.Text);
            }
            else if (comboBoxAttribut.Text == "Description")
            {
                dataGridVilles.DataSource = gestionEmployes.findVillesByDescription(textBoxSearch.Text);
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            IGestionEmployes
                gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

            Boolean infoOk = gestionEmployes.checkAuthentification(textBoxIdentifiant.Text, textBoxMotPasse.Text);

            if (infoOk)
            {
                FormMenu form = new FormMenu();
                form.Show();
                this.Hide();
            }
            else if (!infoOk)
            {
                MessageBox.Show("L'identifiant ou le mot de passe entré est invalide.", "Erreur lors de l'authentification");
            }
        }
        public FormGestionEmployes()
        {
            InitializeComponent();
            IGestionEmployes
                gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

            dataEmployes.DataSource = gestionEmployes.findAllUtilisateurs();

            List <Role> listeRoles = gestionEmployes.findAllRoles();

            foreach (Role role in listeRoles)
            {
                ComboboxItem item = new ComboboxItem();
                item.Value = role.IdRole;
                item.Text  = role.CodeRole;

                comboBoxRole.Items.Add(item);
            }
        }
        public FormGestionSocietes()
        {
            InitializeComponent();
            IGestionEmployes
                gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

            dataGridSocietes.DataSource = gestionEmployes.findAllSocietes();

            List <Utilisateur> listeUtilisateurs = gestionEmployes.findAllUtilisateurs();

            foreach (Utilisateur utilisateur in listeUtilisateurs)
            {
                ComboboxItem item = new ComboboxItem();
                item.Value = utilisateur.IdUtilisateur;
                item.Text  = utilisateur.Prenom.Trim() + " " + utilisateur.Nom.Trim();

                comboBoxUtilisateur.Items.Add(item);
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            IGestionEmployes
                gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

            if (comboBoxAttribut.Text == "Nom")
            {
                dataGridSocietes.DataSource = gestionEmployes.findSocietesByNom(textBoxSearch.Text);
            }
            else if (comboBoxAttribut.Text == "Numéro de siret")
            {
                dataGridSocietes.DataSource = gestionEmployes.findSocietesByNumeroSiret(textBoxSearch.Text);
            }
            else if (comboBoxAttribut.Text == "Utilisateur")
            {
                int IdUtilisateur = Convert.ToInt32((comboBoxUtilisateur.SelectedItem as ComboboxItem).Value);
                dataGridSocietes.DataSource = gestionEmployes.findSocietesByUtilisateur(IdUtilisateur);
            }
        }
예제 #19
0
        public FormGestionAdresses()
        {
            InitializeComponent();
            IGestionEmployes
                gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

            dataGridAdresses.DataSource = gestionEmployes.findAllAdresses();

            List <Ville> listeVilles = gestionEmployes.findAllVilles();

            foreach (Ville ville in listeVilles)
            {
                ComboboxItem item = new ComboboxItem();
                item.Value = ville.IdVille;
                item.Text  = ville.CodeVille;

                comboBoxVille.Items.Add(item);
            }
        }
        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            if (textBoxMotPasse.Text != textBoxMotPasseConfirm.Text)
            {
                MessageBox.Show("Les mots de passe entrés ne sont pas identiques.", "Erreur lors de la création");
            }
            else
            {
                IGestionEmployes
                    gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

                int         IdRole      = Convert.ToInt32((comboBoxRole.SelectedItem as ComboboxItem).Value);
                int         IdVille     = Convert.ToInt32((comboBoxVille.SelectedItem as ComboboxItem).Value);
                int         IdSociete   = Convert.ToInt32((comboBoxSociete.SelectedItem as ComboboxItem).Value);
                Utilisateur utilisateur = new Utilisateur(0, IdRole, textBoxIdentifiant.Text, textBoxMotPasse.Text, Convert.ToDateTime(dateTimePickerDebut.Text), Convert.ToDateTime(dateTimePickerFin.Text), textBoxPrenom.Text, textBoxNom.Text, IdSociete);
                Adresse     adresse     = new Adresse(0, textBoxNumeroRue.Text, textBoxNomRue.Text, textBoxCodePostal.Text, IdVille, 0);

                gestionEmployes.createUtilisateur(utilisateur);
                gestionEmployes.createAdresse(adresse);

                this.Close();
            }
        }
예제 #21
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            IGestionEmployes
                gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

            if (comboBoxAttribut.Text == "Numéro de rue")
            {
                dataGridAdresses.DataSource = gestionEmployes.findAdressesByNumeroRue(textBoxSearch.Text);
            }
            else if (comboBoxAttribut.Text == "Nom de rue")
            {
                dataGridAdresses.DataSource = gestionEmployes.findAdressesByNomRue(textBoxSearch.Text);
            }
            else if (comboBoxAttribut.Text == "Code postal")
            {
                dataGridAdresses.DataSource = gestionEmployes.findAdressesByCodePostal(textBoxSearch.Text);
            }
            else if (comboBoxAttribut.Text == "Ville")
            {
                int IdVille = Convert.ToInt32((comboBoxVille.SelectedItem as ComboboxItem).Value);
                dataGridAdresses.DataSource = gestionEmployes.findAdressesByVille(IdVille);
            }
        }
        private void btnGeneratePDF_Click(object sender, EventArgs e)
        {
            // Si un employé est sélectionné
            if (this.dataEmployes.SelectedRows.Count > 0)
            {
                FolderBrowserDialog folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
                DialogResult        result = folderBrowserDialog.ShowDialog();

                if (result == DialogResult.OK)
                {
                    IGestionEmployes
                        gestionEmployes = GestionEmployesBuilderClassFactory.getInterface();

                    string                  folderName       = folderBrowserDialog.SelectedPath;
                    int                     selectedRowIndex = this.dataEmployes.SelectedRows[0].Index;
                    int                     IdUtilisateur    = Convert.ToInt32(this.dataEmployes.Rows[selectedRowIndex].Cells["IdUtilisateur"].Value);
                    object[]                tabInfoUser      = gestionEmployes.findUtilisateur(IdUtilisateur);
                    Utilisateur             utilisateur      = (Utilisateur)tabInfoUser[0];
                    Adresse                 adresse          = (Adresse)tabInfoUser[1];
                    Societe                 societe          = (Societe)tabInfoUser[2];
                    Role                    role             = (Role)tabInfoUser[3];
                    Ville                   ville            = (Ville)tabInfoUser[4];
                    FormModificationEmploye form             = new FormModificationEmploye();

                    // Génération du fichier PDF
                    try
                    {
                        pdfDocument myDoc       = new pdfDocument("Sample Application", "Me", false);
                        pdfPage     myFirstPage = myDoc.addPage(700, 700);
                        myFirstPage.addText("Fiche d'information - " + utilisateur.Prenom.Trim() + " " + utilisateur.Nom.Trim(),
                                            100, 630, predefinedFont.csHelvetica, 30, new pdfColor(predefinedColor.csBlack));
                        /*Table's creation*/
                        pdfTable myTable = new pdfTable();
                        //Set table's border
                        myTable.borderSize  = 0;
                        myTable.borderColor = new pdfColor(predefinedColor.csBlack);
                        /*Create table's header*/
                        myTable.tableHeader.addColumn(new pdfTableColumn("Information", predefinedAlignment.csLeft, 150));
                        myTable.tableHeader.addColumn(new pdfTableColumn("Valeur", predefinedAlignment.csCenter, 250));

                        /*Create table's rows*/
                        pdfTableRow myRow = myTable.createRow();
                        myRow[0].columnValue = "Prénom";
                        myRow[1].columnValue = utilisateur.Prenom.Trim();
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Nom";
                        myRow[1].columnValue = utilisateur.Nom.Trim();
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Identifiant";
                        myRow[1].columnValue = utilisateur.Identifiant;
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Mot de passe";
                        myRow[1].columnValue = utilisateur.MotPasse;
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Rôle";
                        myRow[1].columnValue = role.CodeRole;
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Date de début";
                        myRow[1].columnValue = utilisateur.DateDebut.ToShortDateString();
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Date de fin";
                        myRow[1].columnValue = utilisateur.DateFin.ToShortDateString();
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Adresse";
                        myRow[1].columnValue = adresse.NumeroRue + " " + adresse.NomRue + ", " + adresse.CodePostal + " " +
                                               ville.CodeVille;
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Nom de société";
                        myRow[1].columnValue = societe.NomSociete;
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Description de société";
                        myRow[1].columnValue = societe.DescriptionSociete;
                        myTable.addRow(myRow);

                        myRow = myTable.createRow();
                        myRow[0].columnValue = "Numéro de siret";
                        myRow[1].columnValue = societe.NumeroSiret;
                        myTable.addRow(myRow);

                        /*Set Header's Style*/
                        myTable.tableHeaderStyle = new pdfTableRowStyle(predefinedFont.csHelveticaBold, 12,
                                                                        new pdfColor(predefinedColor.csWhite), new pdfColor(predefinedColor.csRed));
                        /*Set Row's Style*/
                        myTable.rowStyle = new pdfTableRowStyle(predefinedFont.csHelvetica, 10, new pdfColor(predefinedColor.csBlack),
                                                                new pdfColor(predefinedColor.csWhite));
                        /*Set Alternate Row's Style*/
                        myTable.alternateRowStyle = new pdfTableRowStyle(predefinedFont.csHelvetica, 10,
                                                                         new pdfColor(predefinedColor.csBlack), new pdfColor(predefinedColor.csLightGray));
                        /*Set Cellpadding*/
                        myTable.cellpadding = 10;
                        /*Put the table on the page object*/
                        myFirstPage.addTable(myTable, 150, 550);
                        myTable = null;
                        myDoc.createPDF(folderName + "\\FicheInformation.pdf");
                        MessageBox.Show("Le fichier PDF a bien été créé", "Génération de PDF");
                        Process.Start(folderName + "\\FicheInformation.pdf");
                        // Fin de génération du fichier PDF
                    }
                    // Quand il y a une erreur
                    catch (Exception exception)
                    {
                        MessageBox.Show("L'erreur suivante s'est produite : " + exception.Message + "", "Erreur lors de l'éxécution");
                    }
                }
            }
            // Si aucun employé n'est sélectionné
            else
            {
                MessageBox.Show("Sélectionnez un utilisateur.", "Génération fichier PDF");
            }
        }