public questStatus Delete(DeleteLogItemsViewModel deleteLogItemsViewModel)
        {
            // Initialize
            questStatus status = null;


            // Build id list
            List <PortalRequestLogId> portalRequestLogIdList = new List <PortalRequestLogId>();

            foreach (BaseId baseId in deleteLogItemsViewModel.Items)
            {
                PortalRequestLogId portalRequestLogId = new PortalRequestLogId(baseId.Id);
                portalRequestLogIdList.Add(portalRequestLogId);
            }

            // Delete items
            PortalRequestLogsMgr portalRequestLogsMgr = new PortalRequestLogsMgr(this.UserSession);

            status = portalRequestLogsMgr.Delete(portalRequestLogIdList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
Esempio n. 2
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * Logging
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus loadLogSettings()
        {
            // Initialize
            questStatus status = null;


            // Get log settings.
            LogSetting     logSetting     = null;
            LogSettingsMgr logSettingsMgr = new LogSettingsMgr(this.UserSession);

            status = logSettingsMgr.Read(out logSetting);
            if (!questStatusDef.IsSuccess(status))
            {
                this._logSetting = new LogSetting();
                return(status);
            }
            this._logSetting = logSetting;

            if (this._logSetting.bLogHTTPRequests)
            {
                _httpRequestLogsMgr = new HTTPRequestLogsMgr(this.UserSession);
            }
            if (this._logSetting.bLogPortal)
            {
                _portalRequestLogsMgr = new PortalRequestLogsMgr(this.UserSession);
            }
            return(new questStatus(Severity.Success));
        }
        //----------------------------------------------------------------------------------------------------------------------------------
        // Options
        //----------------------------------------------------------------------------------------------------------------------------------
        #endregion


        #region Validations
        //----------------------------------------------------------------------------------------------------------------------------------
        // Validations
        //----------------------------------------------------------------------------------------------------------------------------------
        #endregion


        #region Commands
        //----------------------------------------------------------------------------------------------------------------------------------
        // Commands
        //----------------------------------------------------------------------------------------------------------------------------------
        public questStatus Clear(PortalRequestsListViewModel portalRequestsListViewModel)
        {
            // Initialize
            questStatus status = null;


            PortalRequestLogsMgr portalRequestLogsMgr = new PortalRequestLogsMgr(this.UserSession);

            status = portalRequestLogsMgr.Clear();
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
        public questStatus List(QueryOptions queryOptions, out PortalRequestsListViewModel portalRequestsListViewModel)
        {
            // Initialize
            questStatus status = null;

            portalRequestsListViewModel = null;


            // List
            QueryResponse queryResponse = null;
            List <Quest.Functional.Logging.PortalRequestLog> portalRequestLogList = null;
            PortalRequestLogsMgr portalRequestLogsMgr = new PortalRequestLogsMgr(this.UserSession);

            status = portalRequestLogsMgr.List(queryOptions, out portalRequestLogList, out queryResponse);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Sort
            portalRequestLogList.Sort(delegate(Quest.Functional.Logging.PortalRequestLog i1, Quest.Functional.Logging.PortalRequestLog i2) { return(i2.Created.CompareTo(i1.Created)); });


            // Transfer model.
            // TODO: USE BaseListModeler to xfer queryOptions to QueryOptionsViewModel.
            portalRequestsListViewModel = new PortalRequestsListViewModel(this.UserSession);
            QueryResponseViewModel queryResponseViewModel = null;

            status = TransferQueryResponse(queryResponse, out queryResponseViewModel);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            portalRequestsListViewModel.QueryResponse = queryResponseViewModel;
            foreach (Quest.Functional.Logging.PortalRequestLog portalRequestLog in portalRequestLogList)
            {
                PortalRequestLineItemViewModel portalRequestLineItemViewModel = new PortalRequestLineItemViewModel();
                BufferMgr.TransferBuffer(portalRequestLog, portalRequestLineItemViewModel);
                portalRequestsListViewModel.Items.Add(portalRequestLineItemViewModel);
            }
            return(new questStatus(Severity.Success));
        }
        public questStatus Page(out PortalRequestsListViewModel portalRequestsListViewModel)
        {
            // Initialize
            questStatus status = null;

            portalRequestsListViewModel = 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.Logging.PortalRequestLog> portalRequestLogList = null;
            PortalRequestLogsMgr portalRequestLogsMgr = new PortalRequestLogsMgr(this.UserSession);

            status = portalRequestLogsMgr.List(queryOptions, out portalRequestLogList, out queryResponse);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Transfer model.
            portalRequestsListViewModel = new PortalRequestsListViewModel(this.UserSession);
            foreach (Quest.Functional.Logging.PortalRequestLog portalRequestLog in portalRequestLogList)
            {
                PortalRequestLineItemViewModel portalRequestLineItemViewModel = new PortalRequestLineItemViewModel();
                BufferMgr.TransferBuffer(portalRequestLog, portalRequestLineItemViewModel);
                portalRequestsListViewModel.Items.Add(portalRequestLineItemViewModel);
            }
            return(new questStatus(Severity.Success));
        }