public override void GetReportData(out ReportCounterData data, ReportOptions options) { data = new ReportCounterData(); data.Severity = MathF.Clamp(this.lastValue / Time.MsPFMult, 0.0f, 1.0f); if ((options & ReportOptions.LastValue) != ReportOptions.None) data.LastValue = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0:F}", this.lastValue); if (this.IsSingleValue) { if ((options & ReportOptions.AverageValue) != ReportOptions.None) data.AverageValue = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0:F}", this.lastValue); } else { if ((options & ReportOptions.AverageValue) != ReportOptions.None) data.AverageValue = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0:F}", (float)(this.accumValue / (double)this.sampleCount)); if ((options & ReportOptions.MinValue) != ReportOptions.None) data.MinValue = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0:F}", this.accumMinValue); if ((options & ReportOptions.MaxValue) != ReportOptions.None) data.MaxValue = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0:F}", this.accumMaxValue); if ((options & ReportOptions.SampleCount) != ReportOptions.None) data.SampleCount = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", this.sampleCount); } }
public void GenerateReport(ReportOptions reportOptions) { if (reportOptions.ReportType == ReportType.HTML) { HTMLReportHeader htmlHeader = new HTMLReportHeader(); htmlHeader.WriteHeaderDetails(); HTMLReportContent htmlContent = new HTMLReportContent(); htmlContent.WriteContents(); HTMLReportFooter htmlFooter = new HTMLReportFooter(); htmlFooter.WriteFooterDetails(); } else if (reportOptions.ReportType == ReportType.Text) { TextReportHeader textReportHeader = new TextReportHeader(); textReportHeader.WriteHeaderDetails(); TextReportContent textReportContent = new TextReportContent(); textReportContent.WriteContents(); TextReportFooter textReportFooter = new TextReportFooter(); textReportFooter.WriteFooterDetails(); } }
public void GenerateReport(ReportOptions reportOptions) { IReportGenerator reportGenerator = ReportGeneratorFactory.GetReportGenerator(reportOptions.ReportType); reportGenerator.GetReportHeader().WriteHeaderDetails(); reportGenerator.GetReportContent().WriteContents(); reportGenerator.GetReportFooter().WriteFooterDetails(); }
public void Execute() { var reportFileName = _dialogCreator.AskForFileToSave(PKSimConstants.UI.CreateReportTitle, Constants.Filter.EXCEL_SAVE_FILE_FILTER, Constants.DirectoryKey.REPORT, _workspace.Project.Name); if (reportFileName.IsNullOrEmpty()) { return; } var reportOptions = new ReportOptions { ReportFullPath = reportFileName, SheetName = _workspace.Project.Name, OpenReport = true }; _reportTask.CreateReport(_workspace.HistoryManager, reportOptions); }
internal static void SendFriendlyWatson(Exception ex, bool collectMemoryDump, string additionalData = null) { if (Debugger.IsAttached) { Debugger.Break(); } ReportOptions reportOptions = ReportOptions.DeepStackTraceHash; if (!collectMemoryDump) { reportOptions |= ReportOptions.DoNotCollectDumps; } ExWatson.SendReport(ex, reportOptions, additionalData); }
public void Prepare(List <StatementData> statements, ReportOptions reportOptions) { var trades = Consolidate(statements); trades = trades .OrderBy(x => x.AssetCategoryType) .ThenBy(x => x.Symbol) .ThenBy(x => x.DateTime) .ToList(); var closedTrades = GetClosedTrades(reportOptions, trades); taxReport.TradeData.Trades = Convert(reportOptions, closedTrades); }
public EpplusExcelWorkbook(FileInfo pathToWorkbook, ReportOptions excelOptions) { pathToWorkbook.ThrowIfNull(nameof(pathToWorkbook)); InitPackageLicence(); _excelOptions = excelOptions.ThrowIfNull(nameof(excelOptions)); _package = new ExcelPackage(pathToWorkbook); _formulaProvider = ExcelWrapperFactory.CreateFormulaProvider(excelOptions); _epplusLogger = new EpplusLogger(_package, ConfigOptions.Logger); _epplusLogger.AttachLogger(); RegisterFunctionModules(); }
public HomeController( IMediator mediator, IReportGenerator reportGenerator, IProductMapperFactory productMapperFactory, IStringLocalizer <SharedLocalizationResources> localizer, IPrePopulatedValuesSetter prePopulatedValuesSetter, IOptionsSnapshot <ReportOptions> options) { _mediator = mediator; _reportGenerator = reportGenerator; _productMapperFactory = productMapperFactory; _localizer = localizer; _prePopulatedValuesSetter = prePopulatedValuesSetter; _reportOptions = options.Value; }
public TemplateSetupForm(ReportOptions option) { InitializeComponent(); #region 如果系統的Renderer是Office2007Renderer,同化_ClassTeacherView,_CategoryView的顏色 if (GlobalManager.Renderer is Office2007Renderer) { ((Office2007Renderer)GlobalManager.Renderer).ColorTableChanged += new EventHandler(ScoreCalcRuleEditor_ColorTableChanged); SetForeColor(this); } #endregion _option = option; Load(); }
public override async Task <IViewProviderResult> BuildUpdateAsync(PageViewIndex viewModel, IViewProviderContext context) { var model = new ReportOptions(); if (!await context.Updater.TryUpdateModelAsync(model)) { return(await BuildIndexAsync(viewModel, context)); } if (context.Updater.ModelState.IsValid) { } return(await BuildIndexAsync(viewModel, context)); }
public override Task <IViewProviderResult> BuildIndexAsync(AdminIndex viewModel, IViewProviderContext context) { // Get range to display var range = _dateRangeStorage.Contextualize(context.Controller.ControllerContext); var reportIndexOptions = new ReportOptions() { Start = range.Start, End = range.End }; // Return view return(Task.FromResult(Views( View <ReportOptions>("Reports.Entities.AdminIndex", model => reportIndexOptions).Zone("content").Order(1).Order(1) ))); }
public async Task <IViewComponentResult> InvokeAsync(ReportOptions options) { if (options == null) { options = new ReportOptions(); } // Get reputation awarded for visits by grouped by CreatedDate var data = await _aggregatedUserReputationRepository.SelectGroupedByNameAsync( "Visit", "CreatedDate", options.Start, options.End); return(View(data.MergeIntoRange(options.Start, options.End))); }
public async Task <IViewComponentResult> InvokeAsync( ReportOptions options, PagerOptions pager) { if (options == null) { options = new ReportOptions(); } if (pager == null) { pager = new PagerOptions(); } return(View(await GetViewModel(options, pager))); }
private static void CreateHtmlAndPdf(PhysicalInstance dataset) { string resourcePath = Path.Combine("Resources", "icons", "types"); string baseFileName = "codebook"; string addinsPath = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Algenta", "Colectica", "Addins"); // Set some options for the report. var options = new ReportOptions(); options.IsAccessibilityMode = false; var builder = new ReportBuilder(); // Use the custom codebook format. builder.Builders = new List <IDocumentationBuilder>(); builder.Builders.Add(new SampleCustomCodebookBuilder()); // Create English PDF. MultilingualString.CurrentCulture = "en"; byte[] englishPdfBytes = builder.CreatePdf(dataset, resourcePath, addinsPath, options, null, null); string englishPdfFileName = $"{baseFileName}_en.pdf"; File.WriteAllBytes(englishPdfFileName, englishPdfBytes); // Create English HTML. string englishHtml = builder.CreateHtml(dataset, resourcePath, addinsPath, options, null, null); string englishHtmlFileName = $"{baseFileName}_en.html"; File.WriteAllText(englishHtmlFileName, englishHtml); // Create French PDF. MultilingualString.CurrentCulture = "fr"; byte[] frenchPdfBytes = builder.CreatePdf(dataset, resourcePath, addinsPath, options, null, null); string frenchPdfFileName = $"{baseFileName}_fr.pdf"; File.WriteAllBytes(frenchPdfFileName, frenchPdfBytes); // Create French HTML. string frenchHtml = builder.CreateHtml(dataset, resourcePath, addinsPath, options, null, null); string frenchHtmlFileName = $"{baseFileName}_fr.html"; File.WriteAllText(frenchHtmlFileName, frenchHtml); }
public void GetQueryForReportOptions_InvalidOrderRequest_BadProperty() { var opts = new ReportOptions() { skip = 0, take = 20 }; opts.sort = new SortOptions[1]; opts.sort[0] = new SortOptions() { field = "badproperty", dir = SortDirection.desc }; var result = _controller.GetQueryForReportOptions <TestObject, TestObjectResource>(_testsource, opts); Assert.Equal(2, result.Count()); }
public override async Task <IViewProviderResult> BuildUpdateAsync(FeatureViewIndex viewModel, IViewProviderContext context) { var model = new ReportOptions(); if (!await context.Updater.TryUpdateModelAsync(model)) { return(await BuildIndexAsync(viewModel, context)); } if (context.Updater.ModelState.IsValid) { var storage = _dateRangeStorage.Contextualize(context.Controller.ControllerContext); storage.Set(model.Start, model.End); } return(await BuildIndexAsync(viewModel, context)); }
public void GetQueryForReportOptions_InalidFilterRequest_BadProperty() { var opts = new ReportOptions() { skip = 0, take = 10 }; opts.filter = new FilterOptions[1]; opts.filter[0] = new FilterOptions() { field = "badproperty", @operator = FilterOperator.eq, value = "test1" }; var result = _controller.GetQueryForReportOptions <TestObject, TestObjectResource>(_testsource, opts); Assert.Equal(2, result.Count()); }
private List <StatementData> ParseStatements(ReportOptions reportOptions) { brokerParserProvider = brokerParserProviderFactory.CreateNew(reportOptions.BrokerCode.ToString()); var statementParser = brokerParserProvider.StatementParser; var statements = new List <StatementData>(); var profile = reportOptions.Profile; foreach (var stmData in profile.Statements) { var stm = statementParser.ParseStatement(stmData); statements.Add(stm); } return(statements); }
public virtual void Prepare( IBrokerParserProvider brokerParserProvider, IEnumerable <StatementData> statements, ReportOptions reportOptions, Action <IList <T> > onReadyCallback) { var entities = Load(brokerParserProvider, statements); entities = Filter(reportOptions, entities); //IList<object> generalList = entities.Select(x=>(object)x).ToList(); //foreach (var transformer in transformers) //{ // generalList = transformer.Transform(generalList); //} onReadyCallback(entities); }
public static ReportOptions fromBytes(this ReportOptions res, byte[] value) { res = ReportOptions.NONE; if (value == null || value.Length < 1) { return(res); } if ((value[0] & Scsm_MMS.OptFldsSeqNum) == Scsm_MMS.OptFldsSeqNum) { res |= ReportOptions.SEQ_NUM; } if ((value[0] & Scsm_MMS.OptFldsTimeOfEntry) == Scsm_MMS.OptFldsTimeOfEntry) { res |= ReportOptions.TIME_STAMP; } if ((value[0] & Scsm_MMS.OptFldsReasonCode) == Scsm_MMS.OptFldsReasonCode) { res |= ReportOptions.REASON_FOR_INCLUSION; } if ((value[0] & Scsm_MMS.OptFldsDataSet) == Scsm_MMS.OptFldsDataSet) { res |= ReportOptions.DATA_SET; } if ((value[0] & Scsm_MMS.OptFldsDataReference) == Scsm_MMS.OptFldsDataReference) { res |= ReportOptions.DATA_REFERENCE; } if ((value[0] & Scsm_MMS.OptFldsOvfl) == Scsm_MMS.OptFldsOvfl) { res |= ReportOptions.BUFFER_OVERFLOW; } if ((value[0] & Scsm_MMS.OptFldsEntryID) == Scsm_MMS.OptFldsEntryID) { res |= ReportOptions.ENTRY_ID; } if (value.Length < 2) { return(res); } if ((value[1] & Scsm_MMS.OptFldsConfRev) == Scsm_MMS.OptFldsConfRev) { res |= ReportOptions.CONF_REV; } return(res); }
public void GetQueryForReportOptions_ValidFilterRequest() { var opts = new ReportOptions() { skip = 0, take = 10 }; opts.filter = new FilterOptions[1]; opts.filter[0] = new FilterOptions() { field = "myproperty1", @operator = FilterOperator.eq, value = "test1" }; var result = _controller.GetQueryForReportOptions <TestObject, TestObjectResource>(_testsource, opts).ToList(); Assert.Single(result); Assert.Equal("test1", result.First().Property1); }
/// <summary> /// Inject Options, then build up items we need /// </summary> /// <param name="options"></param> public ReportsController(ILogger <ReportsController> logger, IOptions <ReportOptions> options, IOptions <ReportConnectionOptions> connOptions, IServiceProvider provider) { // Injected Options _logger = logger; _options = options.Value; _connOptions = connOptions.Value; //Build the rest depending on setting if (_options.IncludeAuth) { _client96 = provider.GetRequiredService <RepGen96.PERepGenSoap>(); _authInfo = provider.GetRequiredService <RepGen96.AuthenticationInformation>(); } else { _client95 = provider.GetRequiredService <RepGen95.PERepGenSoap>(); } }
public static IExcelWorkbook CreateWorkbook(FileInfo outputReportFile, ReportOptions reportOptions) { reportOptions.ThrowIfNull(nameof(reportOptions)); return(reportOptions.LibraryProvider switch { ExcelLibraryProvider.NPOI => new NpoiExcelWorkbook(outputReportFile, reportOptions), ExcelLibraryProvider.EPPlus => new EpplusExcelWorkbook(outputReportFile, reportOptions), _ => throw new ArgumentOutOfRangeException( nameof(reportOptions), reportOptions.LibraryProvider, $"Unknown Excel library provider: '{reportOptions.LibraryProvider.ToString()}'." ) });
public override Task <IViewProviderResult> BuildIndexAsync(FeatureViewIndex viewReportModel, IViewProviderContext context) { // Get range to display var range = _dateRangeStorage.Contextualize(context.Controller.ControllerContext); // Build index view model var reportIndexOptions = new ReportOptions() { Start = range.Start, End = range.End }; return(Task.FromResult(Views( View <ReportOptions>("Admin.Index.Header", model => reportIndexOptions).Zone("header").Order(1), View <ReportOptions>("Admin.Index.Tools", model => reportIndexOptions).Zone("tools").Order(1), View <ReportOptions>("Admin.Index.Content", model => reportIndexOptions).Zone("content").Order(1) ))); }
public WindowsServiceTests() { _currentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); _outputDirectory = Path.Combine(_currentDirectory, "output"); _hostFileName = Path.Combine(_currentDirectory, "PowerTradingOverview.Host.exe"); _logFileName = Path.Combine(_currentDirectory, "PowerTradingOverview.log"); _serviceName = "PowerTradingOverview$test"; _serviceRunner = new TopshelfServiceRunner(_hostFileName, "test"); _timeZone = "GMT Standard Time"; _reportInterval = TimeSpan.FromSeconds(10); _reportOptions = new ReportOptions( _timeZone, "output", "PowerPosition_{0:yyyyMMdd_HHmmss}.csv", _reportInterval); _csvFileNameRegex = new Regex(@"PowerPosition_(\d{8}_\d{6}).csv"); _reportTimeDeviation = TimeSpan.FromSeconds(5); _csvContentRegex = @"^Date,Periods,Volume(\n|\r|\r\n){0:dd-MMM-yyyy}(,\d+,\d+.\d+(\n|\r|\r\n))+$"; }
public static void ProcessReportOptions(ReportOptions ro, XmlWriter xmlw) { xmlw.WriteStartElement("ReportOptions"); xmlw.WriteAttributeString("CanSelectDistinctRecords", ro.CanSelectDistinctRecords.ToStringSafe()); xmlw.WriteAttributeString("ConvertDateTimeType", ro.ConvertDateTimeType.ToStringSafe()); xmlw.WriteAttributeString("ConvertNullFieldToDefault", ro.ConvertNullFieldToDefault.ToStringSafe()); xmlw.WriteAttributeString("ConvertOtherNullsToDefault", ro.ConvertOtherNullsToDefault.ToStringSafe()); xmlw.WriteAttributeString("EnableAsyncQuery", ro.EnableAsyncQuery.ToStringSafe()); xmlw.WriteAttributeString("EnablePushDownGroupBy", ro.EnablePushDownGroupBy.ToStringSafe()); xmlw.WriteAttributeString("EnableSaveDataWithReport", ro.EnableSaveDataWithReport.ToStringSafe()); xmlw.WriteAttributeString("EnableSelectDistinctRecords", ro.EnableSelectDistinctRecords.ToStringSafe()); xmlw.WriteAttributeString("EnableUseIndexForSpeed", ro.EnableUseIndexForSpeed.ToStringSafe()); xmlw.WriteAttributeString("ErrorOnMaxNumOfRecords", ro.ErrorOnMaxNumOfRecords.ToStringSafe()); xmlw.WriteAttributeString("InitialDataContext", ro.InitialDataContext); xmlw.WriteAttributeString("InitialReportPartName", ro.InitialReportPartName); xmlw.WriteAttributeString("MaxNumOfRecords", ro.MaxNumOfRecords.ToStringSafe()); xmlw.WriteAttributeString("RefreshCEProperties", ro.RefreshCEProperties.ToStringSafe()); xmlw.WriteEndElement(); }
public void GetQueryForReportOptions_ValidOrderRequest() { var opts = new ReportOptions() { skip = 0, take = 20 }; opts.sort = new SortOptions[1]; opts.sort[0] = new SortOptions() { field = "myproperty1", dir = SortDirection.desc }; var result = _controller.GetQueryForReportOptions <TestObject, TestObjectResource>(_testsource, opts); Assert.Equal(2, result.Count()); Assert.Equal("test2", result.First().Property1); Assert.Equal("test1", result.Last().Property1); }
public void Generate() { Mock <IDocumentBuilder> builder = mockFactory.CreateMock <IDocumentBuilder>(); builder.Expects.One .Method(b => b.AddReportHeader(new DateTime(), null, null)) .WithAnyArguments(); builder.Expects.AtLeast(2) .Method(b => b.AddSectionHeader(null)) .WithAnyArguments(); builder.Expects.Exactly(matchingFiles.Count) .Method(b => b.AddSearchResult(new SearchResult())) .WithAnyArguments(); builder.Expects.One .Method(b => b.AddReportFooter()); builder.Expects.One .Method(b => b.Save(null)) .With(outputFilename); builder.Expects.Exactly(matchingFiles.Count) .Method(b => b.BeginContextBlock()); builder.Expects.Exactly(matchingFiles.Count) .Method(b => b.EndContextBlock()); builder.Expects.Exactly(matchingFiles.Count) .Method(b => b.AddContextText(null, TextStyle.Normal)) .With("string", TextStyle.Bold); builder.Expects.Exactly(matchingFiles.Count) .Method(b => b.AddContextText(null, TextStyle.Normal)) .With("... ", TextStyle.Normal); builder.Expects.Exactly(matchingFiles.Count * 2) .Method(b => b.AddContextText(null, TextStyle.Normal)) .With(" ... ", TextStyle.Normal); builder.Expects.Exactly(matchingFiles.Count) .Method(b => b.AddContextText(null, TextStyle.Normal)) .With(" ...", TextStyle.Normal); SummaryGenerator generator = new SummaryGenerator(); ReportOptions options = new ReportOptions(); options.outputFilePath = outputFilename; options.contextSizeChars = 0; generator.Generate(builder.MockObject, options, searchQuery, inputPaths, matchingFiles); }
private IList <ClosedOperation <ConvertedTrade> > Convert(ReportOptions reportOptions, IList <ClosedOperation <Trade> > trades) { var convertedTrades = new List <ClosedOperation <ConvertedTrade> >(); foreach (var ct in trades) { var convertedOperation = new ClosedOperation <ConvertedTrade>(); convertedOperation.OpenTrades.AddRange(tradeConvertor.Convert(reportOptions.Profile.TaxCurrency, ct.OpenTrades) .Select(x => new ConvertedTrade(x))); convertedOperation.CloseTrade = new ConvertedTrade(tradeConvertor.Convert(reportOptions.Profile.TaxCurrency, ct.CloseTrade)); convertedOperation.Validate(); convertedTrades.Add(convertedOperation); } return(convertedTrades); }
public async Task <IActionResult> IndexPost(ReportOptions opts, PagerOptions pager) { // Default options if (opts == null) { opts = new ReportOptions(); } // Default pager if (pager == null) { pager = new PagerOptions(); } // Build view model var viewModel = await GetIndexViewModelAsync(opts, pager); // Add view model to context HttpContext.Items[typeof(ReportIndexViewModel <Metric>)] = viewModel; // Execute view providers await _pageViewsViewProvider.ProvideUpdateAsync(new PageViewIndex(), this); // May have been invalidated by a view provider if (!ModelState.IsValid) { // if we reach this point some view model validation // failed within a view provider, display model state errors foreach (var modelState in ViewData.ModelState.Values) { foreach (var error in modelState.Errors) { _alerter.Danger(T[error.ErrorMessage]); } } } return(await Index(opts, new PagerOptions() { Page = 1 })); }
private void GenerateReport(IProgressMonitor progressMonitor) { using (var subProgressMonitor = progressMonitor.CreateSubProgressMonitor(5)) { if (!optionsController.GenerateReportAfterTestRun) { return; } var reportOptions = new ReportOptions(projectController.ReportDirectory, projectController.ReportNameFormat); var cmd = new GenerateReportCommand(testController, reportController) { ReportOptions = reportOptions }; cmd.Execute(subProgressMonitor); } }
public override Task <IViewProviderResult> BuildIndexAsync(AdminIndex viewModel, IViewProviderContext context) { // Get range to display var range = _dateRangeStorage.Contextualize(context.Controller.ControllerContext); // Build index view model var reportIndexOptions = new ReportOptions() { Start = range.Start, End = range.End }; return(Task.FromResult(Views( //View<ReportOptions>("Reports.Admin.Index.Tools", model => reportIndexOptions).Zone("tools") // .Order(int.MinValue), View <ReportOptions>("Reports.AdminIndex", model => reportIndexOptions).Zone("content") .Order(int.MinValue) ))); }
public async Task <IViewComponentResult> InvokeAsync( ReportOptions options, ChartOptions chart) { if (options == null) { options = new ReportOptions(); } if (chart == null) { chart = new ChartOptions(); } return(View(new ChartViewModel <IEnumerable <AggregatedModel <int, User> > >() { Options = chart, Data = await SelectUsersByReputationAsync(options) })); }
public void Generate() { Mock<IDocumentBuilder> builder = mockFactory.CreateMock<IDocumentBuilder>(); builder.Expects.One .Method(b => b.AddReportHeader(new DateTime(), null, null)) .WithAnyArguments(); builder.Expects.AtLeast(2) .Method(b => b.AddSectionHeader(null)) .WithAnyArguments(); builder.Expects.Exactly(matchingFiles.Count) .Method(b => b.AddSearchResult(new SearchResult())) .WithAnyArguments(); builder.Expects.One .Method(b => b.AddReportFooter()); builder.Expects.One .Method(b => b.Save(null)) .With(outputFilename); builder.Expects.Exactly(matchingFiles.Count) .Method(b => b.BeginContextBlock()); builder.Expects.Exactly(matchingFiles.Count) .Method(b => b.EndContextBlock()); builder.Expects.Exactly(matchingFiles.Count) .Method(b => b.AddContextText(null, TextStyle.Normal)) .With("string", TextStyle.Bold); builder.Expects.Exactly(matchingFiles.Count) .Method(b => b.AddContextText(null, TextStyle.Normal)) .With("... ", TextStyle.Normal); builder.Expects.Exactly(matchingFiles.Count * 2) .Method(b => b.AddContextText(null, TextStyle.Normal)) .With(" ... ", TextStyle.Normal); builder.Expects.Exactly(matchingFiles.Count) .Method(b => b.AddContextText(null, TextStyle.Normal)) .With(" ...", TextStyle.Normal); SummaryGenerator generator = new SummaryGenerator(); ReportOptions options = new ReportOptions(); options.outputFilePath = outputFilename; options.contextSizeChars = 0; generator.Generate(builder.MockObject, options, searchQuery, inputPaths, matchingFiles); }
/// <summary> /// Gathers ProfileCounter data for generating a profile report. /// </summary> /// <param name="data"></param> /// <param name="options"></param> public abstract void GetReportData(out ReportCounterData data, ReportOptions options);
public void Report(ReportOptions opts) { if (Output == null) throw new ArgumentNullException("Output"); Output.WriteLine(); Output.WriteLine("\t\t\tCalls\tFailed\tAvg\tMedian\tMin\tMax" + ((SlaTarget > 0) ? "\tSLA %" : "")); _plans.RemoveAll(p => p.IsWarmUp); var tcntTotal = _plans.Sum(p => p.Results.Count); var tcntFailed = _plans.Sum(p => p.Results.Count(r => r.Failed)); var tsucceed = _plans.SelectMany(p => p.Results.Where(r => !r.Failed)).ToList(); var totalOk = (double) _plans.Sum(p => p.Results.Count(r => r.Elapsed.TotalMilliseconds < SlaTarget)); Output.WriteLine("{0}\t{1}\t{2}\t{3:s\\.fff}\t{4:s\\.fff}\t{5:s\\.fff}\t{6:s\\.fff}" + ((SlaTarget > 0) ? "\t{7:00.000}" : ""), "Total".PadRight(22), tcntTotal, tcntFailed, tcntTotal > tcntFailed ? new TimeSpan(0, 0, 0, 0, (int)tsucceed.Average(t => t.Elapsed.TotalMilliseconds)) : new TimeSpan(), tcntTotal > tcntFailed ? new TimeSpan(0, 0, 0, 0, (int)tsucceed.Median(t => t.Elapsed.TotalMilliseconds)) : new TimeSpan(), tcntTotal > tcntFailed ? new TimeSpan(0, 0, 0, 0, (int)tsucceed.Min(t => t.Elapsed.TotalMilliseconds)) : new TimeSpan(), tcntTotal > tcntFailed ? new TimeSpan(0, 0, 0, 0, (int)tsucceed.Max(t => t.Elapsed.TotalMilliseconds)) : new TimeSpan(), (SlaTarget > 0 && tcntTotal > tcntFailed) ? ( totalOk * 100D) / Convert.ToDouble(tcntTotal) : 0 ); Output.WriteLine("-------------------------------------------------------------------------------"); foreach (var plan in _plans) { var cntTotal = plan.Results.Count(); var cntFailed = plan.Results.Count(t => t.Failed); var succeed = plan.Results.Where(t => !t.Failed).ToList(); var planOk = (double) plan.Results.Count(r => r.Elapsed.TotalMilliseconds < SlaTarget); Output.WriteLine("{0}\t{1}\t{2}\t{3:s\\.fff}\t{4:s\\.fff}\t{5:s\\.fff}\t{6:s\\.fff}" + ((SlaTarget > 0) ? "\t{7:00.000}" : ""), plan.Name.PadRight(22), cntTotal, cntFailed, cntTotal > cntFailed ? new TimeSpan(0, 0, 0, 0, (int)succeed.Average(t => t.Elapsed.TotalMilliseconds)) : new TimeSpan(), cntTotal > cntFailed ? new TimeSpan(0, 0, 0, 0, (int)succeed.Median(t => t.Elapsed.TotalMilliseconds)) : new TimeSpan(), cntTotal > cntFailed ? new TimeSpan(0, 0, 0, 0, (int)succeed.Min(t => t.Elapsed.TotalMilliseconds)) : new TimeSpan(), cntTotal > cntFailed ? new TimeSpan(0, 0, 0, 0, (int)succeed.Max(t => t.Elapsed.TotalMilliseconds)) : new TimeSpan(), (SlaTarget > 0 && cntTotal > cntFailed) ? ( planOk * 100D) / Convert.ToDouble(cntTotal) : 0 ); } if (opts.HasFlag(ReportOptions.Totals)) { Output.WriteLine(); Output.WriteLine("Plan totals:"); Output.WriteLine("-------------------------------------------------------------------------------"); foreach (var plan in _plans) { Output.WriteLine("{3}:\ttotal of {0} tasks run in {1:hh\\:mm\\:ss\\.ffff} ({2:N} req/s)", plan.Results.Count, plan.Elapsed, plan.Results.Count / plan.Elapsed.TotalSeconds, plan.Name.PadRight(22)); } } if (opts.HasFlag(ReportOptions.Slowest)) { Output.WriteLine(); Output.WriteLine("-------------------------------------------------------------------------------"); Output.WriteLine("Slowest tasks:"); foreach (var plan in _plans) { Output.WriteLine("\t" + plan.Name + ":"); foreach (var result in plan.Results.OrderByDescending(r => r.Elapsed.TotalMilliseconds).Take(5)) { Output.WriteLine("\ttask id: {0}, elapsed: {1:mm\\:ss\\.ffff}", result.Name, result.Elapsed); } } } }
/// <summary>Launches a new thread and executes a commission report</summary> /// <param name="report">The type of report to run</param> /// <param name="message">The status message to display to the user</param> /// <param name="isProcessing">Whether or not this report is being run as part of the processing routine</param> /// <param name="reportOptions">TBD</param> private void RunReportThread(ReportType report, string message, bool isProcessing, ReportOptions? reportOptions) { Thread reportThread; ReportOptions theReportOptions; if (reportOptions == null) { theReportOptions = new ReportOptions(); theReportOptions.UserId = (!isProcessing) ? Security.GetCurrentUserId : FOR_ARCHIVE_USER_NAME; theReportOptions.SelectedReportType = report; theReportOptions.ProcessYear = Convert.ToInt32(labelProcessYear.Text); } else { theReportOptions = (ReportOptions)reportOptions; } switch (report) { case ReportType.AccountingCommission: theReportOptions.CompanyId = Convert.ToInt32(dropDownACRptCompany.SelectedValue); reportThread = new Thread(new ParameterizedThreadStart(ExecuteACRReport)); break; case ReportType.AccountingCommissionByAE: theReportOptions.CompanyId = Convert.ToInt32(dropDownACByAERptCompany.SelectedValue); reportThread = new Thread(new ParameterizedThreadStart(ExecuteACRAEReport)); break; case ReportType.FlashCommissionByAE: theReportOptions.CompanyId = Convert.ToInt32(dropDownFlashRptCompany.SelectedValue); reportThread = new Thread(new ParameterizedThreadStart(ExecuteFlashCommissionReport)); break; case ReportType.CommissionAnalysis: theReportOptions.CompanyId = Convert.ToInt32(dropDownCommAnlRptCompany.SelectedValue); reportThread = new Thread(new ParameterizedThreadStart(ExecuteCommissionAnalysisReport)); break; case ReportType.CommissionByMarket: theReportOptions.CompanyId = Convert.ToInt32(dropDownAECommByMktRptCompany.SelectedValue); reportThread = new Thread(new ParameterizedThreadStart(ExecuteCommissionByMarketReport)); break; default: throw new ArgumentOutOfRangeException("report", "report did not contain a valid ReportTypes value"); } reportThread.Start(theReportOptions); ShowWorkingMessage(message); }
/// <summary>Calculates the commission values for contracts</summary> /// <param name="requestedReportType">TBD</param> private void ProcessCommissions(ReportType requestedReportType) { try { IsProcessing = true; ReportOptions reportOptions = new ReportOptions(); reportOptions.UserId = Security.GetCurrentUserId; reportOptions.SelectedReportType = requestedReportType; Thread reportThread; reportThread = new Thread(new ParameterizedThreadStart(ProcessCommissionsThread)); reportThread.Start(reportOptions); } catch (System.Data.SqlClient.SqlException ex) { IsProcessing = false; WebCommon.LogExceptionInfo(ex); } }
public ActionResult Export(ReportOptions options) { using (var pck = new ExcelPackage()) { /* //Create the worksheet ExcelWorksheet ws = pck.Workbook.Worksheets.Add("Demo"); //Load the datatable into the sheet, starting from cell A1. Print the column names on row 1 ws.Cells["A1"].LoadFromDataTable(tbl, true); //Format the header for column 1-3 using (ExcelRange rng = ws.Cells["A1:C1"]) { rng.Style.Font.Bold = true; rng.Style.Fill.PatternType = ExcelFillStyle.Solid; //Set Pattern for the background to Solid rng.Style.Fill.BackgroundColor.SetColor(Color.FromArgb(79, 129, 189)); //Set color to dark blue rng.Style.Font.Color.SetColor(Color.White); } //Example how to Format Column 1 as numeric using (ExcelRange col = ws.Cells[2, 1, 2 + tbl.Rows.Count, 1]) { col.Style.Numberformat.Format = "#,##0.00"; col.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right; } //Write it back to the client Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("content-disposition", "attachment; filename=ExcelDemo.xlsx"); Response.BinaryWrite(pck.GetAsByteArray()); return new FileStreamResult(); //return new ExcelExportResult(); */ throw new NotImplementedException(); } }
/// <summary> Gets report option. </summary> /// <param name="header"> The header. </param> /// <param name="sortField"> The sort field. </param> /// <returns> The report option. </returns> private ReportOptions<BaseItem> GetReportOption(HeaderMetadata header, string sortField = "") { ReportHeader reportHeader = new ReportHeader { HeaderFieldType = ReportFieldType.String, SortField = sortField, Type = "", ItemViewType = ItemViewType.None }; Func<BaseItem, ReportRow, object> column = null; Func<BaseItem, object> itemId = null; HeaderMetadata internalHeader = header; switch (header) { case HeaderMetadata.StatusImage: reportHeader.ItemViewType = ItemViewType.StatusImage; internalHeader = HeaderMetadata.Status; reportHeader.CanGroup = false; break; case HeaderMetadata.Name: column = (i, r) => i.Name; reportHeader.ItemViewType = ItemViewType.Detail; reportHeader.SortField = "SortName"; break; case HeaderMetadata.DateAdded: column = (i, r) => i.DateCreated; reportHeader.SortField = "DateCreated,SortName"; reportHeader.HeaderFieldType = ReportFieldType.DateTime; reportHeader.Type = ""; break; case HeaderMetadata.PremiereDate: case HeaderMetadata.ReleaseDate: column = (i, r) => i.PremiereDate; reportHeader.HeaderFieldType = ReportFieldType.DateTime; reportHeader.SortField = "ProductionYear,PremiereDate,SortName"; break; case HeaderMetadata.Runtime: column = (i, r) => this.GetRuntimeDateTime(i.RunTimeTicks); reportHeader.HeaderFieldType = ReportFieldType.Minutes; reportHeader.SortField = "Runtime,SortName"; break; case HeaderMetadata.PlayCount: reportHeader.HeaderFieldType = ReportFieldType.Int; break; case HeaderMetadata.Season: column = (i, r) => this.GetEpisode(i); reportHeader.ItemViewType = ItemViewType.Detail; reportHeader.SortField = "SortName"; break; case HeaderMetadata.SeasonNumber: column = (i, r) => this.GetObject<Season, string>(i, (x) => x.IndexNumber == null ? "" : x.IndexNumber.ToString()); reportHeader.SortField = "IndexNumber"; reportHeader.HeaderFieldType = ReportFieldType.Int; break; case HeaderMetadata.Series: column = (i, r) => this.GetObject<IHasSeries, string>(i, (x) => x.SeriesName); reportHeader.ItemViewType = ItemViewType.Detail; reportHeader.SortField = "SeriesSortName,SortName"; break; case HeaderMetadata.EpisodeSeries: column = (i, r) => this.GetObject<IHasSeries, string>(i, (x) => x.SeriesName); reportHeader.ItemViewType = ItemViewType.Detail; itemId = (i) => { Series series = this.GetObject<Episode, Series>(i, (x) => x.Series); if (series == null) return string.Empty; return series.Id; }; reportHeader.SortField = "SeriesSortName,SortName"; internalHeader = HeaderMetadata.Series; break; case HeaderMetadata.EpisodeSeason: column = (i, r) => this.GetObject<IHasSeries, string>(i, (x) => x.SeriesName); reportHeader.ItemViewType = ItemViewType.Detail; itemId = (i) => { Season season = this.GetObject<Episode, Season>(i, (x) => x.Season); if (season == null) return string.Empty; return season.Id; }; reportHeader.SortField = "SortName"; internalHeader = HeaderMetadata.Season; break; case HeaderMetadata.Network: column = (i, r) => this.GetListAsString(i.Studios); itemId = (i) => this.GetStudioID(i.Studios.FirstOrDefault()); reportHeader.ItemViewType = ItemViewType.ItemByNameDetails; reportHeader.SortField = "Studio,SortName"; break; case HeaderMetadata.Year: column = (i, r) => this.GetSeriesProductionYear(i); reportHeader.SortField = "ProductionYear,PremiereDate,SortName"; break; case HeaderMetadata.ParentalRating: column = (i, r) => i.OfficialRating; reportHeader.SortField = "OfficialRating,SortName"; break; case HeaderMetadata.CommunityRating: column = (i, r) => i.CommunityRating; reportHeader.SortField = "CommunityRating,SortName"; break; case HeaderMetadata.Trailers: column = (i, r) => this.GetBoolString(r.HasLocalTrailer); reportHeader.ItemViewType = ItemViewType.TrailersImage; break; case HeaderMetadata.Specials: column = (i, r) => this.GetBoolString(r.HasSpecials); reportHeader.ItemViewType = ItemViewType.SpecialsImage; break; case HeaderMetadata.GameSystem: column = (i, r) => this.GetObject<Game, string>(i, (x) => x.GameSystem); reportHeader.SortField = "GameSystem,SortName"; break; case HeaderMetadata.Players: column = (i, r) => this.GetObject<Game, int?>(i, (x) => x.PlayersSupported); reportHeader.SortField = "Players,GameSystem,SortName"; break; case HeaderMetadata.AlbumArtist: column = (i, r) => this.GetObject<MusicAlbum, string>(i, (x) => x.AlbumArtist); itemId = (i) => this.GetPersonID(this.GetObject<MusicAlbum, string>(i, (x) => x.AlbumArtist)); reportHeader.ItemViewType = ItemViewType.Detail; reportHeader.SortField = "AlbumArtist,Album,SortName"; break; case HeaderMetadata.MusicArtist: column = (i, r) => this.GetObject<MusicArtist, string>(i, (x) => x.GetLookupInfo().Name); reportHeader.ItemViewType = ItemViewType.Detail; reportHeader.SortField = "AlbumArtist,Album,SortName"; internalHeader = HeaderMetadata.AlbumArtist; break; case HeaderMetadata.AudioAlbumArtist: column = (i, r) => this.GetListAsString(this.GetObject<Audio, List<string>>(i, (x) => x.AlbumArtists)); reportHeader.SortField = "AlbumArtist,Album,SortName"; internalHeader = HeaderMetadata.AlbumArtist; break; case HeaderMetadata.AudioAlbum: column = (i, r) => this.GetObject<Audio, string>(i, (x) => x.Album); reportHeader.SortField = "Album,SortName"; internalHeader = HeaderMetadata.Album; break; case HeaderMetadata.Countries: column = (i, r) => this.GetListAsString(this.GetObject<IHasProductionLocations, List<string>>(i, (x) => x.ProductionLocations)); break; case HeaderMetadata.Disc: column = (i, r) => i.ParentIndexNumber; break; case HeaderMetadata.Track: column = (i, r) => i.IndexNumber; break; case HeaderMetadata.Tracks: column = (i, r) => this.GetObject<MusicAlbum, List<Audio>>(i, (x) => x.Tracks.ToList(), new List<Audio>()).Count(); break; case HeaderMetadata.Audio: column = (i, r) => this.GetAudioStream(i); break; case HeaderMetadata.EmbeddedImage: break; case HeaderMetadata.Video: column = (i, r) => this.GetVideoStream(i); break; case HeaderMetadata.Resolution: column = (i, r) => this.GetVideoResolution(i); break; case HeaderMetadata.Subtitles: column = (i, r) => this.GetBoolString(r.HasSubtitles); reportHeader.ItemViewType = ItemViewType.SubtitleImage; break; case HeaderMetadata.Genres: column = (i, r) => this.GetListAsString(i.Genres); break; } string headerName = ""; if (internalHeader != HeaderMetadata.None) { string localHeader = "Header" + internalHeader.ToString(); headerName = internalHeader != HeaderMetadata.None ? ReportHelper.GetJavaScriptLocalizedString(localHeader) : ""; if (string.Compare(localHeader, headerName, StringComparison.CurrentCultureIgnoreCase) == 0) headerName = ReportHelper.GetServerLocalizedString(localHeader); } reportHeader.Name = headerName; reportHeader.FieldName = header; ReportOptions<BaseItem> option = new ReportOptions<BaseItem>() { Header = reportHeader, Column = column, ItemID = itemId }; return option; }
public MainWindow() { InitializeComponent(); // load data from embedded zip resource var ds = new DataSet(); var asm = Assembly.GetExecutingAssembly(); using (var s = asm.GetManifestResourceStream("CustomUI.Resources.nwind.zip")) { var zip = new C1ZipFile(s); using (var zr = zip.Entries[0].OpenReader()) { // load data ds.ReadXml(zr); } } // bind olap page to data PivotBuilder.DataSource = ds.Tables[0].DefaultView; var olap = PivotBuilder.OlapEngine; // rename fields in the UI olap.Fields["ExtendedPrice"].Caption = "Sales"; olap.Fields["OrderDate"].Caption = "Order Date"; olap.Fields["PostalCode"].Caption = "Postal Code"; //olap.Fields["Customers_002eCompanyName"].Caption = "Company Name"; olap.Fields["ProductName"].Caption = "Product Name"; olap.Fields["RequiredDate"].Caption = "Required Date"; olap.Fields["ShipAddress"].Caption = "Ship Address"; olap.Fields["ShipCity"].Caption = "Ship City"; olap.Fields["ShipCountry"].Caption = "Ship Country"; olap.Fields["ShipName"].Caption = "Ship Name"; olap.Fields["ShippedDate"].Caption = "Shipped Date"; //olap.Fields["Shippers_002eCompanyName"].Caption = "Shipper"; olap.Fields["ShipPostalCode"].Caption = "Ship Postal Code"; olap.Fields["ShipRegion"].Caption = "Ship Region"; olap.Fields["UnitPrice"].Caption = "Price"; // set formats olap.Fields["OrderDate"].Format = "yyyy"; olap.Fields["RequiredDate"].Format = "yyyy"; olap.Fields["ShippedDate"].Format = "yyyy"; olap.Fields["ExtendedPrice"].Format = "c2"; olap.Fields["UnitPrice"].Format = "c2"; // show sales by country and category olap.DataSource = ds.Tables[0].DefaultView; olap.BeginUpdate(); olap.RowFields.Add("Country"); olap.ColumnFields.Add("OrderDate"); olap.ValueFields.Add("ExtendedPrice"); olap.EndUpdate(); PivotBuilder.OlapEngine.Update(); // initialize printing report options _reportOptions = new ReportOptions() { IncludeGrid = true, IncludeChart = true, IncludeRawData = false, Margin = new Thickness(1), ChartScale = ScaleMode.SinglePage, GridScale = ScaleMode.PageWidth, RawDataScale = ScaleMode.PageWidth, ShowFooterSeparator = true, ShowHeaderSeparator = true, HeaderCenter = "&[ViewTitle]", HeaderRight = "&[Date]", FooterRight = "Page &[Page] of &[PageCount]" }; // initialize undo/redo stack new OlapPanelUndoStack(PivotBuilder, btnUndo, btnRedo); // configure toolbar btnChartType_Bar.IsChecked = true; Application.Current.Resources.MergedDictionaries.Add(C1.WPF.Theming.C1Theme.GetCurrentThemeResources(new C1.WPF.Theming.Office2013.C1ThemeOffice2013White())); }
private void btnRprt_Click(object sender, EventArgs e) { if (!loggedIn()) { return; } //if (!loggedUser.access(Convert.ToInt16(btnRprt.Tag))) //{ // return; //} ReportOptions rep = new ReportOptions(loggedUser); rep.ShowDialog(); }