Beispiel #1
0
        public static ReturnKnowType Loggout(String SessionID)
        {
            SessionStructure ThisSession = SessionList.FirstOrDefault(Item => Item.SessionID == SessionID);

            if (ThisSession != null)
            {
                SessionList.Remove(ThisSession);
                return(ReturnKnowType.DefineReturn(ReturnStatus.SUCESSFUL, "Successful loggout."));
            }
            else
            {
                return(ReturnKnowType.DefineReturn(ReturnStatus.FAILED, "Can not loggout. Invalid session ID."));
            }
        }
Beispiel #2
0
        public static ReturnKnowType UserVerification(String UserLoginName, String UserLoginPassword, int SessionTimeout)
        {
            foreach (UserStrcture ThisUser in UserList)
            {
                if (ThisUser.UserLoginName == UserLoginName && ThisUser.UserLoginPassword == UserLoginPassword)
                {
                    SessionStructure ThisSession = new SessionStructure();
                    ThisSession.SessionID       = SessionGenerator(ThisUser.UserID, ThisUser.UserLoginPassword);
                    ThisSession.SessionLifeTime = SessionTimeout;

                    ThisUser.SessionID = ThisSession.SessionID;
                    SessionList.Add(ThisSession);

                    return(ReturnKnowType.DefineReturn(ReturnStatus.SUCESSFUL, null, ThisSession));
                }
            }

            return(ReturnKnowType.DefineReturn(ReturnStatus.FAILED, "Invalid UserLoginName and UserLoginPassword."));
        }