Esempio n. 1
0
 /// <summary>
 /// Retourne le lecteur connecté par son id (N° de carte).
 /// </summary>
 /// <param name="cardNum"></param>
 private void GetCurrentUser(int cardNum)
 {
     ServiceReference.AffiliateServiceClient sClient = new ServiceReference.AffiliateServiceClient();
     try
     {
         ServiceReference.Affiliate user = sClient.GetAffiliateById(cardNum);
         if (user != null)
         {
             _CurrentAffiliate = user;
         }
         else
         {
             MessageBox.Show(string.Format("le numéro de lecteur {0}\n n'a rien retourné !", cardNum), "Désolé",
                             MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         if (user.FirstName != null)
         {
             this.Text = string.Format("Bienvenue {0} !", user.FirstName);
         }
     }
     catch (System.ServiceModel.EndpointNotFoundException endpointEx)
     {
         int       cstmErrorN = 9; // "End point not found! Vérifiez que le serveur est lancé."
         CstmError cstmError  = new CstmError(cstmErrorN, endpointEx);
         CstmError.Display(cstmError);
     }
     catch (System.ServiceModel.FaultException <ServiceReference.CustomFault> Fault)
     {
         CstmError.Display(Fault.Message);
     }
     catch (CstmError cstmError)
     {
         CstmError.Display(cstmError);
     }
     catch (Exception e)
     {
         MessageBox.Show("Une exception s'est produite à la récupération des données !", "Erreur",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// (PAS UTILISE) Retourne une liste de volumes dont le titre
        /// s'approche du titre recherché.
        /// </summary>
        /// <param name="title"></param>
        private void GetVolumeListByTitle(string title)
        {
            List <ServiceReference.Volume> ListVolumes;

            ServiceReference.AffiliateServiceClient sClient = new ServiceReference.AffiliateServiceClient();

            try
            {
                List <ServiceReference.Volume> volumes = sClient.GetVolumesByTitle(title).ToList();
                if (volumes != null)
                {
                    ListVolumes = volumes;
                }
                else
                {
                    MessageBox.Show("Le titre  \"{0}\"\n n'a rien retourné !", title,
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException endpointEx)
            {
                int       cstmErrorN = 9; // "End point not found! Vérifiez que le serveur est lancé."
                CstmError cstmError  = new CstmError(cstmErrorN, endpointEx);
                CstmError.Display(cstmError);
            }
            catch (System.ServiceModel.FaultException <ServiceReference.CustomFault> Fault)
            {
                CstmError.Display(Fault.Message);
            }
            catch (CstmError cstmError)
            {
                CstmError.Display(cstmError);
            }
            catch (Exception e)
            {
                MessageBox.Show(string.Format("Une exception s'est produite à la récupération des données : \n {0}", e.Message), "Erreur",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Retourne un volume par son titre.
 /// </summary>
 /// <param name="titleLike"></param>
 private void GetVolumeDetailsByTitle(string titleLike)
 {
     ServiceReference.AffiliateServiceClient sClient = new ServiceReference.AffiliateServiceClient();
     try
     {
         ServiceReference.Volume volume = sClient.GetVolumeByTitle(tbTitleSearch.Text);
         if (volume.Id != null)
         {
             _currentVolume = volume;
         }
         else
         {
             MessageBox.Show(string.Format("Le titre {0}\n n'a rien retourné !", tbTitleSearch.Text), "Désolé",
                             MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         SetVolSrchInfos(true);
         SetVolInfoBox(true);
     }
     catch (System.ServiceModel.EndpointNotFoundException endpointEx)
     {
         int       cstmErrorN = 9; // "End point not found! Vérifiez que le serveur est lancé."
         CstmError cstmError  = new CstmError(cstmErrorN, endpointEx);
         CstmError.Display(cstmError);
     }
     catch (System.ServiceModel.FaultException <ServiceReference.CustomFault> Fault)
     {
         CstmError.Display(Fault.Message);
     }
     catch (CstmError cstmError)
     {
         CstmError.Display(cstmError);
     }
     catch (Exception e)
     {
         MessageBox.Show("Une exception s'est produite à la récupération des données !", "Erreur",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Récupère un lecteur d'après son ID.
        /// </summary>
        /// <param name="id"></param>
        private void GetAffiliate(int id)
        {
            ServiceReference.AffiliateServiceClient sClient = new ServiceReference.AffiliateServiceClient();
            try
            {
                ServiceReference.Affiliate lecteur = sClient.GetAffiliateById(id);

                if (lecteur.CardNum != 0)
                {
                    _affiliate = lecteur;
                    SetAffiliate();
                }
                else
                {
                    MessageBox.Show(string.Format("Le numéro de carte {0}\n n'a rien retourné !", id.ToString()), "Désolé",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException endpointEx)
            {
                int       cstmErrorN = 9; // "End point not found! Vérifiez que le serveur est lancé."
                CstmError cstmError  = new CstmError(cstmErrorN, endpointEx);
                CstmError.Display(cstmError);
            }
            catch (System.ServiceModel.FaultException <ServiceReference.CustomFault> Fault)
            {
                CstmError.Display(Fault.Message);
            }
            catch (CstmError cstmError)
            {
                CstmError.Display(cstmError);
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("Une exception s'est produite à la récupération des données : \n {0}", ex.Message), "Attention",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Charge toutes les librairies pour le choix de la librairie active.
 /// </summary>
 private void SetAllLibraries()
 {
     ServiceReference.AffiliateServiceClient sClient = new ServiceReference.AffiliateServiceClient();
     try
     {
         List <ServiceReference.Library> libraries = sClient.GetLibraries().ToList();
         if (libraries.Count() >= 1)
         {
             _libraries = libraries;
         }
         else
         {
             int cstmErrorN = 11; //"Aucun résultat ne correspond à cette recherche !"
             throw new CstmError(cstmErrorN);
         }
     }
     catch (System.ServiceModel.EndpointNotFoundException endpointEx)
     {
         int       cstmErrorN = 9; // "End point not found! Vérifiez que le serveur est lancé."
         CstmError cstmError  = new CstmError(cstmErrorN, endpointEx);
         CstmError.Display(cstmError);
     }
     catch (System.ServiceModel.FaultException <ServiceReference.CustomFault> Fault)
     {
         CstmError.Display(Fault.Message);
     }
     catch (CstmError cstmError)
     {
         CstmError.Display(cstmError);
     }
     catch (Exception e)
     {
         MessageBox.Show("Une exception s'est produite à la récupération des données !", "Erreur",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }