示例#1
0
        private SynchronizationReport GetReport()
        {
            var report = new SynchronizationReport
            {
                ADelta    = _aDelta,
                BDelta    = _bDelta,
                AJobsInfo = _aJobsInfo,
                BJobsInfo = _bJobsInfo,
                ExceptionThatLeadToAbortion = _exceptionThatLeadToAbortion,
                LoadErrors  = _loadErrors.ToArray(),
                ProfileId   = _profileId,
                ProfileName = _profileName,
                StartTime   = _startTime,
                EntitySynchronizationReports = _entitySynchronizationLoggers
                                               .Where(l => l.HasErrorsOrWarnings)
                                               .Select(l => l.GetReport())
                                               .ToArray(),
                Duration = DateTime.UtcNow - _startTime
            };

            if (_subReports != null)
            {
                report.MergeSubReport(_subReports);
            }

            return(report);
        }
示例#2
0
 public void PostReport(SynchronizationReport report)
 {
     if (_subReports == null)
     {
         _subReports = new List <SynchronizationReport>();
     }
     _subReports.Add(report);
 }
 public void AddReport (SynchronizationReport report)
 {
   if (report.HasErrors
       || AcceptAddingReportsWithJustWarnings && report.HasWarnings
       || AcceptAddingReportsWithoutWarningsOrErrors)
   {
     _inner.AddReport (report);
   }
 }
    public void AddReport (SynchronizationReport report)
    {
      var reportName = GetNextFreeName (_reportDirectory, report);

      using (var fileStream = File.Create (Path.Combine (_reportDirectory, reportName.ToString())))
      {
        Serializer<SynchronizationReport>.SerializeTo (report, fileStream);
      }

      OnReportAdded (reportName, report);
    }
    private void AddReportViewModel (SynchronizationReportName reportName, SynchronizationReport report)
    {
      string profileName;
      if (!_currentProfileNamesById.TryGetValue (reportName.SyncronizationProfileId, out profileName))
        profileName = "<Not existing anymore>";

      var reportProxy = new ReportProxy (reportName, () => report, profileName);
      var reportViewModel = new ReportViewModel (reportProxy, _reportRepository, this);
      _reports.Add (reportViewModel);
    }
 public void Update (SynchronizationReport report)
 {
   _lastSyncronizationRun = report.StartTime;
   LastResult =
       report.HasErrors
           ? SyncronizationRunResult.Error
           : report.HasWarnings
               ? SyncronizationRunResult.Warning
               : SyncronizationRunResult.Ok;
   RecalculateLastRunAgoInMinutes();
 }
 public ReportAddedEventArgs (SynchronizationReport report, SynchronizationReportName reportName)
     : base(report)
 {
   _reportName = reportName;
 }
 public ReportEventArgs (SynchronizationReport report)
 {
   _report = report;
 }
    public static ReportViewModel CreateDesignInstance (bool hasWarnings = false, bool hasErrors = false)
    {
      var report = new SynchronizationReport();
      report.ADelta = "This is the ADelta";
      report.BDelta = "This is the BDelta";

      var reportName = SynchronizationReportName.Create (Guid.NewGuid(), new DateTime (2000, 10, 10), hasWarnings, hasErrors);

      var proxy = new ReportProxy (reportName, () => report, "The profile name");

      return new ReportViewModel (proxy, NullSynchronizationReportRepository.Instance);
    }
    private SynchronizationReportName GetNextFreeName (string directory, SynchronizationReport report)
    {
      var reportName = SynchronizationReportName.Create (report.ProfileId, report.StartTime, report.HasWarnings, report.HasErrors);
      while (File.Exists (Path.Combine (directory, reportName.ToString())))
        reportName = reportName.IncreaseSequence();

      return reportName;
    }
 protected virtual void OnReportAdded (SynchronizationReportName name, SynchronizationReport report)
 {
   var handler = ReportAdded;
   if (handler != null)
     handler (this, new ReportAddedEventArgs (report, name));
 }
 public SynchronizationReportName AddReport (SynchronizationReport report)
 {
   throw new NotSupportedException();
 }
 public void Update (SynchronizationReport report)
 {
   ProfileStatusViewModel profileStatusViewModel;
   if (_profileStatusViewModelsById.TryGetValue (report.ProfileId, out profileStatusViewModel))
   {
     profileStatusViewModel.Update (report);
   }
 }
 public void NotifyUser (SynchronizationReport report, bool notifyWarnings, bool notifyErrors)
 {
   if (report.HasErrors && notifyErrors)
   {
     _nofifyIcon.ShowBalloonTip (
         10 * 1000,
         ComponentContainer.MessageBoxTitle,
         $"Syncronization profile '{report.ProfileName}' executed with error(s).",
         ToolTipIcon.Error);
   }
   else if (report.HasWarnings && notifyWarnings)
   {
     _nofifyIcon.ShowBalloonTip (
         10 * 1000,
         ComponentContainer.MessageBoxTitle,
         $"Syncronization profile '{report.ProfileName}' executed with warnings(s).",
         ToolTipIcon.Warning);
   }
 }
 public void AddReport (SynchronizationReport report)
 {
 }