static void LogCustomReportSchedule(Group group, StringBuilder stringBuilder, CustomReportSchedule report) { var reportTypeSuffix = DefaultReportTypeSuffix; var scopeGroups = DefaultScopeGroups; var includeGroups = DefaultIncludeGroups; bool scope = false; bool includeAllChildren = false; bool includeDirectChildrenOnly = false; switch (report.Destination) { case ReportDestination.NormalReport: reportTypeSuffix = ReportView; scopeGroups = ReportViewScopeGroups; break; case ReportDestination.Dashboard: reportTypeSuffix = Dashboard; scopeGroups = DashBoardScopeGroups; includeGroups = $"{DashboardInclude}"; break; case ReportDestination.EmailExcel: case ReportDestination.EmailPdf: reportTypeSuffix = EmailReport; scopeGroups = EmailReportScopeGroups; includeGroups = $"{EmailReportInclude}"; break; } if (IsGroupInList(report.ScopeGroups, group)) { scope = true; } if (IsGroupInList(report.IncludeAllChildrenGroups, group)) { includeAllChildren = true; } if (IsGroupInList(report.IncludeDirectChildrenOnlyGroups, group)) { includeDirectChildrenOnly = true; } var includePart = $"{(includeAllChildren || includeDirectChildrenOnly ? $"{(scope ? ", " : "")}<{includeGroups}> as <{(includeAllChildren ? AllIn : OnlyIn)}>" : "")}"; stringBuilder.Append(reportTypeSuffix).Append(" <").Append(report.Template.Name).Append("> with the group above in ").Append(scope ? $"<{scopeGroups}>" : "").Append(includePart); }
static void InsertCustomReportScheduleForLogging(LinkedList <CustomReportSchedule> list, CustomReportSchedule valueToInsert, CustomReportScheduleComparerForLogging comparer) { if (list.Count == 0) { list.AddFirst(valueToInsert); return; } var currentInList = list.First; while (comparer.Compare(currentInList.Value, valueToInsert) < 0 && currentInList != list.Last) { currentInList = currentInList.Next; } if (comparer.Compare(currentInList.Value, valueToInsert) > 0) { list.AddBefore(currentInList, valueToInsert); //last was reached } else { list.AddAfter(currentInList, valueToInsert); } }