Seal.Forms.ToolsHelper.SynchronizeSchedules C# (CSharp) Method

SynchronizeSchedules() public method

public SynchronizeSchedules ( ExecutionLogInterface log, string folder, Repository repository, int &count, int &errorCount, StringBuilder errorSummary, bool useCurrentUser ) : void
log ExecutionLogInterface
folder string
repository Seal.Model.Repository
count int
errorCount int
errorSummary StringBuilder
useCurrentUser bool
return void
        void SynchronizeSchedules(ExecutionLogInterface log, string folder, Repository repository, ref int count, ref int errorCount, StringBuilder errorSummary, bool useCurrentUser)
        {
            log.Log("Checking folder '{0}'", folder);
            foreach (string reportPath in Directory.GetFiles(folder, "*." + Repository.SealReportFileExtension))
            {
                try
                {
                    if (log.IsJobCancelled()) return;
                    count++;
                    Report report = Report.LoadFromFile(reportPath, repository);
                    report.SchedulesWithCurrentUser = useCurrentUser;
                    if (report.Schedules.Count > 0)
                    {
                        log.Log("Synchronizing schedules for report '{0}'", reportPath);
                        foreach (ReportSchedule schedule in report.Schedules)
                        {
                            if (log.IsJobCancelled()) return;
                            log.Log("Checking schedule '{0}'", schedule.Name);
                            try
                            {
                                Task task = schedule.FindTask();
                                if (task != null) schedule.SynchronizeTask();
                                else
                                {
                                    log.Log("Creating task for '{0}'", schedule.Name);
                                    schedule.SynchronizeTask();
                                }
                            }
                            catch (Exception ex)
                            {
                                errorCount++;
                                log.LogRaw("ERROR\r\n");
                                log.Log(ex.Message);
                                errorSummary.AppendFormat("\r\nReport '{0}' Schedule '{1}': {2}\r\n", reportPath, schedule.Name, ex.Message);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    errorCount++;
                    log.LogRaw("ERROR\r\n");
                    log.Log(ex.Message);
                    errorSummary.AppendFormat("\r\nReport '{0}': {1}\r\n", reportPath, ex.Message);
                }
            }

            foreach (string subFolder in Directory.GetDirectories(folder))
            {
                if (log.IsJobCancelled()) return;
                SynchronizeSchedules(log, subFolder, repository, ref count, ref errorCount, errorSummary, useCurrentUser);
            }

            log.LogRaw("\r\n");
        }

Same methods

ToolsHelper::SynchronizeSchedules ( ExecutionLogInterface log, bool useCurrentUser ) : void