/*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/

        #region LIST
        //----------------------------------------------------------------------------------------------------------------------------------
        // LIST
        //----------------------------------------------------------------------------------------------------------------------------------
        public questStatus List(out FiltersListViewModel filtersListViewModel)
        {
            // Initialize
            questStatus status = null;

            filtersListViewModel = null;


            // Get query options from query string
            QueryOptions    queryOptions    = null;
            BaseListModeler baseListModeler = new BaseListModeler(this.HttpRequestBase, new UserSession());

            status = baseListModeler.ParsePagingOptions(this.HttpRequestBase, out queryOptions);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // List
            status = List(queryOptions, out filtersListViewModel);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/

        #region CRUD
        //----------------------------------------------------------------------------------------------------------------------------------
        // CRUD
        //----------------------------------------------------------------------------------------------------------------------------------
        public questStatus List(out LookupsListViewModel lookupsListViewModel)
        {
            // Initialize
            questStatus status = null;

            lookupsListViewModel = null;


            // Get query options from query string
            QueryOptions    queryOptions    = null;
            BaseListModeler baseListModeler = new BaseListModeler(this.HttpRequestBase, new UserSession());

            status = baseListModeler.ParsePagingOptions(this.HttpRequestBase, out queryOptions);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Set up query options.
            // TEMPORARY: OPTIMIZE THIS
            List <SearchField> searchFieldList = new List <SearchField>();
            SearchOptions      searchOptions   = new SearchOptions();

            searchOptions.SearchFieldList = searchFieldList;
            queryOptions.SearchOptions    = searchOptions;


            // List
            status = List(queryOptions, out lookupsListViewModel);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
Exemple #3
0
        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/

        #region LIST
        //----------------------------------------------------------------------------------------------------------------------------------
        // LIST
        //----------------------------------------------------------------------------------------------------------------------------------
        public questStatus List(out HTTPRequestsListViewModel httpRequestsListViewModel)
        {
            // Initialize
            questStatus status = null;

            httpRequestsListViewModel = null;


            // Get query options from query string
            QueryOptions    queryOptions    = null;
            BaseListModeler baseListModeler = new BaseListModeler(this.HttpRequestBase, new UserSession());

            status = baseListModeler.ParsePagingOptions(this.HttpRequestBase, out queryOptions);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Modify search queryOptions accordingly
            SearchField sfUserSessionId = queryOptions.SearchOptions.SearchFieldList.Find(delegate(SearchField sf) { return(sf.Name.Equals("UserSessionId", StringComparison.InvariantCultureIgnoreCase)); });

            if (sfUserSessionId != null)
            {
                if (string.IsNullOrEmpty(sfUserSessionId.Value.Trim()))
                {
                    sfUserSessionId.SearchOperation = SearchOperation.IsNull;
                    sfUserSessionId.Value           = null;
                }
            }

            // List
            status = List(queryOptions, out httpRequestsListViewModel);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/

        #region LIST
        //----------------------------------------------------------------------------------------------------------------------------------
        // LIST
        //----------------------------------------------------------------------------------------------------------------------------------
        public questStatus List(DatabaseId databaseId, out ViewsListViewModel viewsListViewModel)
        {
            // Initialize
            questStatus status = null;

            viewsListViewModel = null;


            // Get query options from query string
            QueryOptions    queryOptions    = null;
            BaseListModeler baseListModeler = new BaseListModeler(this.HttpRequestBase, new UserSession());

            status = baseListModeler.ParsePagingOptions(this.HttpRequestBase, out queryOptions);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }


            // Set up query options.
            // TEMPORARY: OPTIMIZE THIS
            List <SearchField> searchFieldList = new List <SearchField>();
            SearchField        searchField     = new SearchField();

            searchField.Name            = "DatabaseId";
            searchField.SearchOperation = SearchOperation.Equal;
            searchField.Type            = typeof(int);
            searchField.Value           = databaseId.Id.ToString();
            searchFieldList.Add(searchField);

            SearchOptions searchOptions = new SearchOptions();

            searchOptions.SearchFieldList = searchFieldList;
            queryOptions.SearchOptions    = searchOptions;
            QueryResponse queryResponse = null;


            // Get Database viewsets
            List <View> viewsetList = null;
            ViewsMgr    viewsMgr    = new ViewsMgr(this.UserSession);

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


            // Sort by name
            viewsetList.Sort(delegate(View i1, View i2) { return(i1.Name.CompareTo(i2.Name)); });


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

            status = TransferQueryResponse(queryResponse, out queryResponseViewModel);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            viewsListViewModel.QueryResponse = queryResponseViewModel;
            foreach (Quest.Functional.MasterPricing.View view in viewsetList)
            {
                ViewLineItemViewModel viewLineItemViewModel = new ViewLineItemViewModel();
                BufferMgr.TransferBuffer(view, viewLineItemViewModel);
                viewsListViewModel.Items.Add(viewLineItemViewModel);
            }
            return(new questStatus(Severity.Success));
        }