private void FindBookByIsbn(String txtSearch) { if (txtSearch.Length != 10 && txtSearch.Length != 13) { MessageBox.Show(Resources.AddBookFromAmazon_FindBookByIsbn_Le_numéro_ISBN_doit_contenir_10_ou_13_chiffres); return; } var txtSearchs = new[] { txtSearch }; try { using (var refLivreProxy = new RefLivreIFACClient()) { foreach (RefLivreBO oRefLivre in refLivreProxy.FindAmazonRefByISBN(CGlobalCache.SessionManager.Token, txtSearchs.ToList())) { showBook1.SetLivre(oRefLivre); ObjRefLivre = oRefLivre; btnAccept.Enabled = true; break; } } } catch (Exception ex) { throw; } }
public static Boolean ReloadRefLivreCache() { Lock = 1; Boolean bReturn = true; RefLivreIFACClient refLivreIFacSelectAll = null; try { refLivreIFacSelectAll = new RefLivreIFACClient(); var selectGuiSampleRefLivreDelegate = new AsyncGuiRefLivreSelectAll(refLivreIFacSelectAll.SelectAll); selectGuiSampleRefLivreDelegate.BeginInvoke(SessionManager.Token, RefLivreSelectAllResult, null); while (!AutoEvent.WaitOne(50, true)) { Application.DoEvents(); } } catch (Exception) { bReturn = false; } finally { if (refLivreIFacSelectAll != null) { refLivreIFacSelectAll.Close(); } } return bReturn; }
internal Boolean InsertLivreFromAmazon(RefLivreBO objRefLivre) { List<RefLivreBO> lstRefLivre; try { using (var refLivreProxy = new RefLivreIFACClient()) { lstRefLivre = refLivreProxy.InsertLivre(CGlobalCache.SessionManager.Token, objRefLivre.ISBN, objRefLivre.Titre, objRefLivre.Description, objRefLivre.Auteur, objRefLivre.Langue, objRefLivre.Editeur, objRefLivre.Published, objRefLivre.ImageUrl); } } catch (Exception ex) { throw; } if (!lstRefLivre.Any()) { return true; } return CGlobalCache.ReloadRefLivreCache(); }
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 FindByTitre(String pSearchText) { var refLivreIfac = new RefLivreIFACClient(); ASyncGuiSelectLstRefLivreByString selectRefLivreByString = refLivreIfac.SelectByTitre; selectRefLivreByString.BeginInvoke(CGlobalCache.SessionManager.Token, pSearchText, CbFindByTitreResult, null); }