/////////////////////////////////////////////// public ISessionClientSurServeur GetSessionPrincipale() { CAuthentificationSessionSousSession auth = m_authentification as CAuthentificationSessionSousSession; if (auth != null) { ISessionClientSurServeur session = CGestionnaireSessions.GetSessionClientSurServeurStatic(auth.IdSessionPrincipale); if (session != null) { return(session.GetSessionPrincipale()); } } return(this); }
/////////////////////////////////////////////// public void CloseSession() { string strMessage = I.T("Closing session @1|110", IdSession.ToString()); try { strMessage += " " + GetInfoUtilisateur().NomUtilisateur; } catch { } CAuthentificationSessionSousSession authSousSession = m_authentification as CAuthentificationSessionSousSession; if (authSousSession != null) { ISessionClientSurServeur sessionPrinc = CGestionnaireSessions.GetSessionClientSurServeurStatic(authSousSession.IdSessionPrincipale); if (sessionPrinc != null) { sessionPrinc.RemoveSousSession(this); } } C2iEventLog.WriteInfo(strMessage, NiveauBavardage.VraiPiplette); int nIdSession = IdSession; DateTime dt = DateTime.Now; MyCloseSession(); TimeSpan sp = DateTime.Now - dt; Console.WriteLine("SessionServeur closing " + nIdSession + " / 1 : " + sp.TotalMilliseconds); CGestionnaireObjetsAttachesASession.OnCloseSession(IdSession); sp = DateTime.Now - dt; Console.WriteLine("SessionServeur closing " + nIdSession + " / 2 : " + sp.TotalMilliseconds); CGestionnaireSessions.CloseSession(this); sp = DateTime.Now - dt; Console.WriteLine("SessionServeur closing " + nIdSession + " / 3 : " + sp.TotalMilliseconds); CGestionnaireObjetsAttachesASession.OnCloseSession(IdSession); //Si jamais le close sessino a réaloué des éléments sp = DateTime.Now - dt; Console.WriteLine("SessionServeur closing " + nIdSession + " / 4 : " + sp.TotalMilliseconds); m_sponsor.Unregister(m_sessionSurClient); sp = DateTime.Now - dt; Console.WriteLine("SessionServeur closing " + nIdSession + " / 5 : " + sp.TotalMilliseconds); m_sessionSurClient = null; }
// Notify a handler that an object has been disconnected. public void DisconnectedObject(Object obj) { if (obj is CSessionClientSurServeur) { bool bConnected = false; CSessionClientSurServeur session = (CSessionClientSurServeur)obj; try { CSessionClientSurServeur sc = CGestionnaireSessions.GetSessionClientSurServeurStatic(session.IdSession) as CSessionClientSurServeur; if (CGestionnaireSessions.IsSessionOpenStatic(session.IdSession)) { // try { //Tente de contacter la session cliente bConnected = sc == null || sc.SessionClient.IsConnected; } catch { } if (!bConnected) { string strMessage = I.T("Auto disconnection session number @1|109", session.IdSession.ToString()) + I.T("\r\n|108") + I.T("Type|107") + session.TypeApplicationCliente.ToString(); strMessage += I.T("\r\n|108") + session.DescriptionApplicationCliente; try { strMessage += I.T("\r\n|108") + session.GetInfoUtilisateur().NomUtilisateur; } catch { } C2iEventLog.WriteErreur(strMessage); } } } catch {} if (!bConnected) { session.CloseSession(); } } }
/////////////////////////////////////////////// public CSessionClientSurServeur(CSessionClient sessionSurClient) { m_sessionSurClient = sessionSurClient; IdSession = sessionSurClient.IdSession; m_dateHeureConnexion = sessionSurClient.DateHeureConnexion; m_dateHeureDerniereActivite = DateTime.Now; m_sponsor.Register(m_sessionSurClient); m_strDescription = sessionSurClient.DescriptionApplicationCliente; m_typeApplication = sessionSurClient.TypeApplicationCliente; m_authentification = sessionSurClient.Authentification; CAuthentificationSessionSousSession autSousSession = m_authentification as CAuthentificationSessionSousSession; if (autSousSession != null) { ISessionClientSurServeur sessionPrincipale = CGestionnaireSessions.GetSessionClientSurServeurStatic(autSousSession.IdSessionPrincipale); if (sessionPrincipale != null) { sessionPrincipale.RegisterSousSession(this); } } }