예제 #1
0
        /// <summary>
        /// Affichage du Propriétaire de l'Animal : Nom du client correspondant à l'animal courant
        /// </summary>
        private void AfficherPropriétaire()
        {
            Client proprietaire = MgtClient.GetClient(AnimalCourant.client);

            richTBox_Dossier.AppendText(Environment.NewLine);
            richTBox_Dossier.AppendText("  ", Color.Navy, 12, false, true, false);
            richTBox_Dossier.AppendText("Propriétaire : ", Color.Navy, 12, false, true, false);
            richTBox_Dossier.AppendText(proprietaire.nomPrenom, Color.RoyalBlue, 12, false, true, false);
            richTBox_Dossier.AppendText(Environment.NewLine);
        }
예제 #2
0
 /// <summary>
 /// Vérifie que tous les champs ont été remplis, si oui, ajout du Client dans la Base de Données
 /// </summary>
 private void BTN_Valider_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(TBox_Nom.Text.Trim()))
     {
         errorSaisie.SetError(TBox_Nom, "Veuillez saisir un Nom.");
     }
     else
     {
         if (String.IsNullOrEmpty(TBox_Prénom.Text.Trim()))
         {
             errorSaisie.SetError(TBox_Prénom, "Veuillez saisir un Prénom.");
         }
         else
         {
             if (String.IsNullOrEmpty(TBox_Adresse1.Text.Trim()))
             {
                 errorSaisie.SetError(TBox_Adresse1, "Veuillez saisir une Adresse.");
             }
             else
             {
                 if (String.IsNullOrEmpty(TBox_CodePostal.Text.Trim()))
                 {
                     errorSaisie.SetError(TBox_CodePostal, "Veuillez saisir un Code Postal.");
                 }
                 else
                 {
                     if (String.IsNullOrEmpty(TBox_Ville.Text.Trim()))
                     {
                         errorSaisie.SetError(TBox_Ville, "Veuillez saisir une Ville.");
                     }
                     else
                     {
                         try
                         {
                             String numTel = "";
                             if (!String.IsNullOrEmpty(TBox_Adresse1.Text.Trim()))
                             {
                                 numTel = TBox_Num1.Text + "." + TBox_Num2.Text + "." + TBox_Num3.Text + "." + TBox_Num4.Text + "." + TBox_Num5.Text;
                             }
                             Client newClient  = new Client(new Guid(), TBox_Nom.Text.ToUpper(), TBox_Prénom.Text, TBox_Adresse1.Text, TBox_CodePostal.Text, TBox_Ville.Text, numTel, TBox_Assurance.Text.ToUpper(), TBox_Email.Text, "", false, TBox_Adresse2.Text);
                             Guid   codeClient = MgtClient.CreateClient(newClient);
                             Reset();
                             ClientCourant = MgtClient.GetClient(codeClient);
                             AfficherClientCourant();
                         }
                         catch (Exception)
                         {
                             MessageBox.Show("Erreur lors de la création du Client...");
                         }
                     }
                 }
             }
         }
     }
 }
        /// <summary>
        /// Affichage des éléments correspondants aux critères et recherche
        /// </summary>
        private void BTN_Rechercher_Click(object sender, EventArgs e)
        {
            bool isTrouve = false;

            foreach (Animal unAnimal in MgtAnimal.GetAnimals())
            {
                if ((unAnimal.nomAnimal.ToLower().Contains(TBox_Recherche.Text.Trim().ToLower()) || unAnimal.tatouage.ToLower().Contains(TBox_Recherche.Text.Trim().ToLower())) && isTrouve == false)
                {
                    isTrouve = true;
                    Client leClient = MgtClient.GetClient(unAnimal.client);
                    CBox_Client.SelectedIndex = CBox_Client.FindStringExact(leClient.nomPrenom);
                    CBox_Animal.SelectedIndex = CBox_Animal.FindStringExact(unAnimal.ToString());
                }
            }
            if (!isTrouve)
            {
                MessageBox.Show("Aucun Animal ne corespond à vos critères de recherche !");
            }
        }