Example #1
0
        /// <summary>
        /// delete selected record by id
        /// reload grid view
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSupprimer_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult dialogue = MessageBox.Show(clsCommun.InformationSupprimerClient, clsCommun.TitreDialogueSupprimerClient, MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dialogue == DialogResult.Yes)
                {
                    if (iID <= 0)
                    {
                        throw new Exception(clsCommun.ErreurClientNonSelectionner);
                    }

                    gestion = new clsGestionSuperviseur();
                    gestion.SupprimerPersonne(iID);

                    gestion.RecupererListePersonnes(personne.iID);
                    dgDetaileClient.DataSource = RecupereListeClients(personne);
                    ConfigureDatasource();

                    MessageBox.Show(clsCommun.SuccesSupprimerClient);
                }

                if (dialogue == DialogResult.No)
                {
                    throw new Exception(clsCommun.InformationSupprimerClientAnnuler);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        /// <summary>
        /// retrieve client info baased on id
        /// retrieve list of clients based on authenticator role
        /// </summary>
        /// <param name="SauterRecupererlistPersonne"></param>
        private void RecupererPersonneParNiveau(bool SauterRecupererlistPersonne = false)
        {
            switch (personne.eNiveau)
            {
            case clsPersonne.enuNiveau.iCLIENT:
            case clsPersonne.enuNiveau.iSUPERVISEUR:
                gestion = new clsGestionSuperviseur();
                panier  = gestion.RecupererPanierPersonne(personneTransaction.iID);
                if (!SauterRecupererlistPersonne && personne.eNiveau == clsPersonne.enuNiveau.iSUPERVISEUR)
                {
                    listePersonneId = RecupererListPersonParId(personne);
                }
                break;

            case clsPersonne.enuNiveau.iCHEF_RAYON:
                gestion = new clsGestionChefRayon();
                panier  = gestion.RecupererPanierPersonne(personneTransaction.iID);
                if (!SauterRecupererlistPersonne)
                {
                    listePersonneId = RecupererListPersonParId(personne);
                }
                break;

            default:
                throw new Exception(clsCommun.ErreurApplicationGeneric);
            }

            if (listePersonneId.Count > 0)
            {
                ConteurIndice = listePersonneId.FindIndex(x => x == personneTransaction.iID);
            }
        }
Example #3
0
        /// <summary>
        /// perform validation of input data
        /// if id > 0 update client info based on id
        /// if id = 0 add new client
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnValider_Click(object sender, EventArgs e)
        {
            try
            {
                if (personneTransaction == null || personneTransaction.iID < 0)
                {
                    throw new Exception(clsCommun.ErreurApplicationGeneric);
                }

                if (!ValiderEtAttribuerValeur())
                {
                    MessageBox.Show(clsCommun.ErreurValidationClients);
                    return;
                }

                switch (personne.eNiveau)
                {
                case clsPersonne.enuNiveau.iSUPERVISEUR:
                case clsPersonne.enuNiveau.iCLIENT:
                    if (personneTransaction.iID == 0 && personne.eNiveau == clsPersonne.enuNiveau.iCLIENT)
                    {
                        goto default;
                    }

                    gestion = new clsGestionSuperviseur();
                    if (personneTransaction.iID == 0)
                    {
                        gestion.CreerPersonne(personneTransaction);
                    }
                    else
                    {
                        gestion.ModifierPersonnes(personneTransaction);
                    }

                    break;

                case clsPersonne.enuNiveau.iCHEF_RAYON:
                    if (personneTransaction.iID == 0)
                    {
                        goto default;
                    }

                    gestion = new clsGestionChefRayon();
                    gestion.ModifierPersonnes(personneTransaction);

                    break;

                default:
                    throw new Exception(clsCommun.ErreurUtilisateurInvalide);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                frmAuthentification authentification = new frmAuthentification();
                authentification.Show();
                this.Hide();
            }
        }
Example #4
0
        /// <summary>
        /// retrieve list of clients by business layer
        /// return datatable as data type
        /// </summary>
        /// <param name="personne"></param>
        /// <returns></returns>
        private DataTable RecupereListeClients(clsPersonne personne)
        {
            DataTable resultat = new DataTable();

            switch (personne.eNiveau)
            {
            case clsPersonne.enuNiveau.iSUPERVISEUR:
                gestion  = new clsGestionSuperviseur();
                resultat = gestion.RecupererListePersonnes(personne.iID);
                break;

            case clsPersonne.enuNiveau.iCHEF_RAYON:
                gestion  = new clsGestionChefRayon();
                resultat = gestion.RecupererListePersonnes(personne.iID);
                break;
            }

            return(resultat);
        }
Example #5
0
        /// <summary>
        /// call method in business layer to retrieve list of clients
        /// retrieve list of clients based on authenticator role
        /// </summary>
        /// <param name="personne"></param>
        /// <returns></returns>
        private List <int> RecupererListPersonParId(clsPersonne personne)
        {
            List <int>          resultat = new List <int>();
            clsGestionPersonnes gestion;
            DataTable           tableDeDonnees = new DataTable();

            switch (personne.eNiveau)
            {
            case clsPersonne.enuNiveau.iCLIENT:
                break;

            case clsPersonne.enuNiveau.iCHEF_RAYON:
                gestion        = new clsGestionChefRayon();
                tableDeDonnees = gestion.RecupererListePersonnes(personne.iID);
                break;

            case clsPersonne.enuNiveau.iSUPERVISEUR:
                gestion        = new clsGestionSuperviseur();
                tableDeDonnees = gestion.RecupererListePersonnes(personne.iID);
                break;

            default:
                break;
            }

            if (tableDeDonnees == null || tableDeDonnees.Rows.Count <= 0)
            {
                return(resultat);
            }

            foreach (DataRow item in tableDeDonnees.Rows)
            {
                resultat.Add(Convert.ToInt32(item[0]));
            }

            return(resultat);
        }