private void LoadFicheLivre(DemandeReservationBO pDemandeReservation) { CreateFicheLivreReservation(); var refLivreIFac = new ReservationIFACClient(); AsyncGuiReservationSelectByDemandeReservationId asyncExecute = refLivreIFac.SelectEnCoursValidByReservationId; try { asyncExecute.BeginInvoke(CGlobalCache.SessionManager.Token, pDemandeReservation.DemandeReservationId, xx => { var samplePersDelegate = (AsyncGuiReservationSelectByDemandeReservationId)((AsyncResult)xx).AsyncDelegate; var objReservationResult = samplePersDelegate.EndInvoke(xx); if (_ficheDeLivreReservation == null) { refLivreIFac.Close(); return; } _ficheDeLivreReservation.SetFicheDeLivre(pDemandeReservation, objReservationResult); refLivreIFac.Close(); }, null); } catch(Exception) { refLivreIFac.Close(); MessageBox.Show(Resources.DashboardManager_loadFicheLivre_Erreur_lors_de_la_recuperation_des_informations_sur_le_livre_demande_); } }
public static Boolean LoadCache(FrmMdi pFrmMdi) { var bReturn = true; PersonneIFACClient personneIFac = null; EmpruntIFACClient empruntIFac = null; ClientIFACClient clientIFac = null; PersonneIFACClient personneIFacById = null; RefLivreIFACClient refLivreIFacSelectAll = null; LivreIFACClient livreIFacSelectAll = null; LivreIFACClient livreIFacSelectByBliotheque = null; LivreStatusIFACClient livreStatusIFacSelectAll = null; BibliothequeIFACClient bibliothequeIFacSelectAll = null; DemandeReservationIFACClient demandeReservationIFacByClient = null; ReservationIFACClient reservationIfacClient = null; ItemIFACClient itemIfacClient = null; try { _ofrmMdi = pFrmMdi; personneIFac = new PersonneIFACClient(); //AsyncGuiPersonne selectGuiSamplePersonneDelegate = personneIFac.SelectAll; var selectGuiSamplePersonneDelegate = new AsyncGuiPersonne(personneIFac.SelectAll); selectGuiSamplePersonneDelegate.BeginInvoke(SessionManager.Token, PersonneResults, null); empruntIFac = new EmpruntIFACClient(); AsyncGuiEmpruntSelectAll selectGuiSampleEmpruntSelectAll = empruntIFac.SelectAll; selectGuiSampleEmpruntSelectAll.BeginInvoke(SessionManager.Token, EmpruntSelectAllResult, null); //personneIFacById = new PersonneIFACClient(); //var selectGuiSamplePersonneByIdDelegate = new AsyncGuiPersonneById(personneIFacById.SelectById); //selectGuiSamplePersonneByIdDelegate.BeginInvoke(SessionManager.Token, 1, PersonneByIdResult, null); //var selectGuiSamplePersonneByNameDelegate = new AsyncGuiPersonneByName(personneIFac.SelectByName); //selectGuiSamplePersonneByNameDelegate.BeginInvoke("toto", PersonneByNameResult, null); clientIFac = new ClientIFACClient(); var selectGuiSampleClientDelegate = new AsyncGuiClient(clientIFac.SelectAll); selectGuiSampleClientDelegate.BeginInvoke(SessionManager.Token, ClientResults, null); refLivreIFacSelectAll = new RefLivreIFACClient(); var selectGuiSampleRefLivreDelegate = new AsyncGuiRefLivreSelectAll(refLivreIFacSelectAll.SelectAll); selectGuiSampleRefLivreDelegate.BeginInvoke(SessionManager.Token, RefLivreSelectAllResult, null); livreIFacSelectAll = new LivreIFACClient(); var selectGuiSampleLivreDelegate = new AsyncGuiLivreSelectAll(livreIFacSelectAll.SelectAll); selectGuiSampleLivreDelegate.BeginInvoke(SessionManager.Token, LivreSelectAllResult, null); livreIFacSelectByBliotheque = new LivreIFACClient(); AsyncGuiLivreSelectByBibliotheque selectGuiSampleLivreByBibliothequeDelegate = livreIFacSelectByBliotheque.SelectByBibliotheque; selectGuiSampleLivreByBibliothequeDelegate.BeginInvoke(SessionManager.Token, SessionManager.Personne.Client.Bibliotheque, LivreSelectByBibliothequeResult, null); demandeReservationIFacByClient = new DemandeReservationIFACClient(); ASyncGuiDemandeReservationSelectByClient selectGuiSampleNewDemandeReservationByClientDelegate = demandeReservationIFacByClient.SelectNewByClient; selectGuiSampleNewDemandeReservationByClientDelegate.BeginInvoke(SessionManager.Token, SessionManager.Personne.Client, NewDemandeReservationResults, null); ASyncGuiDemandeReservationSelectByClient selectGuiSampleOldDemandeReservationByClientDelegate = demandeReservationIFacByClient.SelectOldByClient; selectGuiSampleOldDemandeReservationByClientDelegate.BeginInvoke(SessionManager.Token, SessionManager.Personne.Client, OldDemandeReservationResults, null); AyncGuiEmpruntSelectAllByClientId selectGuiSampleEmpruntDelegate = empruntIFac.SelectEmpruntByClientId; selectGuiSampleEmpruntDelegate.BeginInvoke(SessionManager.Token, SessionManager.PersonneId ,EmpruntResults, null); reservationIfacClient = new ReservationIFACClient(); AsyncGuiReservationSelectEnCoursValidByClientId selectGuiSampleReservationEnCoursValidByClientIdDelegate = reservationIfacClient.SelectEnCoursValidByClientId; selectGuiSampleReservationEnCoursValidByClientIdDelegate.BeginInvoke(SessionManager.Token, SessionManager.PersonneId, ReservationSelectValidByClientIdResult, null); AsyncGuiReservationSelectAll selectGuiSampleReservationDelegate = reservationIfacClient.SelectAll; selectGuiSampleReservationDelegate.BeginInvoke(SessionManager.Token, ReservationResults, null); ASyncGuiDemandeReservationSelectAll selectGuiSampleDemandeReservationByClientDelegate = demandeReservationIFacByClient.SelectAll; selectGuiSampleDemandeReservationByClientDelegate.BeginInvoke(SessionManager.Token, DemandeReservationResults, null); if (SessionManager.IsAdministrateur){ itemIfacClient = new ItemIFACClient(); AsyncGuiItemSelectByAdministrateurId selectGuiSampleItemByAdministrateurId = itemIfacClient.SelectByAdministrateurId; selectGuiSampleItemByAdministrateurId.BeginInvoke(SessionManager.Token, SessionManager.Personne.Administrateur.AdministrateurId, ItemSelectByAdministrateurIdResult, null); } else { _ofrmMdi.SetLoadingText(@"Item"); DecrementILock(); } livreStatusIFacSelectAll = new LivreStatusIFACClient(); var selectGuiSampleLivreStatusDelegate = new ASyncGuiLivreStatusSelectAll(livreStatusIFacSelectAll.SelectAll); selectGuiSampleLivreStatusDelegate.BeginInvoke(SessionManager.Token, LivreStatusSelecAllResult, null); bibliothequeIFacSelectAll = new BibliothequeIFACClient(); var selectGuiSampleBibliothequeDelegate = new ASyncGuiBibliothequeSelectAll(bibliothequeIFacSelectAll.SelectAll); selectGuiSampleBibliothequeDelegate.BeginInvoke(SessionManager.Token, BibliothequeSelectAllResult, null); while (!AutoEvent.WaitOne(50, true)) { Application.DoEvents(); } } catch (Exception) { bReturn = false; } finally { if (personneIFac != null) { personneIFac.Close(); } if (empruntIFac != null) { empruntIFac.Close(); } if (clientIFac != null) { clientIFac.Close(); } if (personneIFacById != null) { personneIFacById.Close(); } if (refLivreIFacSelectAll != null) { refLivreIFacSelectAll.Close(); } if (livreIFacSelectAll != null) { livreIFacSelectAll.Close(); } if (livreIFacSelectByBliotheque != null) { livreIFacSelectByBliotheque.Close(); } if (livreStatusIFacSelectAll != null) { livreStatusIFacSelectAll.Close(); } if (bibliothequeIFacSelectAll != null) { bibliothequeIFacSelectAll.Close(); } if (demandeReservationIFacByClient != null) { demandeReservationIFacByClient.Close(); } if (reservationIfacClient != null){ reservationIfacClient.Close(); } _ofrmMdi.DecrementILockMdi(); } return bReturn; }
private void ConfirmReservation(DemandeReservationBO objDemandeReservation, Action<ReservationBO> callbackAction) { var reservationIFacClient = new ReservationIFACClient(); AsyncGuiReservationSelectByDemandeReservationId insertGuiSampleDemandeReservationDelegate = reservationIFacClient.SelectEnCoursValidByReservationId; insertGuiSampleDemandeReservationDelegate.BeginInvoke(CGlobalCache.SessionManager.Token, objDemandeReservation.DemandeReservationId, result => { var sampleInsertDemandeReservationDelegate = (AsyncGuiReservationSelectByDemandeReservationId)((AsyncResult)result).AsyncDelegate; var objReservationResult = sampleInsertDemandeReservationDelegate.EndInvoke(result); reservationIFacClient.Close(); if (objReservationResult != null && CGlobalCache.SessionManager.IsAdministrateur) { CGlobalCache.LstReservationSelectAll.Add(objReservationResult); } if (callbackAction == null){ return; } callbackAction(objReservationResult); }, null); }
private void SearchReservationField(String pInfo) { var reservationIFac = new ReservationIFACClient(); AsyncGuiSelectReservationByInfo asyncExecute = reservationIFac.SelectEnCoursValidByInfo; try{ asyncExecute.BeginInvoke(CGlobalCache.SessionManager.Token, pInfo, result =>{ var sampleReservationDelegate = (AsyncGuiSelectReservationByInfo)((AsyncResult)result).AsyncDelegate; _lstReservationField = sampleReservationDelegate.EndInvoke(result); if (_lstReservationField.Count > 0) { _bCmbClientFieldToogle = false; var tmpReservationDatas = _lstReservationField.Select(yy => new { Key = yy.ReservationId + ": " + yy.Emprunt.Livre.ToString(), Value = yy }).ToList(); tmpReservationDatas.Insert(0, new { Key = "", Value = null as ReservationBO }); cmbReservationField.DataSource = null; cmbReservationField.DataSource = tmpReservationDatas; cmbReservationField.ValueMember = "Value"; cmbReservationField.DisplayMember = "Key"; cmbReservationField.Enabled = true; _bCmbClientFieldToogle = true; } else { cmbReservationField.DataSource = null; cmbReservationField.Enabled = false; } }, null); } catch(Exception ex){ reservationIFac.Close(); MessageBox.Show(Resources.EmpruntManagement_SearchReservationField_Erreur_lors_de_la_recuperation_des_informations_sur_la_reservation_demandee); } }