public static bool ModifyParagraph(Guid applicationId, Paragraph Info, Guid?changeId2Accept, bool?hasAdmin,
                                           List <Guid> adminUserIds, ref List <Dashboard> dashboards, bool?citationNeeded, bool?apply, bool?accept)
        {
            SqlConnection con = new SqlConnection(ProviderUtil.ConnectionString);
            SqlCommand    cmd = new SqlCommand();

            cmd.Connection = con;

            if (string.IsNullOrEmpty(Info.BodyText))
            {
                Info.BodyText = string.Empty;
            }
            if (changeId2Accept == Guid.Empty)
            {
                changeId2Accept = null;
            }

            //Add Users
            DataTable usersTable = new DataTable();

            usersTable.Columns.Add("Value", typeof(Guid));

            adminUserIds = adminUserIds.Distinct().ToList();
            foreach (Guid uid in adminUserIds)
            {
                usersTable.Rows.Add(uid);
            }

            SqlParameter usersParam = new SqlParameter("@AdminUserIDs", SqlDbType.Structured);

            usersParam.TypeName = "[dbo].[GuidTableType]";
            usersParam.Value    = usersTable;
            //end of Add Users

            cmd.Parameters.AddWithValue("@ApplicationID", applicationId);
            cmd.Parameters.AddWithValue("@ParagraphID", Info.ParagraphID);
            if (changeId2Accept.HasValue)
            {
                cmd.Parameters.AddWithValue("@ChangeID2Accept", changeId2Accept);
            }
            if (!string.IsNullOrEmpty(Info.Title))
            {
                cmd.Parameters.AddWithValue("@Title", Info.Title);
            }
            cmd.Parameters.AddWithValue("@BodyText", Info.BodyText);
            if (Info.LastModifierUserID.HasValue)
            {
                cmd.Parameters.AddWithValue("@LastModifierUserID", Info.LastModifierUserID);
            }
            if (Info.LastModificationDate.HasValue)
            {
                cmd.Parameters.AddWithValue("@LastModificationDate", Info.LastModificationDate);
            }
            if (citationNeeded.HasValue)
            {
                cmd.Parameters.AddWithValue("@CitationNeeded", citationNeeded);
            }
            if (apply.HasValue)
            {
                cmd.Parameters.AddWithValue("@Apply", apply);
            }
            if (accept.HasValue)
            {
                cmd.Parameters.AddWithValue("@Accept", accept);
            }
            if (hasAdmin.HasValue)
            {
                cmd.Parameters.AddWithValue("@HasAdmin", hasAdmin);
            }
            cmd.Parameters.Add(usersParam);

            string spName = GetFullyQualifiedName("ModifyParagraph");

            string sep       = ", ";
            string arguments = "@ApplicationID" + sep + "@ParagraphID" + sep +
                               (!changeId2Accept.HasValue ? "null" : "@ChangeID2Accept") + sep +
                               (string.IsNullOrEmpty(Info.Title) ? "null" : "@Title") + sep +
                               "@BodyText" + sep +
                               (!Info.LastModifierUserID.HasValue ? "null" : "@LastModifierUserID") + sep +
                               (!Info.LastModificationDate.HasValue ? "null" : "@LastModificationDate") + sep +
                               (!citationNeeded.HasValue ? "null" : "@CitationNeeded") + sep +
                               (!apply.HasValue ? "null" : "@Apply") + sep +
                               (!accept.HasValue ? "null" : "@Accept") + sep +
                               (!hasAdmin.HasValue ? "null" : "@HasAdmin") + sep +
                               "@AdminUserIDs";

            cmd.CommandText = ("EXEC" + " " + spName + " " + arguments);

            con.Open();
            try
            {
                IDataReader reader = (IDataReader)cmd.ExecuteReader();
                return(ProviderUtil.parse_dashboards(ref reader, ref dashboards) > 0);
            }
            catch (Exception ex)
            {
                LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.WK);
                return(false);
            }
            finally { con.Close(); }
        }
        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>());
            }
        }