public questStatus ListTypeLists(DatabaseId databaseId, out List <BootstrapTreenodeViewModel> typeListNodeList)
        {
            // Initialize
            questStatus status = null;

            typeListNodeList = null;


            // Set up query options.
            // TEMPORARY: OPTIMIZE THIS
            QueryOptions       queryOptions    = new QueryOptions();
            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;


            // Read typeLists
            TypeListsMgr    typeListsMgr  = new TypeListsMgr(this.UserSession);
            QueryResponse   queryResponse = null;
            List <TypeList> typeListList  = null;

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


            // Transfer model.
            typeListNodeList = new List <BootstrapTreenodeViewModel>();
            foreach (TypeList typeList in typeListList)
            {
                BootstrapTreenodeViewModel typeListNode = null;
                FormatBootstrapTreeviewNode(typeList, out typeListNode);
                typeListNodeList.Add(typeListNode);
            }
            return(new questStatus(Severity.Success));
        }
        public questStatus List(QueryOptions queryOptions, out TypeListsListViewModel typeListsListViewModel)
        {
            // Initialize
            questStatus status = null;

            typeListsListViewModel = null;


            // List
            QueryResponse queryResponse = null;
            List <Quest.Functional.MasterPricing.TypeList> typeListList = null;
            TypeListsMgr typeListsMgr = new TypeListsMgr(this.UserSession);

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

            // Sort
            typeListList.Sort(delegate(Quest.Functional.MasterPricing.TypeList i1, Quest.Functional.MasterPricing.TypeList i2) { return(i1.Name.CompareTo(i2.Name)); });


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

            status = TransferQueryResponse(queryResponse, out queryResponseViewModel);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            typeListsListViewModel.QueryResponse = queryResponseViewModel;
            foreach (Quest.Functional.MasterPricing.TypeList typeList in typeListList)
            {
                TypeListLineItemViewModel typeListLineItemViewModel = new TypeListLineItemViewModel();
                BufferMgr.TransferBuffer(typeList, typeListLineItemViewModel);
                typeListsListViewModel.Items.Add(typeListLineItemViewModel);
            }
            return(new questStatus(Severity.Success));
        }
        public questStatus Page(out TypeListsListViewModel typeListsListViewModel)
        {
            // Initialize
            questStatus status = null;

            typeListsListViewModel = 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.MasterPricing.TypeList> typeListList = null;
            TypeListsMgr typeListsMgr = new TypeListsMgr(this.UserSession);

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

            // Transfer model.
            typeListsListViewModel = new TypeListsListViewModel(this.UserSession);
            foreach (Quest.Functional.MasterPricing.TypeList typeList in typeListList)
            {
                TypeListLineItemViewModel typeListLineItemViewModel = new TypeListLineItemViewModel();
                BufferMgr.TransferBuffer(typeList, typeListLineItemViewModel);
                typeListsListViewModel.Items.Add(typeListLineItemViewModel);
            }
            return(new questStatus(Severity.Success));
        }