public bool putUser(string requestId, user finalUser)
        {
            SessionData existingSessionData = registryService.getSessionData(requestId);

            if (existingSessionData != null)
            {
                existingSessionData.User = finalUser;

                /**
                 * Clear Division if logout
                 */
                if (finalUser == null)
                {
                    existingSessionData.Division = null;
                }

                registryService.putSession(requestId, existingSessionData);
                return(true);
            }

            return(false);
        }
Example #2
0
        public WebResponse getEvent(WebRequest webRequest, HttpRequest request, bool v)
        {
            SessionData sessionData = registryService.getSessionData(webRequest.requestId);

            if (sessionData == null || sessionData.Division == null)
            {
                return(WebResponse.failed());
            }

            int divisionId = sessionData.Division.id;

            List <BaseEntity> events = eventService.GetByMonthAndYear(webRequest.month, webRequest.year, divisionId);

            WebResponse response = WebResponse.success();

            response.entities = events;

            return(response);
        }
        public WebResponse generateAppId(string requestId)
        {
            WebResponse response = WebResponse.success();

            string RandomChar = StringUtil.GenerateRandomChar(20);

            bool exist = false;

            if (null != requestId)
            {
                SessionData sessionData = registryService.getSessionData(requestId);

                if (null != sessionData)
                {
                    RandomChar = requestId;
                    exist      = true;

                    if (sessionData.User != null)
                    {
                        response.loggedIn = true;
                    }
                }
            }

            response.message = RandomChar;

            if (!exist)
            {
                registryService.putSession(RandomChar, new SessionData()
                {
                    message     = "session_data",
                    requestDate = DateTime.Now
                });
            }

            response.debug = RegistryService.getSessions();
            return(response);
        }