/// <summary> /// retrieve client details based on id /// assign value to textbox /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAnnuler_Click(object sender, EventArgs e) { try { if (personne == null || personne.iID <= 0) { throw new Exception(clsCommun.ErreurApplicationGeneric); } if (personne.eNiveau == clsPersonne.enuNiveau.iCLIENT) { personneTransaction = personne; } if (personneTransaction.iID > 0) { RecupererPersonneParNiveau(); if (panier == null || panier.objPersonnes == null || panier.objPersonnes.iID <= 0) { throw new Exception(clsCommun.ErreurRecupererPersonne); } } AttribuerValeur(panier); } catch (Exception ex) { MessageBox.Show(ex.Message); frmAuthentification authentification = new frmAuthentification(); authentification.Show(); this.Hide(); } }
/// <summary> /// navigate to authentication form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSeDeconnecter_Click(object sender, EventArgs e) { frmAuthentification authentification = new frmAuthentification(); authentification.Show(); this.Close(); }
/// <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(); } }
/// <summary> /// open info client with id = selected row id in grid view /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnVisualiser_Click(object sender, EventArgs e) { try { if (personne == null || personne.iID <= 0) { throw new Exception(); } if (iID <= 0) { throw new NoNullAllowedException(clsCommun.ErreurClientNonSelectionner); } frmInfoClients infoClients = new frmInfoClients(); switch (personne.eNiveau) { case clsPersonne.enuNiveau.iCLIENT: throw new Exception(); case clsPersonne.enuNiveau.iCHEF_RAYON: infoClients.Text = clsCommun.TitreModeChefRayon; break; case clsPersonne.enuNiveau.iSUPERVISEUR: infoClients.Text = clsCommun.TitreModeSuperviseur; break; default: throw new Exception(); } infoClients.personne = personne; infoClients.personneTransaction.iID = iID; infoClients.Show(); this.Close(); } catch (NoNullAllowedException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show(clsCommun.ErreurGeneriqueQuitterApplication); frmAuthentification authentification = new frmAuthentification(); authentification.Show(); this.Close(); } }
/// <summary> /// load method /// retrieve list of client based on authenticator role /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmGestionDesPersonnes_Load(object sender, EventArgs e) { try { if (personne == null || personne.iID <= 0) { throw new Exception(); } switch (personne.eNiveau) { case clsPersonne.enuNiveau.iCLIENT: throw new Exception(); case clsPersonne.enuNiveau.iCHEF_RAYON: dgDetaileClient.DataSource = RecupereListeClients(personne); break; case clsPersonne.enuNiveau.iSUPERVISEUR: dgDetaileClient.DataSource = RecupereListeClients(personne); break; default: throw new Exception(); } ConfigureDatasource(); } catch (Exception ex) { MessageBox.Show(clsCommun.ErreurGeneriqueQuitterApplication); frmAuthentification authentification = new frmAuthentification(); authentification.Show(); this.Close(); } }