Inheritance: Seal.Model.ReportComponent
Exemple #1
0
 void setContext(ITypeDescriptorContext context)
 {
     _metaConnection = context.Instance as MetaConnection;
     _metaEnum = context.Instance as MetaEnum;
     _metaTable = context.Instance as MetaTable;
     _metaColumn = context.Instance as MetaColumn;
     _metaJoin = context.Instance as MetaJoin;
     _reportView = context.Instance as ReportView;
     _reportOutput = context.Instance as ReportOutput;
     _reportSchedule = context.Instance as ReportSchedule;
     _parameter = context.Instance as Parameter;
     _security = context.Instance as SealSecurity;
     _emailDevice = context.Instance as OutputEmailDevice;
 }
        ReportSchedule getReportSchedule(Report report, string scheduleGUID)
        {
            ReportSchedule reportSchedule = report.Schedules.FirstOrDefault(i => i.GUID == scheduleGUID);

            if (reportSchedule == null)
            {
                //Remove the schedule
                var reportSchedules = _schedules.Values.Where(i => i.GUID == scheduleGUID).ToList();
                foreach (var schedule in reportSchedules)
                {
                    File.Delete(schedule.FilePath);
                    lock (_schedules)
                    {
                        _schedules.Remove(schedule.GUID);
                    }
                }
            }
            return(reportSchedule);
        }
Exemple #3
0
 /// <summary>
 /// Executes the audit script for a given event
 /// </summary>
 public static void LogAudit(AuditType type, SecurityUser user, string path = null, string detail = null, string error = null, Report report = null, ReportSchedule schedule = null)
 {
     try
     {
         if (Repository.Instance.Configuration.AuditEnabled)
         {
             var script = Repository.Instance.Configuration.AuditScript;
             if (string.IsNullOrEmpty(script))
             {
                 script = AuditScriptTemplate;
             }
             var audit = new Audit()
             {
                 Type = type, User = user, Path = path, Detail = detail, Error = error, Report = report, Schedule = schedule
             };
             RazorHelper.CompileExecute(script, audit, Key);
         }
     }
     catch (Exception ex)
     {
         var message = string.Format("Error executing the Audit Script:\r\n{0}", ex.Message);
         Helper.WriteLogEntry("Seal Audit", EventLogEntryType.Error, ex.Message);
     }
 }
Exemple #4
0
 /// <summary>
 /// Audit a report execution
 /// </summary>
 public static void LogReportAudit(AuditType type, SecurityUser user, Report report, ReportSchedule schedule)
 {
     Audit.LogAudit(report.HasErrors ? AuditType.ReportExecutionError : AuditType.ReportExecution, report.SecurityContext, report.FilePath, null, report.ExecutionErrors, report, schedule);
 }
 public void EditSchedule(ReportSchedule schedule)
 {
 }
Exemple #6
0
 public void RemoveSchedule(ReportSchedule schedule)
 {
     Schedules.Remove(schedule);
     SchedulesModified = true;
     //Do not sync taks here, it will be done when report is really saved...
 }
Exemple #7
0
 public void EditSchedule(ReportSchedule schedule)
 {
     try
     {
         TaskEditDialog frm = new TaskEditDialog(schedule.Task, true, true);
         frm.AvailableTabs = AvailableTaskTabs.General | AvailableTaskTabs.Actions | AvailableTaskTabs.Conditions | AvailableTaskTabs.Triggers | AvailableTaskTabs.Settings | AvailableTaskTabs.History;
         frm.ShowDialog(this);
     }
     catch (Exception ex)
     {
         throw new Exception(string.Format("Unable to edit the schedule...\r\nCheck that the 'Report Designer' has been executed with the option 'Run as administrator'\r\nOR\r\nSet the Report Designer option 'Schedule reports with current user.\r\n\r\n{0}", ex.Message));
     }
 }
        static void InitReportSchedule(string scheduleGUID, out Task task, out Report report, out ReportSchedule schedule)
        {
            if (string.IsNullOrEmpty(scheduleGUID)) throw new Exception("No schedule GUID specified !\r\n");

            Repository repository = Repository.Create();
            TaskService taskService = new TaskService();
            TaskFolder taskFolder = taskService.RootFolder.SubFolders.FirstOrDefault(i => i.Name == repository.Configuration.TaskFolderName);
            if (taskFolder == null) throw new Exception(string.Format("Unable to find schedule task folder '{0}'\r\nCheck your configuration...", repository.Configuration.TaskFolderName));

            task = taskFolder.GetTasks().FirstOrDefault(i => i.Definition.RegistrationInfo.Source.EndsWith(scheduleGUID));
            if (task == null) throw new Exception(string.Format("Unable to find schedule '{0}'\r\n", scheduleGUID));

            string reportPath = ReportSchedule.GetTaskSourceDetail(task.Definition.RegistrationInfo.Source, 0);
            string reportGUID = ReportSchedule.GetTaskSourceDetail(task.Definition.RegistrationInfo.Source, 1);
            report = GetScheduledReport(taskFolder, reportPath, reportGUID, scheduleGUID, repository);
            if (report == null) throw new Exception(string.Format("Unable to find report '{0}' for schedule '{1}'\r\nReport schedules have been deleted...", reportGUID, scheduleGUID));

            schedule = GetReportSchedule(taskFolder, report, scheduleGUID);
            if (schedule == null) throw new Exception(string.Format("Unable to find schedule '{0}' in report '{1}'.\r\nSchedule has been deleted", scheduleGUID, report.FilePath));
        }
Exemple #9
0
 /// <summary>
 /// Executes the audit script for a given event
 /// </summary>
 public static void LogAudit(AuditType type, SecurityUser user, Report report, ReportSchedule schedule)
 {
     try
     {
         var script = Repository.Instance.Configuration.AuditScript;
         if (!string.IsNullOrEmpty(Repository.Instance.Configuration.AuditScript))
         {
             var audit = new Audit()
             {
                 Type = type, User = user, Report = report, Schedule = schedule
             };
             RazorHelper.CompileExecute(script, audit, Key);
         }
     }
     catch (Exception ex)
     {
         var message = string.Format("Error executing the Audit Script:\r\n{0}", ex.Message);
         Helper.WriteLogEntry("Seal Audit", EventLogEntryType.Error, ex.Message);
     }
 }