}       //	loadTabData

        /// <summary>
        /// log Access
        /// </summary>
        private void LogAccess()
        {
            MSession session = MSession.Get(_vo.GetCtx(), true);

            session.WindowLog(_vo.GetCtx().GetAD_Client_ID(), _vo.GetCtx().GetAD_Org_ID(),
                              GetAD_Window_ID(), 0);
        }       //
Esempio n. 2
0
        /// <summary>
        /// Retrieve existing session
        /// createNew create if not found
        /// </summary>
        /// <param name="ctx"></param>
        /// <returns>session or null if session was ended or does not exist</returns>
        /// <witer>Raghu</witer>
        /// <date>08-March-2011</date>
        public static MSession Get(Ctx ctx)
        {
            int      AD_Session_ID = ctx.GetContextAsInt("#AD_Session_ID");
            MSession session       = null;

            if (AD_Session_ID > 0)
            {
                session = s_sessions.Get(ctx, Util.GetValueOfInt(AD_Session_ID));
                if (session == null)
                {
                    session = new MSession(ctx, AD_Session_ID, null);
                    if (session.GetAD_Session_ID() != AD_Session_ID)
                    {
                        session = null;
                    }
                }
            }
            if (session == null)
            {
                s_log.Fine("No Session");
            }
            else if (session.IsProcessed())
            {
                s_log.Log(Level.WARNING, "Session Processed=" + session);
                s_sessions.Remove(AD_Session_ID);
                return(null);
            }
            return(session);
        }
        }       //	get

        /// <summary>
        /// Get existing or create local session
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="createNew">create if not found</param>
        /// <param name="requestAddr">Request address</param>
        /// <returns>session</returns>
        public static MSession Get(Ctx ctx, Boolean createNew, String requestAddr)
        {
            int      AD_Session_ID = ctx.GetContextAsInt("#AD_Session_ID");
            MSession session       = null;

            if (AD_Session_ID > 0)
            {
                session = cache[AD_Session_ID];
            }

            if (session == null && AD_Session_ID > 0)
            {
                // check from DB
                session = new MSession(ctx, AD_Session_ID, null);
                if (session.Get_ID() != AD_Session_ID)
                {
                    session = null;
                }
                else
                {
                    cache.Add(AD_Session_ID, session);
                }
            }

            if (session != null && session.IsProcessed())
            {
                s_log.Log(Level.WARNING, "Session Processed=" + session);

                cache.Remove(AD_Session_ID);
                session = null;
            }


            if (session == null && createNew)
            {
                session = new MSession(ctx, null);      //	local session
                if (!string.IsNullOrEmpty(requestAddr))
                {
                    session.SetRequest_Addr(requestAddr);
                }
                session.Save();
                AD_Session_ID = session.GetAD_Session_ID();
                ctx.SetContext("#AD_Session_ID", AD_Session_ID.ToString());
                cache.Add(AD_Session_ID, session);
            }

            if (session == null)
            {
                s_log.Fine("No Session");
            }

            return(session);
        }
        public static MSession Get(Ctx ctx, String SessionType, bool createNew, String Remote_Addr, String Remote_Host, String WebSession)
        {
            int      AD_Session_ID = ctx.GetContextAsInt("#AD_Session_ID");
            MSession session       = null;

            if (AD_Session_ID > 0)
            {
                session = s_sessions.Get(ctx, AD_Session_ID);
                if (session == null)
                {
                    session = new MSession(ctx, AD_Session_ID, null);
                }
                if (session.IsProcessed())
                {
                    s_log.Log(Level.WARNING, "Processed=" + session, new ArgumentException("Processed"));
                    s_sessions.Remove(AD_Session_ID);
                    return(null);
                }
            }
            if (session == null)
            {
                if (createNew)
                {
                    session = new MSession(ctx, SessionType, Remote_Addr, Remote_Host, null);
                    session.Save();
                    AD_Session_ID = session.GetAD_Session_ID();
                    ctx.SetContext("#AD_Session_ID", AD_Session_ID);
                    cache.Add(AD_Session_ID, session);
                    if (s_sessions.ContainsKey(AD_Session_ID))
                    {
                        s_sessions[AD_Session_ID] = session;
                    }
                    else
                    {
                        s_sessions.Add(AD_Session_ID, session);
                    }
                }
                else
                {
                    s_log.Warning("No Session!");
                }
            }
            return(session);
        }   //	get
        /// <summary>
        /// Get existing or create remote session
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="Remote_Addr">remote address</param>
        /// <param name="Remote_Host">remote host</param>
        /// <param name="WebSession">web session</param>
        /// <returns>session</returns>
        public static MSession Get(Ctx ctx, String remoteAddr, String remoteHost, String WebSession)
        {
            int      AD_Session_ID = ctx.GetContextAsInt("#AD_Session_ID");
            MSession session       = null;

            if (AD_Session_ID > 0)
            {
                session = cache[AD_Session_ID];
            }
            if (session == null)
            {
                session = new MSession(ctx, remoteAddr, remoteHost, WebSession, null);  //	remote session
                session.Save();
                AD_Session_ID = session.GetAD_Session_ID();
                ctx.SetContext("#AD_Session_ID", AD_Session_ID.ToString());
                cache.Add(AD_Session_ID, session);
            }
            return(session);
        }
Esempio n. 6
0
        /// <summary>
        /// Get existing or create local session
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="createNew">create if not found</param>
        /// <returns>session</returns>
        public static MSession Get(Ctx ctx, Boolean createNew)
        {
            int      AD_Session_ID = ctx.GetContextAsInt("#AD_Session_ID");
            MSession session       = null;

            if (AD_Session_ID > 0)
            {
                session = cache[AD_Session_ID];
            }

            if (session == null && createNew)
            {
                session = new MSession(ctx, null);      //	local session
                session.Save();
                AD_Session_ID = session.GetAD_Session_ID();
                ctx.SetContext("#AD_Session_ID", AD_Session_ID.ToString());
                cache.Add(AD_Session_ID, session);
            }
            return(session);
        }       //	get