コード例 #1
0
        /// <summary>
        /// Clôture un emprunt.
        /// </summary>
        /// <param name="XtdEmpruntToClose"></param>
        private void EndEmprunt(EmpruntXtd XtdEmpruntToClose)
        {
            //ServiceReference.Emprunt EmpruntToClose = new ServiceReference.Emprunt();
            //EmpruntToClose.Id = XtdEmpruntToClose.Id;
            //EmpruntToClose.ReturnDte = DateTime.Now.Date;
            ServiceReference.IadminServiceClient sClient = new ServiceReference.IadminServiceClient();

            try
            {
                sClient.CloseEmprunt(XtdEmpruntToClose.Id, XtdEmpruntToClose.LastModified);
                SetMessage("Emprunt clôturé !");
                _emprunts.Remove(XtdEmpruntToClose);
                _bsDgvEmprunts.ResetBindings(false);
            }
            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 clôture de l'emprunt ! : \n {0}", e.Message), "Erreur",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
ファイル: DAL.cs プロジェクト: FrederikRonse/EPHEC-SGBD2017
        /// <summary>
        /// Récupère les retards.
        ///
        /// </summary>
        /// <param name="libId"></param>
        /// <param name="referenceDate"></param>
        /// <returns></returns>
        internal static List <Emprunt> GetRetards(int affId) //, DateTime referenceDate = default(DateTime)
        {
            List <Emprunt> _Retards = new List <Emprunt>();

            try
            {
                using (AffiliateServiceClient _sClient = new AffiliateServiceClient())
                {
                    _Retards = _sClient.GetRetards(affId).ToList();
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException endpointEx)
            {
                int cstmErrorN = 9; // "End point not found! Vérifiez que le serveur est lancé."
                CstmError.Display(new CstmError(cstmErrorN, endpointEx));
            }
            catch (System.ServiceModel.FaultException <ServiceReference.CustomFault> Fault)
            {
                CstmError.Display(Fault.Message);
            }
            catch (CstmError cstmError)
            {
                CstmError.Display(cstmError);
            }
            catch (Exception e)
            {
                CstmError.Display(new CstmError(7, e)); //Un problème est survenu à la récupération des données !
            }
            return(_Retards);
        }
コード例 #3
0
ファイル: DAL.cs プロジェクト: FrederikRonse/EPHEC-SGBD2017
        /// <summary>
        /// Retourne le tarif d'une bibliothèque (ne prend que le premier).
        /// </summary>
        /// <param name="idLib"></param>
        /// <returns></returns>
        internal static Tarif getTarif(int idLib)
        {
            Tarif _tarifToReturn = new Tarif();

            try
            {
                using (AffiliateServiceClient _sClient = new AffiliateServiceClient())
                {
                    _tarifToReturn = _sClient.GetTarifsByLib(idLib)[0];
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException endpointEx)
            {
                int cstmErrorN = 9; // "End point not found! Vérifiez que le serveur est lancé."
                CstmError.Display(new CstmError(cstmErrorN, endpointEx));
            }
            catch (System.ServiceModel.FaultException <ServiceReference.CustomFault> Fault)
            {
                CstmError.Display(Fault.Message);
            }
            catch (CstmError cstmError)
            {
                CstmError.Display(cstmError);
            }
            catch (Exception e)
            {
                CstmError.Display(new CstmError(7, e)); //Un problème est survenu à la récupération des données !
            }
            return(_tarifToReturn);
        }
コード例 #4
0
 /// <summary>
 /// retorune tous les livres (juste pour cet exercice).
 /// </summary>
 private void GetAllVolumes()
 {
     try
     {
         List <Volume> volumes = DAL.GetAllVolumes().ToList();
         if (volumes.Count() >= 1)
         {
             _volumes = volumes;
         }
         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);
     }
 }
コード例 #5
0
ファイル: DAL.cs プロジェクト: FrederikRonse/EPHEC-SGBD2017
 /// <summary>
 /// Ajout d'une "réservation".
 /// </summary>
 /// <param name="cardNum"></param>
 /// <param name="volume_Id"></param>
 internal static void AddToWishList(int cardNum, int volume_Id)
 {
     try
     {
         using (AffiliateServiceClient _sClient = new AffiliateServiceClient())
         {
             _sClient.AddWishListItem(cardNum, volume_Id);
         }
     }
     catch (System.ServiceModel.EndpointNotFoundException endpointEx)
     {
         int cstmErrorN = 9; // "End point not found! Vérifiez que le serveur est lancé."
         CstmError.Display(new CstmError(cstmErrorN, endpointEx));
     }
     catch (System.ServiceModel.FaultException <ServiceReference.CustomFault> Fault)
     {
         CstmError.Display(Fault.Message);
     }
     catch (CstmError cstmError)
     {
         CstmError.Display(cstmError);
     }
     catch (Exception e)
     {
         CstmError.Display(new CstmError(12, e)); // "erreur à l'ajout..."
     }
 }
コード例 #6
0
        /// <summary>
        /// Ajoute un exemplaire à la base de données.
        /// </summary>
        /// <param name="item"></param>
        private void AddItem(ServiceReference.Item item)
        {
            ServiceReference.IadminServiceClient sClient = new ServiceReference.IadminServiceClient();

            try
            {
                sClient.AddItem(item);
                SetMessage("Exemplaire ajouté !");
            }
            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 à l'ajout : \n {0}", e.Message), "Erreur",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #7
0
 /// <summary>
 /// Récupère la wishlist de l'affilié.
 /// </summary>
 /// <param name="cardNum"></param>
 private void GetWishList(int cardNum)
 {
     try
     {
         List <WishListItem> wishlist = DAL.GetWishList(cardNum);
         if (wishlist != null)
         {
             _wishList = wishlist;
         }
         else
         {
             int cstmErrorN = 16; //"Ce lecteur n'a pas d'emprunts en cours."
             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);
     }
 }
コード例 #8
0
ファイル: DAL.cs プロジェクト: FrederikRonse/EPHEC-SGBD2017
        /// <summary>
        /// Renvoie la whislist de l'affilié.
        /// </summary>
        /// <param name="cardNum"></param>
        /// <returns></returns>
        internal static List <WishListItem> GetWishList(int cardNum)
        {
            List <WishListItem> _wishList = new List <WishListItem>();

            try
            {
                using (AffiliateServiceClient _sClient = new AffiliateServiceClient())
                {
                    _wishList = _sClient.GetWishListByCardNum(cardNum).ToList();
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException endpointEx)
            {
                int cstmErrorN = 9; // "End point not found! Vérifiez que le serveur est lancé."
                CstmError.Display(new CstmError(cstmErrorN, endpointEx));
            }
            catch (System.ServiceModel.FaultException <ServiceReference.CustomFault> Fault)
            {
                CstmError.Display(Fault.Message);
            }
            catch (CstmError cstmError)
            {
                CstmError.Display(cstmError);
            }
            catch (Exception e)
            {
                CstmError.Display(new CstmError(7, e)); //Un problème est survenu à la récupération des données !
            }
            return(_wishList);
        }
コード例 #9
0
 /// <summary>
 /// Retourne les retards d'une librairie
 /// </summary>
 /// <param name="libId"></param>
 /// <param name="referenceDate"></param>
 private void GetRetardsByLib(int libId, DateTime referenceDate = default(DateTime))
 {
     ServiceReference.IadminServiceClient sClient = new ServiceReference.IadminServiceClient();
     if (referenceDate == default(DateTime))
     {
         referenceDate = DateTime.Now.Date;
     }
     try
     {
         List <ServiceReference.Emprunt> retards = sClient.GetRetards(referenceDate, libId).ToList();
         if (retards.Count() >= 1)
         {
             foreach (ServiceReference.Emprunt baseEmprunt in retards)
             {
                 EmpruntFull newEmprunt = new EmpruntFull(baseEmprunt);
                 SetNames(ref newEmprunt);
                 _retards.Add(newEmprunt);
             }
             _bsDataGridView.DataSource = null;
             _bsDataGridView.DataSource = _retards;
             dataGridView1.DataSource   = _bsDataGridView;
             SetMessage(string.Format("Retards de la {0} ajoutés.", _libraries.Find(l => l == comboBoxLibChoice.SelectedItem).Name));
         }
         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);
     }
 }
コード例 #10
0
        /// <summary>
        /// Remplace la liste d'emprunts par un emprunt
        /// selon le code de l'exemplaire.
        /// </summary>
        /// <param name="code"></param>
        private void GetEmpruntbyCode(string code)
        {
            AffiliateServiceClient sClient = new AffiliateServiceClient();

            try
            {
                vEmpruntDetail baseEmprunt = sClient.GetEmpruntByCode(code);
                if (baseEmprunt.IdEmprunt != 0)
                {
                    EmpruntXtd newEmprunt = new EmpruntXtd(baseEmprunt);
                    _emprunts.Clear();
                    _emprunts.Add(newEmprunt);

                    _bsDgvEmprunts.DataSource = null;
                    _bsDgvEmprunts.DataSource = _emprunts;
                    dgvEmprunts.DataSource    = _bsDgvEmprunts;
                }
                else
                {
                    MessageBox.Show(string.Format("Le code d'exemplaire {0}\n n'a rien retourné !", code.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 <ClientAffiliate.ServiceReference1.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);
            }
        }
コード例 #11
0
        /// <summary>
        /// Récupère la liste des emprunts de l'affilié.
        /// </summary>
        /// <param name="affilateId"></param>
        private void GetEmprunts(int affilateId)
        {
            AffiliateServiceClient sClient = new AffiliateServiceClient();

            try
            {
                List <vEmpruntDetail> emprunts = sClient.GetEmpruntsByAffiliate(affilateId).ToList();
                if (emprunts.Count() >= 1)
                {
                    foreach (vEmpruntDetail baseEmprunt in emprunts)
                    {
                        EmpruntXtd newEmprunt = new EmpruntXtd(baseEmprunt);
                        _emprunts.Add(newEmprunt);
                    }

                    _bsDgvEmprunts.DataSource = null;
                    _bsDgvEmprunts.DataSource = _emprunts;
                    dgvEmprunts.DataSource    = _bsDgvEmprunts;
                }
            }
            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 <ClientAffiliate.ServiceReference1.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);
            }
        }
コード例 #12
0
        /// <summary>
        /// Récupère un lecteur d'après son ID.
        /// </summary>
        /// <param name="id"></param>
        private void GetAffiliate(int id)
        {
            AffiliateServiceClient sClient = new AffiliateServiceClient();

            try
            {
                vAffiliate lecteur = sClient.GetAffiliateById(id);

                if (lecteur.CardNum != 0)
                {
                    _affiliate = lecteur;
                    SetAffiliate();
                    GetAllVolumes();
                }
                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 <ClientAffiliate.ServiceReference1.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);
            }
        }
コード例 #13
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);
     }
 }
コード例 #14
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);
            }
        }
コード例 #15
0
        /// <summary>
        /// Récupère un lecteur d'après son nom et prénom.
        /// </summary>
        /// <param name="firstName"></param>
        /// <param name="lastName"></param>
        private void GetAffiliate(string firstName, string lastName)
        {
            AffiliateServiceClient sClient = new AffiliateServiceClient();

            try
            {
                vAffiliate lecteur = sClient.GetAffiliateByName(firstName, lastName);

                if (lecteur.CardNum != 0)
                {
                    _affiliate = lecteur;
                    SetAffiliate();
                }
                else
                {
                    MessageBox.Show(string.Format("la combinaison du prénom \"{0}\" et nom \"{1}\" n'a rien retourné !", firstName, lastName), "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 <ClientAffiliate.ServiceReference1.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);
            }
        }
コード例 #16
0
        /// <summary>
        /// Assigne les nom et prénom d'un lecteur à un retard (empruntfull).
        /// </summary>
        /// <param name="retard"></param>
        private void SetNames(ref EmpruntFull retard)
        {
            ServiceReference.Affiliate           affiliate = new ServiceReference.Affiliate();
            ServiceReference.IadminServiceClient sClient   = new ServiceReference.IadminServiceClient();
            try
            {
                ServiceReference.Affiliate lecteur = sClient.GetAffiliateById(retard.CardNum);

                if (lecteur.CardNum != 0)
                {
                    retard.FirstName = lecteur.FirstName;
                    retard.LastName  = lecteur.LastName;
                }
                else
                {
                    MessageBox.Show(string.Format("Une erreur s'est produite en récupérant le lecteur \n pour le retard de {0} !", retard.VolumeTitle), "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);
            }
        }
コード例 #17
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);
     }
 }
コード例 #18
0
        /// <summary>
        /// Charge toutes les librairies pour le choix de la librairie active.
        /// </summary>
        private void SetAllLibraries()
        {
            AffiliateServiceClient sClient = new AffiliateServiceClient();

            try
            {
                List <vLibrary> 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 <ClientAffiliate.ServiceReference1.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);
            }
        }
コード例 #19
0
        /// <summary>
        /// Charge la liste des auteurs déjà existants dans la DB pour choix
        /// lors d'ajout d'un volume.
        /// </summary>
        private void SetAllAuthors()
        {
            ServiceReference.IadminServiceClient sClient = new ServiceReference.IadminServiceClient();

            try
            {
                List <ServiceReference.Author> authors = sClient.GetAllAuthorsNames().ToList();
                if (authors != null)
                {
                    _dBAuthors = authors;
                }
                else
                {
                    MessageBox.Show("La liste des auteurs n'a pas pu être récupérée !", "Une erreur est survenue",
                                    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);
            }
        }
コード例 #20
0
        /// <summary>
        /// Etabli la liste des preemprunts
        /// en récupérant les exemplaires et des infos supplémentaires.
        /// [!] .ItemCode est utilisé pour stocker l'Id du tarif
        /// pour la méthode d'enregistrement d'un emprunt.
        /// </summary>
        private void SetPreEmpList()
        {
            // Récupération des exemplaires
            List <Item> items = DAL.GetItems((int)_volume.Id).ToList();

            if (items.Count() >= 1)
            {
                _exemplaires = items;
            }
            else
            {
                int cstmErrorN = 15; //" Cet ouvrage n'a pas d'exemplaire !"
                CstmError.Display(new CstmError(cstmErrorN));
            }
            //Création et remplissage des preemps.
            // Récupération des noms de bibliothèques et des tarifs correspondants.
            // .ItemCode est utilisé pour stocker l'Id du tarif pour la méthode d'enregistrement d'un emprunt.
            foreach (Item item in _exemplaires)
            {
                Emprunt preEmp = new Emprunt();
                preEmp.CardNum     = _currentUser.CardNum;
                preEmp.ItemId      = item.Id;
                preEmp.VolumeTitle = _volume.Title;
                preEmp.LibraryId   = item.LibraryId;

                Library empLib   = _parentForm._libraries.SingleOrDefault(l => l.Id == item.LibraryId);
                Tarif   empTarif = DAL.getTarif(empLib.Id);
                preEmp.LibraryName  = empLib.Name.ToString();
                preEmp.ItemCode     = empTarif.Id.ToString();
                preEmp.TarifName    = empTarif.Name;
                preEmp.Fee          = empTarif.Fee;
                preEmp.Duration     = empTarif.Duration;
                preEmp.DailyPenalty = empTarif.DailyPenalty;

                _LstPreEmprunts.Add(preEmp);
            }
        }
コード例 #21
0
        private void GetAllVolumes()
        {
            AffiliateServiceClient sClient = new AffiliateServiceClient();

            try
            {
                List <vVolume> volumes = sClient.GetAllVolumes().ToList();
                if (volumes.Count() >= 1)
                {
                    _allVolumes = volumes;

                    _bsDgvEmprunts.DataSource = null;
                    _bsDgvEmprunts.DataSource = _allVolumes;
                    dgvEmprunts.DataSource    = _bsDgvEmprunts;
                }
            }
            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 <ClientAffiliate.ServiceReference1.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);
            }
        }