public questStatus FormatBootstrapTreeviewNode(Lookup lookup, out BootstrapTreenodeViewModel lookupNodeViewModel)
        {
            // Setup main node.
            lookupNodeViewModel            = new BootstrapTreenodeViewModel();
            lookupNodeViewModel.Id         = lookup.Id;
            lookupNodeViewModel.type       = "lookup";
            lookupNodeViewModel.icon       = "fa fa-search padding-right-20";
            lookupNodeViewModel.text       = lookup.Name;
            lookupNodeViewModel.selectable = "true";

            // Put info about the lookup underneath it
            BootstrapTreenodeViewModel labelNodeViewModel = new BootstrapTreenodeViewModel();

            labelNodeViewModel.Id         = lookup.Id;
            labelNodeViewModel.type       = "lookup-label";
            labelNodeViewModel.icon       = "padding-right-40";
            labelNodeViewModel.text       = "Label: " + lookup.Label;
            labelNodeViewModel.selectable = "false";
            lookupNodeViewModel.nodes.Add(labelNodeViewModel);

            BootstrapTreenodeViewModel sqlNodeViewModel = new BootstrapTreenodeViewModel();

            sqlNodeViewModel.Id         = lookup.Id;
            sqlNodeViewModel.type       = "lookup-sql";
            sqlNodeViewModel.icon       = "padding-right-40";
            sqlNodeViewModel.text       = "SQL: ... ";
            sqlNodeViewModel.selectable = "false";
            sqlNodeViewModel.title      = lookup.SQL;
            lookupNodeViewModel.nodes.Add(sqlNodeViewModel);

            return(new questStatus(Severity.Success));
        }
        //----------------------------------------------------------------------------------------------------------------------------------
        // Formatting
        //----------------------------------------------------------------------------------------------------------------------------------
        public questStatus FormatBootstrapTreeviewNode(FilterTable filterTable, out BootstrapTreenodeViewModel bootstrapTreenodeViewModel)
        {
            // Initialize
            questStatus status = null;

            bootstrapTreenodeViewModel            = new BootstrapTreenodeViewModel();
            bootstrapTreenodeViewModel.Id         = filterTable.TablesetTable.Id;
            bootstrapTreenodeViewModel.type       = "table";
            bootstrapTreenodeViewModel.icon       = "fa fa-table padding-right-20";
            bootstrapTreenodeViewModel.text       = "[" + filterTable.TablesetTable.Schema + "].[" + filterTable.TablesetTable.Name + "]";
            bootstrapTreenodeViewModel.Schema     = filterTable.TablesetTable.Schema;
            bootstrapTreenodeViewModel.Name       = filterTable.TablesetTable.Name;
            bootstrapTreenodeViewModel.selectable = "true";

            List <BootstrapTreenodeViewModel> columnNodeList = new List <BootstrapTreenodeViewModel>();

            foreach (FilterColumn filterColumn in filterTable.FilterColumnList)
            {
                BootstrapTreenodeViewModel columnNode = null;
                status = FormatBootstrapTreeviewNode(filterTable, filterColumn, out columnNode);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                columnNodeList.Add(columnNode);
            }
            bootstrapTreenodeViewModel.nodes.AddRange(columnNodeList);
            return(new questStatus(Severity.Success));
        }
        public questStatus FormatBootstrapTreeviewNode(View view, out BootstrapTreenodeViewModel bootstrapTreenodeViewModel)
        {
            // Initialize
            questStatus status = null;

            bootstrapTreenodeViewModel            = new BootstrapTreenodeViewModel();
            bootstrapTreenodeViewModel.Id         = view.Id;
            bootstrapTreenodeViewModel.type       = "view";
            bootstrapTreenodeViewModel.icon       = "fa fa-th padding-right-20";
            bootstrapTreenodeViewModel.text       = "[" + view.Schema + "].[" + view.Name + "]";
            bootstrapTreenodeViewModel.Schema     = view.Schema;
            bootstrapTreenodeViewModel.Name       = view.Name;
            bootstrapTreenodeViewModel.selectable = "true";

            List <BootstrapTreenodeViewModel> columnNodeList = new List <BootstrapTreenodeViewModel>();

            foreach (Column column in view.ColumnList)
            {
                BootstrapTreenodeViewModel columnNode = null;
                status = FormatBootstrapTreeviewNode(view, column, out columnNode);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                columnNodeList.Add(columnNode);
            }
            bootstrapTreenodeViewModel.nodes.AddRange(columnNodeList);
            return(new questStatus(Severity.Success));
        }
Ejemplo n.º 4
0
        public questStatus GetDatabaseViews(DatabaseId databaseId, out List <BootstrapTreenodeViewModel> dbViewNodeList)
        {
            // Initialize
            questStatus status = null;

            dbViewNodeList = null;


            // Get db tables
            List <DBTable> dbTableList = null;
            DatabaseMgr    databaseMgr = new DatabaseMgr(this.UserSession);

            status = databaseMgr.GetDatabaseTables(databaseId, out dbTableList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Format into bootstrap nodes
            dbViewNodeList = new List <BootstrapTreenodeViewModel>();
            foreach (DBTable dbTable in dbTableList)
            {
                BootstrapTreenodeViewModel bootstrapTreenodeViewModel = null;
                status = FormatBootstrapTreeviewNode(dbTable, out bootstrapTreenodeViewModel);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                dbViewNodeList.Add(bootstrapTreenodeViewModel);
            }
            return(new questStatus(Severity.Success));
        }
        public questStatus Read(FilterFolderViewModel viewModel, out FilterFolderViewModel filterFolderViewModel)
        {
            // Initialize
            questStatus status = null;

            filterFolderViewModel = null;


            // Read filter
            FolderId            folderId         = new FolderId(viewModel.Id);
            List <FilterFolder> filterFolderList = null;
            FilterFoldersMgr    filterFoldersMgr = new FilterFoldersMgr(this.UserSession);

            status = filterFoldersMgr.Load(folderId, out filterFolderList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Transfer model
            filterFolderViewModel = new FilterFolderViewModel();
            BufferMgr.TransferBuffer(viewModel, filterFolderViewModel);
            foreach (FilterFolder filterFolder in filterFolderList)
            {
                BootstrapTreenodeViewModel bootstrapTreenodeViewModel = null;
                status = FormatBootstrapTreeviewNode(filterFolder, out bootstrapTreenodeViewModel);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                filterFolderViewModel.Items.Add(bootstrapTreenodeViewModel);
            }
            return(new questStatus(Severity.Success));
        }
 public questStatus FormatBootstrapTreeviewNode(Quest.Functional.MasterPricing.Filter filter, out BootstrapTreenodeViewModel bootstrapTreenodeViewModel)
 {
     bootstrapTreenodeViewModel            = new BootstrapTreenodeViewModel();
     bootstrapTreenodeViewModel.Id         = filter.Id;
     bootstrapTreenodeViewModel.type       = "filter";
     bootstrapTreenodeViewModel.icon       = "fa fa-filter padding-right-20";
     bootstrapTreenodeViewModel.text       = filter.Name;
     bootstrapTreenodeViewModel.Name       = filter.Name;
     bootstrapTreenodeViewModel.selectable = "true";
     return(new questStatus(Severity.Success));
 }
        public questStatus FormatBootstrapTreeviewNode(DBView dbView, out BootstrapTreenodeViewModel bootstrapTreenodeViewModel)
        {
            // Initialize
            bootstrapTreenodeViewModel            = new BootstrapTreenodeViewModel();
            bootstrapTreenodeViewModel.Id         = dbView.Id;
            bootstrapTreenodeViewModel.type       = "view";
            bootstrapTreenodeViewModel.text       = "[" + dbView.Schema + "].[" + dbView.Name + "]";
            bootstrapTreenodeViewModel.selectable = "true";

            return(new questStatus(Severity.Success));
        }
        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/


        #region Options
        //----------------------------------------------------------------------------------------------------------------------------------
        // Options
        //----------------------------------------------------------------------------------------------------------------------------------
        #endregion


        #region Formatting
        //----------------------------------------------------------------------------------------------------------------------------------
        // Formatting
        //----------------------------------------------------------------------------------------------------------------------------------
        public questStatus FormatBootstrapTreeviewNode(Group group, out BootstrapTreenodeViewModel bootstrapTreenodeViewModel)
        {
            // Initialize
            bootstrapTreenodeViewModel            = new BootstrapTreenodeViewModel();
            bootstrapTreenodeViewModel.Id         = group.Id;
            bootstrapTreenodeViewModel.type       = "group";
            bootstrapTreenodeViewModel.icon       = "fa fa-group padding-right-20";
            bootstrapTreenodeViewModel.text       = group.Name;
            bootstrapTreenodeViewModel.selectable = "true";

            return(new questStatus(Severity.Success));
        }
        public questStatus FormatBootstrapTreeviewNode(Privilege privilege, out BootstrapTreenodeViewModel bootstrapTreenodeViewModel)
        {
            // Initialize
            bootstrapTreenodeViewModel            = new BootstrapTreenodeViewModel();
            bootstrapTreenodeViewModel.Id         = privilege.Id;
            bootstrapTreenodeViewModel.type       = "privilege";
            bootstrapTreenodeViewModel.icon       = "fa fa-unlock padding-right-20";
            bootstrapTreenodeViewModel.text       = privilege.Name;
            bootstrapTreenodeViewModel.selectable = "true";

            return(new questStatus(Severity.Success));
        }
        public questStatus FormatBootstrapTreeviewNode(User user, out BootstrapTreenodeViewModel bootstrapTreenodeViewModel)
        {
            // Initialize
            bootstrapTreenodeViewModel            = new BootstrapTreenodeViewModel();
            bootstrapTreenodeViewModel.Id         = user.Id;
            bootstrapTreenodeViewModel.type       = "user";
            bootstrapTreenodeViewModel.icon       = "fa fa-user padding-right-20";
            bootstrapTreenodeViewModel.text       = user.FirstName + " " + user.LastName;
            bootstrapTreenodeViewModel.selectable = "true";

            return(new questStatus(Severity.Success));
        }
        public questStatus FormatBootstrapTreeviewNode(View view, Column column, out BootstrapTreenodeViewModel bootstrapTreenodeViewModel)
        {
            // Initialize
            bootstrapTreenodeViewModel            = new BootstrapTreenodeViewModel();
            bootstrapTreenodeViewModel.Id         = column.Id;
            bootstrapTreenodeViewModel.ParentId   = column.EntityId;
            bootstrapTreenodeViewModel.type       = "column";
            bootstrapTreenodeViewModel.parentType = "view";
            bootstrapTreenodeViewModel.icon       = "fa fa-square-o padding-right-20 ";
            bootstrapTreenodeViewModel.text       = column.Name + " : " + GetColumnDataType(column);
            bootstrapTreenodeViewModel.Schema     = null;
            bootstrapTreenodeViewModel.text       = column.Name;
            bootstrapTreenodeViewModel.selectable = "true";

            return(new questStatus(Severity.Success));
        }
        public questStatus FormatBootstrapTreeviewNode(TablesetTable tablesetTable, TablesetColumn tablesetColumn, out BootstrapTreenodeViewModel bootstrapTreenodeViewModel)
        {
            // Initialize
            bootstrapTreenodeViewModel            = new BootstrapTreenodeViewModel();
            bootstrapTreenodeViewModel.Id         = tablesetColumn.Id;
            bootstrapTreenodeViewModel.ParentId   = tablesetColumn.TableSetEntityId;
            bootstrapTreenodeViewModel.type       = "column";
            bootstrapTreenodeViewModel.parentType = "table";
            bootstrapTreenodeViewModel.icon       = "fa fa-square-o padding-right-20 ";
            bootstrapTreenodeViewModel.text       = tablesetColumn.Name + " : " + GetColumnDataType(tablesetColumn.Column);
            bootstrapTreenodeViewModel.Schema     = null;
            bootstrapTreenodeViewModel.Name       = tablesetColumn.Name;
            bootstrapTreenodeViewModel.selectable = tablesetTable.bColumnsSelectable ? "true" : "false";

            return(new questStatus(Severity.Success));
        }
Ejemplo n.º 13
0
        //TablesetConfigurationViewModel
        #endregion


        #region Public Methods

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

        #region CRUD
        //----------------------------------------------------------------------------------------------------------------------------------
        // CRUD
        //----------------------------------------------------------------------------------------------------------------------------------
        public questStatus GetDatabaseEntities(DatabaseId databaseId, out List <BootstrapTreenodeViewModel> dbTableNodeList, out List <BootstrapTreenodeViewModel> dbViewNodeList)
        {
            // Initialize
            questStatus status = null;

            dbTableNodeList = null;
            dbViewNodeList  = null;


            // Read database entities
            DatabaseEntities databaseEntities = null;
            DatabaseMgr      databaseMgr      = new DatabaseMgr(this.UserSession);

            status = databaseMgr.ReadDatabaseEntities(databaseId, out databaseEntities);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Transfer model
            // Tables
            dbTableNodeList = new List <BootstrapTreenodeViewModel>();
            foreach (Table dbTable in databaseEntities.TableList)
            {
                BootstrapTreenodeViewModel bootstrapTreenodeViewModel = null;
                status = FormatBootstrapTreeviewNode(dbTable, out bootstrapTreenodeViewModel);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                dbTableNodeList.Add(bootstrapTreenodeViewModel);
            }

            // Views
            dbViewNodeList = new List <BootstrapTreenodeViewModel>();
            foreach (View dbView in databaseEntities.ViewList)
            {
                BootstrapTreenodeViewModel bootstrapTreenodeViewModel = null;
                status = FormatBootstrapTreeviewNode(dbView, out bootstrapTreenodeViewModel);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                dbViewNodeList.Add(bootstrapTreenodeViewModel);
            }
            return(new questStatus(Severity.Success));
        }
        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 FormatBootstrapTreeviewNode(FilterFolder filterFolder, out BootstrapTreenodeViewModel bootstrapTreenodeViewModel)
        {
            // Initialize
            questStatus status = null;

            bootstrapTreenodeViewModel            = new BootstrapTreenodeViewModel();
            bootstrapTreenodeViewModel.Id         = filterFolder.Id;
            bootstrapTreenodeViewModel.type       = "folder";
            bootstrapTreenodeViewModel.icon       = "fa fa-folder-o padding-right-20";
            bootstrapTreenodeViewModel.text       = filterFolder.Name;
            bootstrapTreenodeViewModel.Name       = filterFolder.Name;
            bootstrapTreenodeViewModel.selectable = "true";

            // Add folder subnodes
            List <BootstrapTreenodeViewModel> subfolderList = new List <BootstrapTreenodeViewModel>();

            foreach (FilterFolder folder in filterFolder.Folders)
            {
                BootstrapTreenodeViewModel subfolder = null;
                status = FormatBootstrapTreeviewNode(folder, out subfolder);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                subfolderList.Add(subfolder);
            }
            bootstrapTreenodeViewModel.nodes.AddRange(subfolderList);

            // Add filter subnodes
            List <BootstrapTreenodeViewModel> filterNodeList = new List <BootstrapTreenodeViewModel>();

            foreach (Quest.Functional.MasterPricing.Filter filter in filterFolder.Filters)
            {
                BootstrapTreenodeViewModel filterNode = null;
                status = FormatBootstrapTreeviewNode(filter, out filterNode);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                filterNodeList.Add(filterNode);
            }
            bootstrapTreenodeViewModel.nodes.AddRange(filterNodeList);

            return(new questStatus(Severity.Success));
        }
Ejemplo n.º 16
0
        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/

        #region LOAD
        //----------------------------------------------------------------------------------------------------------------------------------
        // LOAD
        //----------------------------------------------------------------------------------------------------------------------------------
        public questStatus Load(out List <BootstrapTreenodeViewModel> groupNodeList)
        {
            // Initialize
            questStatus status = null;

            groupNodeList = 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();

            queryOptions.SearchOptions = searchOptions;
            QueryResponse queryResponse = null;


            // Get groups.
            List <Group> groupList = null;
            GroupsMgr    groupsMgr = new GroupsMgr(this.UserSession);

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

            // Transfer model
            groupNodeList = new List <BootstrapTreenodeViewModel>();
            foreach (Group group in groupList)
            {
                BootstrapTreenodeViewModel groupNode = null;
                FormatBootstrapTreeviewNode(group, out groupNode);
                groupNodeList.Add(groupNode);
            }
            return(new questStatus(Severity.Success));
        }
        public questStatus FormatBootstrapTreeviewNode(TypeList typeList, out BootstrapTreenodeViewModel typeListNodeViewModel)
        {
            // Setup main node.
            typeListNodeViewModel            = new BootstrapTreenodeViewModel();
            typeListNodeViewModel.Id         = typeList.Id;
            typeListNodeViewModel.type       = "typeList";
            typeListNodeViewModel.icon       = "fa fa-search padding-right-20";
            typeListNodeViewModel.text       = typeList.Name;
            typeListNodeViewModel.selectable = "true";

            // Put info about the typeList underneath it
            BootstrapTreenodeViewModel sqlNodeViewModel = new BootstrapTreenodeViewModel();

            sqlNodeViewModel.Id         = typeList.Id;
            sqlNodeViewModel.type       = "typeList-sql";
            sqlNodeViewModel.icon       = "padding-right-40";
            sqlNodeViewModel.text       = "SQL: ... ";
            sqlNodeViewModel.selectable = "false";
            sqlNodeViewModel.title      = typeList.SQL;
            typeListNodeViewModel.nodes.Add(sqlNodeViewModel);

            return(new questStatus(Severity.Success));
        }
        public questStatus Read(UserPrivilegesViewModel viewModel, out UserPrivilegesViewModel userPrivilegesViewModel)
        {
            // Initialize
            questStatus status = null;

            userPrivilegesViewModel = null;
            UserId userId = new UserId(viewModel.Id);


            // Get the user
            User     user     = null;
            UsersMgr usersMgr = new UsersMgr(this.UserSession);

            status = usersMgr.Read(userId, out user);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }


            // Get privileges
            List <SearchField> searchFieldList = new List <SearchField>();
            SearchOptions      searchOptions   = new SearchOptions();

            searchOptions.SearchFieldList = searchFieldList;
            QueryOptions queryOptions = new QueryOptions();

            queryOptions.SearchOptions = searchOptions;
            QueryResponse queryResponse = null;

            List <Privilege> privilegeList = null;
            PrivilegesMgr    privilegesMgr = new PrivilegesMgr(this.UserSession);

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


            // Get user privileges
            List <Privilege> userPrivilegeList = null;
            AccountMgr       accountMgr        = new AccountMgr(this.UserSession);

            status = accountMgr.GetUserPrivileges(userId, out userPrivilegeList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Remove from privileges lists whatever privileges the user is already in.
            List <Privilege> unassignedPrivilegeList = new List <Privilege>();

            foreach (Privilege privilege in privilegeList)
            {
                Privilege userPrivilege = userPrivilegeList.Find(delegate(Privilege g) { return(g.Id == privilege.Id); });
                if (userPrivilege == null)
                {
                    unassignedPrivilegeList.Add(privilege);
                }
            }

            // Sort privilege lists
            unassignedPrivilegeList.Sort(delegate(Privilege i1, Privilege i2) { return(i1.Name.CompareTo(i2.Name)); });
            userPrivilegeList.Sort(delegate(Privilege i1, Privilege i2) { return(i1.Name.CompareTo(i2.Name)); });


            // Transfer model
            userPrivilegesViewModel = new UserPrivilegesViewModel(this.UserSession, viewModel);
            UserEditorViewModel userEditorViewModel = new UserEditorViewModel();

            BufferMgr.TransferBuffer(user, userEditorViewModel);
            userPrivilegesViewModel.User = userEditorViewModel;
            foreach (Privilege privilege in unassignedPrivilegeList)
            {
                BootstrapTreenodeViewModel privilegeNode = null;
                status = FormatBootstrapTreeviewNode(privilege, out privilegeNode);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                privilegeNode.icon = "fa fa-lock padding-right-20";
                userPrivilegesViewModel.Privileges.Add(privilegeNode);
            }
            foreach (Privilege privilege in userPrivilegeList)
            {
                BootstrapTreenodeViewModel userPrivilegeNode = null;
                status = FormatBootstrapTreeviewNode(privilege, out userPrivilegeNode);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                userPrivilegeNode.icon = "fa fa-unlock padding-right-20";
                userPrivilegesViewModel.UserPrivileges.Add(userPrivilegeNode);
            }
            return(new questStatus(Severity.Success));
        }
        public questStatus Read(UserGroupsViewModel viewModel, out UserGroupsViewModel userGroupsViewModel)
        {
            // Initialize
            questStatus status = null;

            userGroupsViewModel = null;
            UserId userId = new UserId(viewModel.Id);


            // Get the user
            User     user     = null;
            UsersMgr usersMgr = new UsersMgr(this.UserSession);

            status = usersMgr.Read(userId, out user);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }


            // Get groups
            List <SearchField> searchFieldList = new List <SearchField>();
            SearchOptions      searchOptions   = new SearchOptions();

            searchOptions.SearchFieldList = searchFieldList;
            QueryOptions queryOptions = new QueryOptions();

            queryOptions.SearchOptions = searchOptions;
            QueryResponse queryResponse = null;

            List <Group> groupList = null;
            GroupsMgr    groupsMgr = new GroupsMgr(this.UserSession);

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


            // Get user groups
            List <Group> userGroupList = null;
            AccountMgr   accountMgr    = new AccountMgr(this.UserSession);

            status = accountMgr.GetUserGroups(userId, out userGroupList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Remove from groups lists whatever groups the user is already in.
            List <Group> unassignedGroupList = new List <Group>();

            foreach (Group group in groupList)
            {
                Group userGroup = userGroupList.Find(delegate(Group g) { return(g.Id == group.Id); });
                if (userGroup == null)
                {
                    unassignedGroupList.Add(group);
                }
            }

            // Sort group lists
            unassignedGroupList.Sort(delegate(Group i1, Group i2) { return(i1.Name.CompareTo(i2.Name)); });
            userGroupList.Sort(delegate(Group i1, Group i2) { return(i1.Name.CompareTo(i2.Name)); });


            // Transfer model
            userGroupsViewModel = new UserGroupsViewModel(this.UserSession, viewModel);
            UserEditorViewModel userEditorViewModel = new UserEditorViewModel();

            BufferMgr.TransferBuffer(user, userEditorViewModel);
            userGroupsViewModel.User = userEditorViewModel;
            foreach (Group group in unassignedGroupList)
            {
                BootstrapTreenodeViewModel groupNode = null;
                status = FormatBootstrapTreeviewNode(group, out groupNode);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                userGroupsViewModel.Groups.Add(groupNode);
            }
            foreach (Group group in userGroupList)
            {
                BootstrapTreenodeViewModel userGroupNode = null;
                status = FormatBootstrapTreeviewNode(group, out userGroupNode);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                userGroupsViewModel.UserGroups.Add(userGroupNode);
            }
            return(new questStatus(Severity.Success));
        }
Ejemplo n.º 20
0
        public questStatus Read(TablesetId tablesetId, out TablesetConfigurationViewModel tablesetConfigurationViewModel)
        {
            // Initialize
            questStatus status = null;

            tablesetConfigurationViewModel = null;


            // If no tablesetId, return empty view model
            if (tablesetId.Id < BaseId.VALID_ID)
            {
                tablesetConfigurationViewModel = new TablesetConfigurationViewModel(this.UserSession, this._setupBaseViewModel);
                return(new questStatus(Severity.Success));
            }


            // Read
            TablesetConfiguration tablesetConfiguration = null;
            TablesetMgr           tablesetMgr           = new TablesetMgr(this.UserSession);

            status = tablesetMgr.ReadTablesetConfiguration(tablesetId, out tablesetConfiguration);
            if (!questStatusDef.IsSuccess(status))
            {
                // Return what we can of the configuration, but with the error status.
                if (tablesetConfiguration != null)
                {
                    tablesetConfigurationViewModel = new TablesetConfigurationViewModel(this.UserSession, this._setupBaseViewModel);
                    BufferMgr.TransferBuffer(tablesetConfiguration, tablesetConfigurationViewModel, true);
                    if (this._tablesetEditorViewModel != null)
                    {
                        tablesetConfigurationViewModel.Id         = this._tablesetEditorViewModel.Id;
                        tablesetConfigurationViewModel.TablesetId = this._tablesetEditorViewModel.Id;
                    }
                    else if (this._tablesetConfigurationViewModel != null)
                    {
                        tablesetConfigurationViewModel.Id         = this._tablesetConfigurationViewModel.Id;
                        tablesetConfigurationViewModel.TablesetId = this._tablesetConfigurationViewModel.Id;
                    }
                }
                if (status.Message.Contains("DbDatabasesMgr") && (status.Message.Contains("not found")))
                {
                    status = new questStatus(Severity.Error, "Database not found for this table set.");
                }
                return(status);
            }

            // Transfer model.
            tablesetConfigurationViewModel = new TablesetConfigurationViewModel(this.UserSession, this._setupBaseViewModel);
            BufferMgr.TransferBuffer(tablesetConfiguration, tablesetConfigurationViewModel, true);
            tablesetConfigurationViewModel.Id         = tablesetConfiguration.Tableset.Id;
            tablesetConfigurationViewModel.TablesetId = tablesetConfiguration.Tableset.Id;


            // Tables
            foreach (TablesetTable tablesetTable in tablesetConfiguration.TablesetTables)
            {
                BootstrapTreenodeViewModel bootstrapTreenodeViewModel = null;
                status = FormatBootstrapTreeviewNode(tablesetTable.Table, out bootstrapTreenodeViewModel);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                tablesetConfigurationViewModel.TableList.Add(bootstrapTreenodeViewModel);
            }
            foreach (Table dbTable in tablesetConfiguration.DBTableList)
            {
                BootstrapTreenodeViewModel bootstrapTreenodeViewModel = null;
                status = FormatBootstrapTreeviewNode(dbTable, out bootstrapTreenodeViewModel);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                tablesetConfigurationViewModel.DBTableList.Add(bootstrapTreenodeViewModel);
            }

            // Views
            foreach (TablesetView tablesetView in tablesetConfiguration.TablesetViews)
            {
                BootstrapTreenodeViewModel bootstrapTreenodeViewModel = null;
                status = FormatBootstrapTreeviewNode(tablesetView.View, out bootstrapTreenodeViewModel);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                tablesetConfigurationViewModel.ViewList.Add(bootstrapTreenodeViewModel);
            }
            foreach (View dbView in tablesetConfiguration.DBViewList)
            {
                BootstrapTreenodeViewModel bootstrapTreenodeViewModel = null;
                status = FormatBootstrapTreeviewNode(dbView, out bootstrapTreenodeViewModel);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                tablesetConfigurationViewModel.DBViewList.Add(bootstrapTreenodeViewModel);
            }
            return(new questStatus(Severity.Success));
        }
Ejemplo n.º 21
0
        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/
        public questStatus Save(FilterPanelViewModel filterPanelViewModel)
        {
            // Initialize
            questStatus status = null;

            Quest.Functional.MasterPricing.Filter filter = null;
            FilterId filterId = null;


            // Validate
            if (filterPanelViewModel.Editor.TablesetId < BaseId.VALID_ID)
            {
                return(new questStatus(Severity.Error, "Invalid Tableset Id"));
            }
            if (filterPanelViewModel.Editor.FilterId < BaseId.VALID_ID)
            {
                // For headless agents that want to save all-in-one, not via the Filters panel.
                filter = new Functional.MasterPricing.Filter();
                BufferMgr.TransferBuffer(filterPanelViewModel.Editor, filter);

                filterId = null;
                FiltersMgr filtersMgr = new FiltersMgr(this.UserSession);
                status = filtersMgr.Create(filter, out filterId);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                filterPanelViewModel.Editor.Id       = filterId.Id;
                filterPanelViewModel.Editor.FilterId = filterId.Id;
            }


            // Read tableset configuration
            TablesetId             tablesetId             = new TablesetId(filterPanelViewModel.Editor.TablesetId);
            TablesetDataManagement tablesetDataManagement = null;
            TablesetMgr            tablesetMgr            = new TablesetMgr(this.UserSession);

            status = tablesetMgr.ReadTablesetDataManagement(tablesetId, out tablesetDataManagement);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }


            #region Transfer filter entities
            //
            // Transfer filter entities
            //
            filter            = new Functional.MasterPricing.Filter();
            filter.TablesetId = filterPanelViewModel.Editor.TablesetId;
            filter.Id         = filterPanelViewModel.Editor.Id;
            foreach (BootstrapTreenodeViewModel filterEntity in filterPanelViewModel.Entities)
            {
                if (filterEntity.type == "table")
                {
                    FilterTable filterTable = new FilterTable();
                    filterTable.FilterId = filterPanelViewModel.Editor.Id;
                    filterTable.Schema   = filterEntity.Schema;
                    filterTable.Name     = filterEntity.Name;
                    filter.FilterTableList.Add(filterTable);
                }
                else if (filterEntity.type == "view")
                {
                    FilterView filterView = new FilterView();
                    filterView.FilterId = filterPanelViewModel.Editor.Id;
                    filterView.Schema   = filterEntity.Schema;
                    filterView.Name     = filterEntity.Name;
                    filter.FilterViewList.Add(filterView);
                }
                else if (filterEntity.type == "column")
                {
                    FilterColumn filterColumn = new FilterColumn();
                    filterColumn.FilterId         = filterPanelViewModel.Editor.Id;
                    filterColumn.Name             = filterEntity.Name;
                    filterColumn.TablesetEntityId = filterEntity.ParentId;

                    if (filterEntity.parentType == "table")
                    {
                        TablesetTable parentTablesetTable = tablesetDataManagement.TablesetConfiguration.TablesetTables.Find(delegate(TablesetTable tt) { return(tt.Id == filterEntity.ParentId); });
                        if (parentTablesetTable == null)
                        {
                            return(new questStatus(Severity.Error, String.Format("ERROR: column filter entity \"{0}\"  (Id {1})   table parent Id {2} not found.",
                                                                                 filterEntity.text, filterEntity.Id, filterEntity.ParentId)));
                        }
                        filterColumn.FilterEntityTypeId = FilterEntityType.Table;

                        // If column table not in filter entities, add it.
                        BootstrapTreenodeViewModel filterColumnTable = filterPanelViewModel.Entities.Find(delegate(BootstrapTreenodeViewModel n) { return(n.type == "table" && n.Id == filterEntity.ParentId); });
                        if (filterColumnTable == null)
                        {
                            FilterTable filterTable = filter.FilterTableList.Find(delegate(FilterTable t) { return(filterEntity.ParentId == t.TablesetTable.Id); });
                            if (filterTable == null)
                            {
                                filterTable               = new FilterTable();
                                filterTable.FilterId      = filterPanelViewModel.Editor.Id;
                                filterTable.TablesetTable = parentTablesetTable;
                                filterTable.Schema        = parentTablesetTable.Schema;
                                filterTable.Name          = parentTablesetTable.Name;
                                filter.FilterTableList.Add(filterTable);
                            }
                        }
                    }
                    else if (filterEntity.parentType == "view")
                    {
                        TablesetView parentTablesetView = tablesetDataManagement.TablesetConfiguration.TablesetViews.Find(delegate(TablesetView tv) { return(tv.Id == filterEntity.ParentId); });
                        if (parentTablesetView == null)
                        {
                            return(new questStatus(Severity.Error, String.Format("ERROR: column filter entity \"{0}\"  (Id {1})   view parent Id {2} not found.",
                                                                                 filterEntity.text, filterEntity.Id, filterEntity.ParentId)));
                        }
                        filterColumn.FilterEntityTypeId = FilterEntityType.View;

                        // If column view not in filter entities, add it.
                        BootstrapTreenodeViewModel filterColumnView = filterPanelViewModel.Entities.Find(delegate(BootstrapTreenodeViewModel n) { return(n.type == "view" && n.Id == filterEntity.ParentId); });
                        if (filterColumnView == null)
                        {
                            FilterView filterView = filter.FilterViewList.Find(delegate(FilterView v) { return(filterEntity.ParentId == v.TablesetView.Id); });
                            if (filterView == null)
                            {
                                filterView              = new FilterView();
                                filterView.FilterId     = filterPanelViewModel.Editor.Id;
                                filterView.TablesetView = parentTablesetView;
                                filterView.Schema       = parentTablesetView.Schema;
                                filterView.Name         = parentTablesetView.Name;
                                filter.FilterViewList.Add(filterView);
                            }
                        }
                    }
                    else
                    {
                        return(new questStatus(Severity.Error, String.Format("ERROR: column filter entity \"{0}\"  (Id {1})  unknown parent parent type: {2}",
                                                                             filterEntity.text, filterEntity.Id, filterEntity.ParentId, (filterEntity.parentType == null ? "null" : filterEntity.parentType))));
                    }
                    filter.FilterColumnList.Add(filterColumn);
                }
                else
                {
                    return(new questStatus(Severity.Error, String.Format("Invalid filter entity type: {0}", filterEntity.type)));
                }
            }
            #endregion


            #region Transfer filter items
            //
            // Transfer filter items
            //
            foreach (FilterItemViewModel filterItemViewModel in filterPanelViewModel.Items)
            {
                // Filter Item
                FilterItem filterItem = new FilterItem();
                filterItem.FilterId = filterPanelViewModel.Editor.FilterId;
                if (filterItemViewModel.Entity.type == "table")
                {
                    filterItem.FilterEntityTypeId = FilterEntityType.Table;
                }
                if (filterItemViewModel.Entity.type == "view")
                {
                    filterItem.FilterEntityTypeId = FilterEntityType.View;
                }
                else if (filterItemViewModel.Entity.type == "column")
                {
                    filterItem.FilterEntityTypeId = FilterEntityType.Column;
                }
                filterItem.TablesetColumnId         = filterItemViewModel.Entity.Id;
                filterItem.Label                    = filterItemViewModel.Label;
                filterItem.ParameterName            = filterItemViewModel.ParameterName;
                filterItem.bHidden                  = filterItemViewModel.bHidden;
                filterItem.bBulkUpdateValueRequired = filterItemViewModel.bBulkUpdateValueRequired;

                // Joins
                foreach (FilterItemJoinViewModel filterItemJoinViewModel in filterItemViewModel.Joins)
                {
                    FilterItemJoin filterItemJoin = new FilterItemJoin();
                    filterItemJoin.ColumnId   = filterItemJoinViewModel.ColumnId;
                    filterItemJoin.JoinType   = filterItemJoinViewModel.JoinType;
                    filterItemJoin.Identifier = filterItemJoinViewModel.Identifier;
                    filterItem.JoinList.Add(filterItemJoin);
                }

                // Operations
                foreach (FilterOperationViewModel filterOperationViewModel in filterItemViewModel.Operations)
                {
                    FilterOperation filterOperation = new FilterOperation();
                    filterOperation.FilterOperatorId = filterOperationViewModel.Operator;

                    // Values
                    foreach (FilterValueViewModel filterValueViewModel in filterOperationViewModel.Values)
                    {
                        FilterValue filterValue = new FilterValue();
                        filterValue.Value = filterValueViewModel.Value;
                        filterOperation.ValueList.Add(filterValue);
                    }
                    filterItem.OperationList.Add(filterOperation);
                }

                // Lookup
                if (filterItemViewModel.Lookup.Id >= BaseId.VALID_ID)
                {
                    filterItem.LookupId = filterItemViewModel.Lookup.Id;
                }

                // TypeList
                if (filterItemViewModel.TypeList.Id >= BaseId.VALID_ID)
                {
                    filterItem.TypeListId = filterItemViewModel.TypeList.Id;
                }
                filter.FilterItemList.Add(filterItem);
            }
            #endregion


            #region  Transfer filter procedures
            //
            // Transfer filter procedures
            //
            foreach (FilterProcedureViewModel filterProcedureViewModel in filterPanelViewModel.Procedures)
            {
                if (filterProcedureViewModel.Id > BaseId.INVALID_ID)
                {
                    FilterProcedure filterProcedure = new FilterProcedure();
                    BufferMgr.TransferBuffer(filterProcedureViewModel, filterProcedure);
                    filterProcedure.FilterId = filterPanelViewModel.Editor.FilterId;
                    filter.FilterProcedureList.Add(filterProcedure);
                }
            }
            #endregion


            #region Save filter
            //
            // Save filter
            //
            filterId = new FilterId(filterPanelViewModel.Editor.FilterId);
            FilterMgr filterMgr = new FilterMgr(this.UserSession);
            status = filterMgr.Save(filterId, filter);
            if (!questStatusDef.IsSuccess(status))
            {
                if (questStatusDef.IsWarning(status))
                {
                    return(status);
                }
                return(new questStatus(status.Severity, String.Format("Error saving filter items: {0}", status.Message)));
            }
            #endregion


            #region Return procedure parameters
            //
            // Return procedure parameters
            //

            // Get filter database
            Quest.Functional.MasterPricing.Database database = null;
            filterMgr.GetFilterDatabase(filterId, out database);
            if (filter.FilterProcedureList.Count > 0)
            {
                foreach (FilterProcedureViewModel filterProcedureViewModel in filterPanelViewModel.Procedures)
                {
                    if ((filterProcedureViewModel.Id == BaseId.INVALID_ID) || (string.IsNullOrEmpty(filterProcedureViewModel.Name)))
                    {
                        continue;
                    }

                    // Get procedure parameters
                    List <Quest.Functional.MasterPricing.FilterProcedureParameter> filterProcedureParameterList = null;
                    status = filterMgr.GetStoredProdecureParameters(database, filterProcedureViewModel.Name, out filterProcedureParameterList);
                    if (!questStatusDef.IsSuccess(status))
                    {
                        return(status);
                    }
                    foreach (FilterProcedureParameter filterProcedureParameter in filterProcedureParameterList)
                    {
                        FilterProcedureParameterViewModel filterProcedureParameterViewModel = new FilterProcedureParameterViewModel();
                        BufferMgr.TransferBuffer(filterProcedureParameter, filterProcedureParameterViewModel, true);
                        filterProcedureParameterViewModel.Precision = filterProcedureParameter.Precision[0];
                        filterProcedureParameterViewModel.Scale     = filterProcedureParameter.Scale[0];
                        filterProcedureViewModel.Parameters.Add(filterProcedureParameterViewModel);
                    }
                }
            }
            #endregion


            // Return warning if no items in filter.
            if (filter.FilterItemList.Count == 0)
            {
                return(new questStatus(Severity.Warning, "Filter successfully saved, but has no items"));
            }
            return(new questStatus(Severity.Success));
        }
        public questStatus Read(FilterId filterId, out FilterEditorViewModel filterEditorViewModel)
        {
            // Initialize
            questStatus status = null;

            filterEditorViewModel = null;


            // Read filter
            Quest.Functional.MasterPricing.Filter filter = null;
            FilterMgr filterMgr = new FilterMgr(this.UserSession);

            status = filterMgr.GetFilter(filterId, out filter);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Transfer model
            filterEditorViewModel = new FilterEditorViewModel();
            BufferMgr.TransferBuffer(filter, filterEditorViewModel);
            foreach (FilterTable filterTable in filter.FilterTableList)
            {
                BootstrapTreenodeViewModel bootstrapTreenodeViewModel = null;
                status = FormatBootstrapTreeviewNode(filterTable, out bootstrapTreenodeViewModel);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                filterEditorViewModel.Entities.Add(bootstrapTreenodeViewModel);
            }
            foreach (FilterView filterView in filter.FilterViewList)
            {
                BootstrapTreenodeViewModel bootstrapTreenodeViewModel = null;
                status = FormatBootstrapTreeviewNode(filterView, out bootstrapTreenodeViewModel);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                filterEditorViewModel.Entities.Add(bootstrapTreenodeViewModel);
            }
            foreach (FilterItem filterItem in filter.FilterItemList)
            {
                FilterItemViewModel filterItemViewModel = new FilterItemViewModel();
                filterItemViewModel.Id = filterItem.Id;
                ////filterItemViewModel.Name = filterItem.TablesetColumn.Name;
                filterItemViewModel.Name                     = filterItem.FilterColumn.TablesetColumn.Column.Name;
                filterItemViewModel.Label                    = filterItem.Label;
                filterItemViewModel.ParameterName            = filterItem.ParameterName;
                filterItemViewModel.bHidden                  = filterItem.bHidden;
                filterItemViewModel.bBulkUpdateValueRequired = filterItem.bBulkUpdateValueRequired;

                filterItemViewModel.Entity.type   = "column"; // TODO: ALL THAT'S SUPPORTED RIGHT NOW.
                filterItemViewModel.Entity.Schema = null;
                filterItemViewModel.Entity.Name   = filterItem.FilterColumn.TablesetColumn.Column.Name;
                BufferMgr.TransferBuffer(filterItem.FilterColumn.TablesetColumn.Column, filterItemViewModel.Entity.Column);

                filterItemViewModel.ParentEntity.type   = filterItem.FilterColumn.ParentEntityType.type;
                filterItemViewModel.ParentEntity.Schema = filterItem.FilterColumn.ParentEntityType.Schema;
                filterItemViewModel.ParentEntity.Name   = filterItem.FilterColumn.ParentEntityType.Name;



                // Joins
                foreach (FilterItemJoin filterItemJoin in filterItem.JoinList)
                {
                    FilterItemJoinViewModel filterItemJoinViewModel = new FilterItemJoinViewModel();
                    BufferMgr.TransferBuffer(filterItemJoin, filterItemJoinViewModel);
                    filterItemJoinViewModel.Identifier = '[' + filterItemJoin.TargetSchema + "].[" + filterItemJoin.TargetEntityName + "].[" + filterItemJoin.TargetColumnName + "]";
                    filterItemViewModel.Joins.Add(filterItemJoinViewModel);
                }


                // Operations
                foreach (FilterOperation filterOperation in filterItem.OperationList)
                {
                    FilterOperationViewModel filterOperationViewModel = new FilterOperationViewModel();
                    filterOperationViewModel.Id       = filterOperation.Id;
                    filterOperationViewModel.Operator = filterOperation.FilterOperatorId;

                    // Views
                    foreach (FilterValue filterValue in filterOperation.ValueList)
                    {
                        FilterValueViewModel filterValueViewModel = new FilterValueViewModel();
                        filterValueViewModel.Id    = filterValue.Id;
                        filterValueViewModel.Value = filterValue.Value;
                        filterOperationViewModel.Values.Add(filterValueViewModel);
                    }
                    filterItemViewModel.Operations.Add(filterOperationViewModel);
                }

                // Lookup
                if (filterItem.LookupId.HasValue)
                {
                    FilterItemLookupViewModel filterItemLookupViewModel = new FilterItemLookupViewModel();
                    filterItemLookupViewModel.Id   = filterItem.Lookup.Id;
                    filterItemLookupViewModel.Name = filterItem.Lookup.Name;
                    filterItemViewModel.Lookup     = filterItemLookupViewModel;
                }

                // TypeList
                if (filterItem.TypeListId.HasValue)
                {
                    FilterItemTypeListViewModel filterItemTypeListViewModel = new FilterItemTypeListViewModel();
                    filterItemTypeListViewModel.Id   = filterItem.TypeList.Id;
                    filterItemTypeListViewModel.Name = filterItem.TypeList.Name;
                    filterItemViewModel.TypeList     = filterItemTypeListViewModel;
                }

                filterEditorViewModel.Items.Add(filterItemViewModel);
            }

            foreach (FilterProcedure filterProcedure in filter.FilterProcedureList)
            {
                FilterProcedureViewModel filterProcedureViewModel = new FilterProcedureViewModel();
                BufferMgr.TransferBuffer(filterProcedure, filterProcedureViewModel);
                foreach (FilterProcedureParameter filterProcedureParameter in filterProcedure.ParameterList)
                {
                    FilterProcedureParameterViewModel filterProcedureParameterViewModel = new FilterProcedureParameterViewModel();
                    BufferMgr.TransferBuffer(filterProcedureParameter, filterProcedureParameterViewModel, true);
                    filterProcedureParameterViewModel.Precision = filterProcedureParameter.Precision[0];
                    filterProcedureParameterViewModel.Scale     = filterProcedureParameter.Scale[0];
                    filterProcedureViewModel.Parameters.Add(filterProcedureParameterViewModel);
                }
                filterEditorViewModel.Procedures.Add(filterProcedureViewModel);
            }

            return(new questStatus(Severity.Success));
        }
        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/
        public questStatus Read(TablesetId tablesetId, out DataMgrTablesetViewModel dataMgrTablesetViewModel)
        {
            // Initialize
            questStatus status = null;

            dataMgrTablesetViewModel = null;


            // Read tableset data management.
            TablesetDataManagement tablesetDataManagement = null;
            TablesetMgr            tablesetMgr            = new TablesetMgr(this.UserSession);

            status = tablesetMgr.ReadTablesetDataManagement(tablesetId, out tablesetDataManagement);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // List lookups
            DatabaseId databaseId = new DatabaseId(tablesetDataManagement.TablesetConfiguration.Database.Id);
            List <BootstrapTreenodeViewModel> lookupNodeList = null;

            status = ListLookups(databaseId, out lookupNodeList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // List TypeLists
            List <BootstrapTreenodeViewModel> typeListNodeList = null;

            status = ListTypeLists(databaseId, out typeListNodeList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Load all folders
            FolderId            folderId         = null;
            List <FilterFolder> filterFolderList = null;
            FilterFoldersMgr    filterFoldersMgr = new FilterFoldersMgr(this.UserSession);

            status = filterFoldersMgr.Load(folderId, out filterFolderList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }


            // Build model
            dataMgrTablesetViewModel            = new DataMgrTablesetViewModel(this.UserSession, this._dataMgrBaseViewModel);
            dataMgrTablesetViewModel.TablesetId = tablesetId.Id;
            BufferMgr.TransferBuffer(tablesetDataManagement.TablesetConfiguration.Tableset, dataMgrTablesetViewModel.Tableset);
            if (dataMgrTablesetViewModel.Tableset.Summary == null)
            {
                dataMgrTablesetViewModel.Tableset.Summary = "";
            }
            dataMgrTablesetViewModel.Tableset.LastRefresh = "";
            dataMgrTablesetViewModel.Tableset.LastRefresh = tablesetDataManagement.TablesetConfiguration.Tableset.LastRefresh.HasValue ?
                                                            tablesetDataManagement.TablesetConfiguration.Tableset.LastRefresh.Value.ToString("MM/dd/yyyy HH:mm:ss") : "";


            foreach (TablesetTable tablesetTable in tablesetDataManagement.TablesetConfiguration.TablesetTables)
            {
                tablesetTable.bColumnsSelectable = false;
                BootstrapTreenodeViewModel bootstrapTreenodeViewModel = null;
                status = FormatBootstrapTreeviewNode(tablesetTable, out bootstrapTreenodeViewModel);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                dataMgrTablesetViewModel.TableList.Add(bootstrapTreenodeViewModel);
            }
            foreach (TablesetView tablesetView in tablesetDataManagement.TablesetConfiguration.TablesetViews)
            {
                BootstrapTreenodeViewModel bootstrapTreenodeViewModel = null;
                status = FormatBootstrapTreeviewNode(tablesetView, out bootstrapTreenodeViewModel);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                dataMgrTablesetViewModel.ViewList.Add(bootstrapTreenodeViewModel);
            }

            dataMgrTablesetViewModel.Lookups   = lookupNodeList;
            dataMgrTablesetViewModel.TypeLists = typeListNodeList;


            foreach (FilterFolder filterFolder in filterFolderList)
            {
                BootstrapTreenodeViewModel bootstrapTreenodeViewModel = null;
                status = FormatBootstrapTreeviewNode(filterFolder, out bootstrapTreenodeViewModel);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                dataMgrTablesetViewModel.Folders.Add(bootstrapTreenodeViewModel);
            }
            return(new questStatus(Severity.Success));
        }