예제 #1
0
        public static Boolean LoadCache(FrmMdi pFrmMdi)
        {
            var bReturn = true;
            PersonneIFACClient personneIFac = null;
            EmpruntIFACClient locationIFac = null;
            ClientIFACClient clientIFac = null;
            PersonneIFACClient personneIFacById = null;

            try {
                ofrmMdi = pFrmMdi;
                personneIFac = new PersonneIFACClient();
                //AsyncGuiPersonne selectGuiSamplePersonneDelegate = personneIFac.SelectAll;
                var selectGuiSamplePersonneDelegate = new AsyncGuiPersonne(personneIFac.SelectAll);
                selectGuiSamplePersonneDelegate.BeginInvoke(PersonneResults, null);

                personneIFacById = new PersonneIFACClient();
                var selectGuiSamplePersonneByIdDelegate = new AsyncGuiPersonneById(personneIFacById.SelectById);
                selectGuiSamplePersonneByIdDelegate.BeginInvoke(1, PersonneByIdResult, null);

                //var selectGuiSamplePersonneByNameDelegate = new AsyncGuiPersonneByName(personneIFac.SelectByName);
                //selectGuiSamplePersonneByNameDelegate.BeginInvoke("toto", PersonneByNameResult, null);

                locationIFac = new EmpruntIFACClient();
                var selectGuiSampleEmpruntDelegate = new AsyncGuiEmprunt(locationIFac.SelectAll);
                selectGuiSampleEmpruntDelegate.BeginInvoke(EmpruntResults, null);

                clientIFac = new ClientIFACClient();
                var selectGuiSampleClientDelegate = new AsyncGuiClient(clientIFac.SelectAll);
                selectGuiSampleClientDelegate.BeginInvoke(ClientResults, null);

                while (!AutoEvent.WaitOne(50, true)) {
                    Application.DoEvents();
                }

            } catch (Exception) {
                bReturn = false;
            } finally {
                if (personneIFac != null) {
                    personneIFac.Close();
                }
                if (locationIFac != null) {
                    locationIFac.Close();
                }
                if (clientIFac != null) {
                    clientIFac.Close();
                }
                if (personneIFacById != null) {
                    personneIFacById.Close();
                }
                ofrmMdi.DecrementILockMDI();
            }
            return bReturn;
        }
예제 #2
0
 public FrmSplashScreen(FrmMdi pfrmMdi)
     : this()
 {
     this._oFrmMdi = pfrmMdi;
 }
        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;
        }