public static void SearchUsers(Guid applicationId, ref List <User> retUsers, string searchText,
                                       ref List <Guid> departmentIds, ref List <Guid> expertiseKDIds, ref List <Guid> projectIds,
                                       ref List <Guid> processIds, ref List <Guid> communityIds, ref List <Guid> knowledgeKds,
                                       int?count, Guid?minId)
        {
            string spName = GetFullyQualifiedName("SearchUsers");

            try
            {
                List <Guid> _userIds = new List <Guid>();

                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId, count, minId,
                                                                 ProviderUtil.get_search_text(searchText), ProviderUtil.list_to_string <Guid>(ref departmentIds),
                                                                 ProviderUtil.list_to_string <Guid>(ref expertiseKDIds), ProviderUtil.list_to_string <Guid>(ref projectIds),
                                                                 ProviderUtil.list_to_string <Guid>(ref processIds), ProviderUtil.list_to_string <Guid>(ref communityIds),
                                                                 ProviderUtil.list_to_string <Guid>(ref knowledgeKds), ',');

                ProviderUtil.parse_guids(ref reader, ref _userIds);
                retUsers = UsersController.get_users(applicationId, _userIds);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.SRCH);
            }
        }
        public static void GetCommentSenderIDs(Guid applicationId, ref List <Guid> retIds, Guid postId)
        {
            string spName = GetFullyQualifiedName("GetCommentSenderIDs");

            try
            {
                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId, postId);
                ProviderUtil.parse_guids(ref reader, ref retIds);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.SH);
            }
        }
        public static void GetChangedWikiOwnerIDs(Guid applicationId, ref List <Guid> retIds, ref List <Guid> ownerIds)
        {
            string spName = GetFullyQualifiedName("GetChangedWikiOwnerIDs");

            try
            {
                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId,
                                                                 ProviderUtil.list_to_string <Guid>(ref ownerIds), ',');
                ProviderUtil.parse_guids(ref reader, ref retIds);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.WK);
            }
        }
        public static void GetParagraphRelatedUsers(Guid applicationId, ref List <User> retUsers, Guid paragraphId)
        {
            string spName = GetFullyQualifiedName("GetParagraphRelatedUserIDs");

            try
            {
                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId, paragraphId);

                List <Guid> lstUserIds = new List <Guid>();
                ProviderUtil.parse_guids(ref reader, ref lstUserIds);
                retUsers = UsersController.get_users(applicationId, lstUserIds);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.WK);
            }
        }
        public static bool MoveTreesOrTreeNodes(Guid applicationId, Guid treeIdOrTreeNodeId,
                                                List <Guid> movedIds, Guid currentUserId, ref List <Guid> rootIds, ref string errorMessage)
        {
            string spName = GetFullyQualifiedName("MoveTreesOrTreeNodes");

            try
            {
                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId, treeIdOrTreeNodeId,
                                                                 ProviderUtil.list_to_string <Guid>(ref movedIds), ',', currentUserId, DateTime.Now);
                ProviderUtil.parse_guids(ref reader, ref rootIds, ref errorMessage);
                return(rootIds.Count > 0);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.DCT);
                return(false);
            }
        }
        public static void GetRelatedNodes(Guid applicationId,
                                           ref List <Node> retNodes, Guid eventId, NodeTypes?nodeType)
        {
            string spName = GetFullyQualifiedName("GetRelatedNodeIDs");

            try
            {
                string strNodeTypeId = null;
                if (nodeType.HasValue)
                {
                    strNodeTypeId = CNUtilities.get_node_type_additional_id(nodeType.Value).ToString();
                }

                List <Guid> nodeIds = new List <Guid>();
                IDataReader reader  = ProviderUtil.execute_reader(spName, applicationId, eventId, strNodeTypeId);
                ProviderUtil.parse_guids(ref reader, ref nodeIds);

                retNodes = CNController.get_nodes(applicationId, nodeIds, full: null, currentUserId: null);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.EVT);
            }
        }
        public static List <Guid> GetDashboards(Guid applicationId, ref List <Dashboard> retDashboards, Guid?userId,
                                                Guid?nodeTypeId, Guid?nodeId, string nodeAdditionalId, DashboardType dashboardType, DashboardSubType subType,
                                                string subTypeTitle, bool?done, DateTime?dateFrom, DateTime?dateTo, string searchText, bool?getDistinctItems,
                                                bool?inWorkFlowState, int?lowerBoundary, int?count, ref long totalCount)
        {
            string spName = GetFullyQualifiedName("GetDashboards");

            List <Guid> retList = new List <Guid>();

            try
            {
                if (userId == Guid.Empty)
                {
                    userId = null;
                }
                if (nodeTypeId == Guid.Empty)
                {
                    nodeTypeId = null;
                }
                if (nodeId == Guid.Empty)
                {
                    nodeId = null;
                }
                if (lowerBoundary == 0)
                {
                    lowerBoundary = null;
                }
                if (!count.HasValue || count <= 0)
                {
                    count = 50;
                }

                if (!string.IsNullOrEmpty(nodeAdditionalId))
                {
                    nodeAdditionalId = nodeAdditionalId.Trim();
                }
                if (string.IsNullOrEmpty(nodeAdditionalId))
                {
                    nodeAdditionalId = null;
                }

                string strDashboardType = dashboardType == DashboardType.NotSet ? null : dashboardType.ToString();
                string strSubType       = subType == DashboardSubType.NotSet ?
                                          (string.IsNullOrEmpty(subTypeTitle) ? null : subTypeTitle) : subType.ToString();

                IDataReader reader = ProviderUtil.execute_reader(spName, applicationId,
                                                                 userId, nodeTypeId, nodeId, nodeAdditionalId, strDashboardType, strSubType, done,
                                                                 dateFrom, dateTo, ProviderUtil.get_search_text(searchText), getDistinctItems, inWorkFlowState, lowerBoundary, count);

                if (!getDistinctItems.HasValue || !getDistinctItems.Value)
                {
                    ProviderUtil.parse_dashboards(ref reader, ref retDashboards, ref totalCount);
                }
                else
                {
                    ProviderUtil.parse_guids(ref reader, ref retList, ref totalCount);
                }

                return(retList);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.NTFN);
                return(new List <Guid>());
            }
        }