internal void SetFicheDeLivre(DemandeReservationBO pDemandeReservation, ReservationBO objReservationResult)
        {
            if (pDemandeReservation == null) {
                return;
            }
            lblTitre.Text = pDemandeReservation.RefLivre.Titre;
            webDescription.DocumentText = pDemandeReservation.RefLivre.Description;
            lblAuteurs.Text = pDemandeReservation.RefLivre.Auteur;
            lblPublication.Text = pDemandeReservation.RefLivre.Published.ToShortDateString();

            Action<String> getImage = (imageUrl) => {
                // Create a web request to the URL for the picture
                var webRequest = WebRequest.Create(imageUrl);
                // Execute the request synchronuously
                var webResponse = (HttpWebResponse)webRequest.GetResponse();

                // Create an image from the stream returned by the web request
                // ReSharper disable AssignNullToNotNullAttribute
                picBook.Image = new Bitmap(webResponse.GetResponseStream());
                // ReSharper restore AssignNullToNotNullAttribute
            };

            lblBibliotheque.Text = objReservationResult != null ? objReservationResult.Emprunt.Livre.Bibliotheque.ToString() : "";

            getImage(pDemandeReservation.RefLivre.ImageUrl);

            Annulation(pDemandeReservation);
        }
 internal EmpruntBO SaveEmprunt(AdministrateurBO pAdministrateurBo, PersonneBO pPersonneBo, LivreBO livreBo, ReservationBO pReservationBo)
 {
     var empruntIFac = new EmpruntIFACClient();
     return pReservationBo != null ? empruntIFac.ConvertReservation(CGlobalCache.SessionManager.Token, pAdministrateurBo.AdministrateurId, pReservationBo.ReservationId) : empruntIFac.InsertEmprunt(CGlobalCache.SessionManager.Token,pAdministrateurBo.AdministrateurId , pPersonneBo.PersonneId, livreBo.LivreId);
 }
 public void SwitchToEmpruntManagement(ReservationBO objReservation)
 {
     LoadEmpruntManagement(objReservation);
 }
 public EmpruntBO SaveAnnuleReservation(AdministrateurBO pAdministrateurBo, ReservationBO pReservationBo)
 {
     var empruntIFac = new EmpruntIFACClient();
     //throw new NotImplementedException();
     return empruntIFac.InsertAnnul(CGlobalCache.SessionManager.Token, pAdministrateurBo.AdministrateurId, pReservationBo.ReservationId);
 }
        private void LoadEmpruntManagement(ReservationBO objReservation)
        {
            CreateEmpruntManagement(objReservation);
            /*
            RefLivreIFACClient refLivreIFac = new RefLivreIFACClient();

            AsyncGuiFicheDeLivreSelectForClientById asyncExecute = refLivreIFac.SelectFicheLivreForClientByRefLivreId;
            try {
                asyncExecute.BeginInvoke(CGlobalCache.SessionManager.Token, CGlobalCache.SessionManager.Personne.Client.ClientId, pDemandeReservation.RefLivreId, xx => {
                    var samplePersDelegate = (AsyncGuiFicheDeLivreSelectForClientById)((AsyncResult)xx).AsyncDelegate;
                    _actualFicheLivre = samplePersDelegate.EndInvoke(xx);
                    _ficheDeLivreReservation.setFicheDeLivre(_actualFicheLivre);
                    if (refLivreIFac != null) {
                        refLivreIFac.Close();
                    }
                }, null);
            } catch(Exception ex) {
                if (refLivreIFac != null) {
                    refLivreIFac.Close();
                }
                MessageBox.Show("Erreur lors de la récupération des informations sur le livre demandé.");
            }
            */
        }
        private void CreateEmpruntManagement(ReservationBO objReservation)
        {
            if (_empruntManagement != null) {
                return;
            }

            _empruntManagement = new EmpruntManagement(this, objReservation) {Location = new Point(panel1.Width + 20, 56)};

            if (_reservationManagement != null || _retourManagement != null) {
                if (_reservationManagement != null){
                    Controls.Remove(_reservationManagement);
                    Controls.Remove(_retourManagement);
                }
                if (_reservationManagement != null) {
                    _reservationManagement.Dispose();
                    _reservationManagement = null;
                }
                if (_retourManagement != null) {
                    _retourManagement.Dispose();
                    _retourManagement = null;
                }
            }

            var t1 = new Transition(new TransitionType_EaseInEaseOut(1000));
            t1.add(this, "Width", _dashboardWidth + _empruntManagement.Width + 10);
            t1.add(lblBibliothequeTitle, "Left", _lblBibliothequeTitleLocationX + _empruntManagement.Width + 10);
            t1.add(cmbBibliotheque, "Left", _cmbBibliothequeLocationX + _empruntManagement.Width + 10);

            Controls.Add(_empruntManagement);

            t1.run();
        }
        private void dataGridDemandeReservation_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0) {
                return;
            }
            var objDataGridView = (DataGridView)sender;
            objDataGridView.Rows[e.RowIndex].Selected = true;

            if (objDataGridView.Columns[0].Name.Equals("Demande")){
                _reservationSelected = null;
                _demandeReservationSelected = CGlobalCache.LstDemandeReservationSelectAll.FirstOrDefault(xx => xx.DemandeReservationId.Equals(objDataGridView.Rows[e.RowIndex].Cells[0].Value));
                btnEmprunter.Enabled = false;
            }
            if (objDataGridView.Columns[0].Name.Equals("Reservation")){
                _demandeReservationSelected = null;
                _reservationSelected = CGlobalCache.LstReservationSelectAll.ToList().Find(xx => xx.ReservationId.Equals(objDataGridView.Rows[e.RowIndex].Cells[0].Value));
                btnEmprunter.Enabled = true;
            }
            btnAnnuler.Enabled = true;
            ShowDetailSelection();
        }
 public EmpruntManagement(DashboardAdminManager dashboardAdminManager, ReservationBO objReservation)
     : this(dashboardAdminManager)
 {
     _objReservation = objReservation;
 }