public void ArchivalDataLoadInfo_ToString() { var adi = new ArchivalDataLoadInfo(); adi.StartTime = new DateTime(2010, 1, 1, 12, 0, 0); adi.EndTime = new DateTime(2010, 1, 3, 13, 20, 23); // This dle took 2 days, 1 hour, 20 mins and 23 seconds StringAssert.Contains("(49:20:23)", adi.ToString()); }
void _populateLoadHistory_DoWork(object sender, DoWorkEventArgs e) { ArchivalDataLoadInfo[] results; try { try { _logManager = new LogManager(_loadMetadata.GetDistinctLoggingDatabase()); results = _logManager.GetArchivalDataLoadInfos(_loadMetadata.GetDistinctLoggingTask(), _populateLoadHistoryCancel.Token, null, _toFetch).ToArray(); } catch (OperationCanceledException)//user cancels { results = new ArchivalDataLoadInfo[0]; } _populateLoadHistoryResults = results; } catch (Exception exception) { ragSmiley1.Fatal(exception); } }
void _populateLoadHistory_DoWork(object sender, DoWorkEventArgs e) { ArchivalDataLoadInfo[] results; try { try { _logManager = new LogManager(Collection.RootObject.GetDistinctLoggingDatabase()); var unfilteredResults = _logManager.GetArchivalDataLoadInfos(Collection.RootObject.GetDistinctLoggingTask(), _populateLoadHistoryCancel.Token, null, _toFetch); results = Collection.RootObject.FilterRuns(unfilteredResults).ToArray(); } catch (OperationCanceledException)//user cancels { results = new ArchivalDataLoadInfo[0]; } _populateLoadHistoryResults = results; } catch (Exception exception) { CommonFunctionality.Fatal("Failed to popualte load history", exception); } }
public void RefreshChartAsync() { if (VisualStudioDesignMode) { return; } pbLoading.Visible = true; olvDataLoads.ClearObjects(); ragSmiley1.Reset(); ragSmiley1.SetVisible(false); Thread t = new Thread(() => { try { int countManualLoadsuccessful = 0; int countManualLoadFailure = 0; foreach (LoadMetadata metadata in Activator.RepositoryLocator.CatalogueRepository.GetAllObjects <LoadMetadata>()) { try { LogManager logManager; try { //get the logging connection logManager = new LogManager(metadata.GetDistinctLoggingDatabase()); } catch (NotSupportedException e) { //sometimes a load metadata won't have any catalogues so we can't process it's log history if (e.Message.Contains("does not have any Catalogues associated with it")) { continue; } throw; } ArchivalDataLoadInfo archivalDataLoadInfo = logManager.GetArchivalDataLoadInfos(metadata.GetDistinctLoggingTask()).FirstOrDefault(); bool lastLoadWasError; var loadSummary = new DataLoadsGraphResult { ID = metadata.ID, Name = metadata.Name, }; if (archivalDataLoadInfo == null) { this.Invoke(new MethodInvoker(() => { loadSummary.Status = DataLoadsGraphResultStatus.NeverBeenRun; loadSummary.LastRun = "Never"; olvDataLoads.AddObject(loadSummary); ResizeColumns(); })); continue; //has never been run (or has had test runs only) } lastLoadWasError = archivalDataLoadInfo.Errors.Any() || archivalDataLoadInfo.EndTime == null; //while we were fetching data from database the form was closed if (IsDisposed || !IsHandleCreated) { return; } if (lastLoadWasError) { countManualLoadFailure++; } else { countManualLoadsuccessful++; } this.Invoke(new MethodInvoker(() => { loadSummary.Status = lastLoadWasError ? DataLoadsGraphResultStatus.Failing : DataLoadsGraphResultStatus.Succeeding; loadSummary.LastRun = archivalDataLoadInfo.EndTime.ToString(); olvDataLoads.AddObject(loadSummary); ResizeColumns(); })); } catch (Exception e) { ragSmiley1.Fatal(e); this.Invoke(new MethodInvoker(() => { pbLoading.Visible = false; })); } } //if there have been no loads at all ever if (countManualLoadsuccessful == 0 && countManualLoadFailure == 0) { this.Invoke(new MethodInvoker(() => { lblNoDataLoadsFound.Visible = true; chart1.Visible = false; pbLoading.Visible = false; })); return; } DataTable dt = new DataTable(); dt.Columns.Add("Category"); dt.Columns.Add("NumberOfDataLoadsAtStatus"); dt.Rows.Add(new object[] { "Manual Successful", countManualLoadsuccessful }); dt.Rows.Add(new object[] { "Manual Fail", countManualLoadFailure }); this.Invoke(new MethodInvoker(() => { chart1.Series[0].XValueMember = "Category"; chart1.Series[0].YValueMembers = "NumberOfDataLoadsAtStatus"; chart1.DataSource = dt; chart1.DataBind(); chart1.Series[0].Points[0].Color = Color.Green; chart1.Series[0].Points[1].Color = Color.Red; var max = new int[] { countManualLoadFailure, countManualLoadsuccessful }.Max(); int gridMarkEvery = max == 0 ? 1 : Math.Max(max / 10, 1); chart1.ChartAreas[0].AxisY.Interval = gridMarkEvery; chart1.ChartAreas[0].AxisY.MajorGrid.Interval = gridMarkEvery; chart1.ChartAreas[0].AxisY.MajorTickMark.Interval = gridMarkEvery; chart1.ChartAreas[0].AxisY.MajorTickMark.IntervalOffset = 0; chart1.ChartAreas[0].AxisY.IsMarginVisible = false; chart1.ChartAreas[0].AxisY.MinorGrid.Enabled = false; chart1.ChartAreas[0].AxisY.MinorTickMark.Enabled = false; pbLoading.Visible = false; })); } catch (Exception e) { ragSmiley1.Fatal(e); this.Invoke(new MethodInvoker(() => { pbLoading.Visible = false; })); } }); t.SetApartmentState(ApartmentState.STA); t.Start(); }
public Category(ArchivalDataLoadInfo dli, LoggingTables type) { _dli = dli; _type = type; }