public questStatus ValidateUserSession(UserSessionId userSessionId, out UserSession userSession) { // Initialize questStatus status = null; UserSessionMgr userSessionMgr = new UserSessionMgr(this.UserSession); status = userSessionMgr.Read(userSessionId, out userSession); if (!questStatusDef.IsSuccess(status)) { return(new questStatus(status.Severity, "Invalid user session")); } return(new questStatus(Severity.Success)); }
public questStatus List(QueryOptions queryOptions, out SessionsListViewModel sessionsListViewModel) { // Initialize questStatus status = null; sessionsListViewModel = null; // List QueryResponse queryResponse = null; List <Quest.Functional.ASM.UserSession> userSessionList = null; UserSessionMgr userSessionMgr = new UserSessionMgr(this.UserSession); status = userSessionMgr.List(queryOptions, out userSessionList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Sort userSessionList.Sort(delegate(Quest.Functional.ASM.UserSession i1, Quest.Functional.ASM.UserSession i2) { return(i1.Created.CompareTo(i2.Created)); }); // Transfer model. // TODO: USE BaseListModeler to xfer queryOptions to QueryOptionsViewModel. sessionsListViewModel = new SessionsListViewModel(this.UserSession); QueryResponseViewModel queryResponseViewModel = null; status = TransferQueryResponse(queryResponse, out queryResponseViewModel); if (!questStatusDef.IsSuccess(status)) { return(status); } sessionsListViewModel.QueryResponse = queryResponseViewModel; foreach (Quest.Functional.ASM.UserSession user in userSessionList) { SessionLineItemViewModel sessionLineItemViewModel = new SessionLineItemViewModel(); BufferMgr.TransferBuffer(user, sessionLineItemViewModel); sessionsListViewModel.Items.Add(sessionLineItemViewModel); } return(new questStatus(Severity.Success)); }
public questStatus Page(out SessionsListViewModel sessionsListViewModel) { // Initialize questStatus status = null; sessionsListViewModel = null; // Set up query options. // TEMPORARY: OPTIMIZE THIS List <SearchField> searchFieldList = new List <SearchField>(); SearchOptions searchOptions = new SearchOptions(); searchOptions.SearchFieldList = searchFieldList; QueryOptions queryOptions = new QueryOptions(100, 1); queryOptions.SearchOptions = searchOptions; QueryResponse queryResponse = null; // List List <Quest.Functional.ASM.UserSession> userSessionList = null; UserSessionMgr userSessionMgr = new UserSessionMgr(this.UserSession); status = userSessionMgr.List(queryOptions, out userSessionList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Transfer model. sessionsListViewModel = new SessionsListViewModel(this.UserSession); foreach (Quest.Functional.ASM.UserSession user in userSessionList) { SessionLineItemViewModel sessionLineItemViewModel = new SessionLineItemViewModel(); BufferMgr.TransferBuffer(user, sessionLineItemViewModel); sessionsListViewModel.Items.Add(sessionLineItemViewModel); } return(new questStatus(Severity.Success)); }