private static void DisplayResults <T>(ReportCreator <T> reportCreator, string title) where T : ReportRequest { var content = reportCreator.Create().Content; ConsoleHelper.DisplayResults(content, title); }
public override void OnOpenDocument(PdfWriter writer, Document document) { float[] width = { 20, 80 }; PdfPTable table = new PdfPTable(2) { WidthPercentage = 100 }; table.SetTotalWidth(width); var img = Image.GetInstance(ReportCreator.GetDestinationFolder("social_services.jpg")); img.ScaleAbsolute(150, 97); table.AddCell(new PdfPCell(img) { BorderWidth = 0 }); var header = new Paragraph( 16, "Social Service Manager", new Font(Font.FontFamily.TIMES_ROMAN, 38)); table.AddCell(new PdfPCell(header) { BorderWidth = 0, HorizontalAlignment = 1, VerticalAlignment = Element.ALIGN_MIDDLE }); document.Add(table); }
public void CreateReportBulkTest() { ReportCreator creator = new ReportCreator(); creator.CreateReport(new CurrentWeatherFromAllCity(GetDatas())); Assert.IsNotNull(creator); }
public async Task <string> CreateQCClinicalDataReport([FromBody] ReportQCClinicalData reportInfo) { string templateName = "QCClinicalDataReport"; ReportCreator report = new ReportCreator(); return(await report.CreateQCClinicalDataReport(reportInfo, templateName)); }
private async Task CreateReport(CancellationToken token) { ITradesFetcher tradesFetcher = new TradesFetcher(ConfigurationManager.Service, ConfigurationManager.TradeType, this.logger); ITradeVolumeCalculator volumeCalculator = new TradeVolumeCalculator(this.logger); IReportCreator reportCreator = new ReportCreator(tradesFetcher, volumeCalculator); while (!token.IsCancellationRequested) { await reportCreator.CreateTradeVolumeReportAsync(DateTime.Now, ConfigurationManager.TradeReportsPath); this.logger.LogEvent(ServiceEvent.ReportCreatedSuccessfully); ConfigurationManager.RefreshAppSettings(); TimeSpan newInterval = ConfigurationManager.GenerationIntervalInMinutes; if (this.IntervalChanged(newInterval)) { this.logger.LogEvent(ServiceEvent.GenerationIntervalChanged, string.Format("Interval changed to: {0}", newInterval)); } this.logger.LogEvent(ServiceEvent.Sleeping); await Task.Delay(newInterval, token); } this.logger.LogEvent(ServiceEvent.ServiceStopped); }
public async Task <string> CreateShippingContainerReport([FromBody] ShippingContainerDataObject reportInfo) { string templateName = "ShippingContainerReport"; ReportCreator report = new ReportCreator(); return(await report.CreateShippingContainerReport(reportInfo, templateName)); }
private async void ShowRaport() { var DocDir = AppDomain.CurrentDomain.BaseDirectory; string newXpsDocs = Path.Combine(DocDir, @"Documents\HasilRaport.xps"); string newDocPath = Path.Combine(DocDir, @"Documents\HasilRaport.docx"); if (Nisn != "" && Semester != "") { AddRaport adr = new AddRaport(); ReportCreator rc = new ReportCreator(); string docPath = rc.GetFileDirectory(Semester); Dictionary <string, string> raportDict = new Dictionary <string, string>(); raportDict = adr.GetRaportView(Nisn, Semester); try { if (rc.GantiMergeField(docPath, newDocPath, raportDict)) { Raportviewer.Document = rc.ConvertWordDocToXPSDoc(newDocPath, newXpsDocs).GetFixedDocumentSequence(); } else { await this.ShowMessageAsync("Gagal", "Gagal nih"); this.Close(); } } catch (Exception) { throw; } } }
private static async Task CreateReport() { ITradesFetcher tradesFetcher = new TradesFetcher(ConfigurationManager.Service, ConfigurationManager.TradeType, logger); ITradeVolumeCalculator volumeCalculator = new TradeVolumeCalculator(logger); IReportCreator reportCreator = new ReportCreator(tradesFetcher, volumeCalculator); while (true) { await reportCreator.CreateTradeVolumeReportAsync(DateTime.Now, ConfigurationManager.TradeReportsPath); logger.LogEvent(ServiceEvent.ReportCreatedSuccessfully); ConfigurationManager.RefreshAppSettings(); TimeSpan newInterval = ConfigurationManager.GenerationIntervalInMinutes; if (IntervalChanged(newInterval)) { initialInterval = newInterval; logger.LogEvent(ServiceEvent.GenerationIntervalChanged, string.Format("Interval changed to: {0}", newInterval)); } logger.LogEvent(ServiceEvent.Sleeping); await Task.Delay(newInterval); } }
/// <summary> /// Event method to call method to create doc word and call method to modify the excel file /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnWord_Click(object sender, RoutedEventArgs e) { if (dataMigration.SelectedItem == null) { return; } CheckWordProcesses(); MigrationElement currentElement = (MigrationElement)dataMigration.SelectedItem; Process(currentElement); List <MigrationElement> element = new List <MigrationElement>(); element.Add(currentElement); KillWord(); try { ReportCreator myCreator = new ReportCreator(element, _offerBxPath, _offerAnPath, _offerVvPath); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public async Task ReportCreator_Should_Save_Report() { Environment.SetEnvironmentVariable("Trade", "PowerTrade"); var gmtTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time")); var reportName = "PowerPosition_" + gmtTime.ToString("yyyyMMdd_HHmm") + ".csv"; var testExePath = ConfigurationManager.TradeReportsPath; var reportPath = Path.Combine(testExePath, reportName); var mockFetcher = new Mock <ITradesFetcher>(); var mockCalculator = new Mock <ITradeVolumeCalculator>(); var mockLogger = new Mock <IServiceLogger>(); mockFetcher .Setup(f => f.GetTradesAsync(It.IsAny <DateTime>())) .ReturnsAsync(() => new List <ITrade> { new DummyTrade(), new DummyTrade() }); mockCalculator .Setup(c => c.CalculateAggregateVolumes(It.IsAny <IEnumerable <ITrade> >())) .Returns(() => new Dictionary <string, double>()); var reportCreator = new ReportCreator(mockFetcher.Object, mockCalculator.Object); await reportCreator.CreateTradeVolumeReportAsync(DateTime.Now, testExePath); if (!File.Exists(reportPath)) { Assert.Fail(); } }
private void B_createReport_Click(object sender, EventArgs e) { if (sfd_saveReport.ShowDialog() != DialogResult.Cancel) { ReportCreator creator = new ReportCreator(); creator.CreateReport(sfd_saveReport.FileName); MessageBox.Show("Отчёт успешно создан!"); } }
public override string Execute(IList <string> parameters) { var familyId = int.Parse(parameters[0]); var family = this.DataFactory.FindFamily(familyId); var familyVisits = this.DataFactory.GetFamilyVisits(family); ReportCreator.CreateFamilyVisitsReport(family, familyVisits); return("Done"); }
public IActionResult Reports(string quantity, string feeMultiplier) { ViewData["Message"] = "Reports"; var creator = new ReportCreator(new SqlItemRetriever(new WebSqlSettings()), new FileReportWriter(new WebFileSettings()), new WebUserContext()); creator.Create(Int32.Parse(quantity), Decimal.Parse(feeMultiplier)); return(View()); }
static void Main(string[] args) { IATE aTEx = new ATE(); IBillingSystem bs = new BillingSys(aTEx); IReportCreator report = new ReportCreator(); IContract con1 = aTEx.RegisterContract(new User("Anton", "Goncharuk"), TypeOffTariffPlan.Business); IContract con2 = aTEx.RegisterContract(new User("Olga", "Gordeeva"), TypeOffTariffPlan.Smart); IContract con3 = aTEx.RegisterContract(new User("Alex", "Kulesh"), TypeOffTariffPlan.SmartUnlim); IContract con4 = aTEx.RegisterContract(new User("Misha", "Antonov"), TypeOffTariffPlan.SmartMini); Console.WriteLine(new string('=', 75)); Console.WriteLine("Abonents: =>"); Console.WriteLine(con1.User.FirstName + " " + con1.User.LastName + " " + con1.Number + " " + con1.Tariff.TypeOffTariffPlan + " " + con1.User.Money); Console.WriteLine(con2.User.FirstName + " " + con2.User.LastName + " " + con2.Number + " " + con2.Tariff.TypeOffTariffPlan + " " + con2.User.Money); Console.WriteLine(con3.User.FirstName + " " + con3.User.LastName + " " + con3.Number + " " + con3.Tariff.TypeOffTariffPlan + " " + con3.User.Money); Console.WriteLine(con4.User.FirstName + " " + con4.User.LastName + " " + con4.Number + " " + con4.Tariff.TypeOffTariffPlan + " " + con4.User.Money); Console.WriteLine(new string('=', 75)); con4.ChangeTariff(TypeOffTariffPlan.Business); Console.WriteLine(new string('=', 75)); var ter1 = aTEx.NewTerminal(con1); var ter2 = aTEx.NewTerminal(con2); var ter3 = aTEx.NewTerminal(con3); var ter4 = aTEx.NewTerminal(con4); ter1.ConnectToPort(); ter2.ConnectToPort(); ter3.ConnectToPort(); ter4.ConnectToPort(); ter1.Call(ter2.Number); ter3.Call(ter1.Number); //ter4.DisconnectFromPort(); ter1.Call(ter4.Number); Console.WriteLine(new string('=', 75)); Console.WriteLine("Report by number: {0}", ter1.Number); report.Create(bs.GetReport(ter1.Number), TypeOfSort.SortByDate); Console.WriteLine(new string('=', 75)); //report.Create(bs.GetReport(ter1.Number), TypeOfSort.SortByCallType); //Console.WriteLine(new string('=', 75)); //report.Create(bs.GetReport(ter1.Number), TypeOfSort.SortByNumber); //Console.WriteLine(new string('=', 75)); //report.Create(bs.GetReport(ter1.Number), TypeOfSort.SortByCost); //Console.WriteLine(new string('=', 75)); //Console.WriteLine(con1.User.FirstName + " " + con1.User.LastName + " " + con1.Number + " " + con1.Tariff.TypeOffTariffPlan + " " + con1.User.Money); //Console.WriteLine(con2.User.FirstName + " " + con2.User.LastName + " " + con2.Number + " " + con2.Tariff.TypeOffTariffPlan + " " + con2.User.Money); //Console.WriteLine(con3.User.FirstName + " " + con3.User.LastName + " " + con3.Number + " " + con3.Tariff.TypeOffTariffPlan + " " + con3.User.Money); //Console.WriteLine(con4.User.FirstName + " " + con4.User.LastName + " " + con4.Number + " " + con4.Tariff.TypeOffTariffPlan + " " + con4.User.Money); //Console.WriteLine(new string('=', 75)); }
public async Task <string> CreateChemicalTestReport([FromBody] ChemicalTestReportData reportInfo) { string templateName = "ChemicalTestReport.trdx"; if (reportInfo != null && reportInfo.LabInfo != null && !string.IsNullOrEmpty(reportInfo.LabInfo.Abbreviation)) { templateName = "BloodChemistryReport" + reportInfo.LabInfo.Abbreviation + ".trdx"; } ReportCreator report = new ReportCreator(); return(await report.CreateChemicalTestReportReport(reportInfo, templateName)); }
public async Task <string> CreateToxLabOrderRequisitionReportForPGX([FromBody] ToxLabOrderReportData reportInfo) { string templateName = "PGXRequisitionReport.trdx"; if (reportInfo != null && !string.IsNullOrEmpty(reportInfo.LabAbbreviation)) { templateName = "PGXRequisitionReport" + "_" + reportInfo.LabAbbreviation + reportInfo.ReportCode + ".trdx"; } ReportCreator report = new ReportCreator(); return(await report.CreateToxLabOrderRequisitionReport(reportInfo, templateName)); }
public override string Execute(IList <string> parameters) { var userId = int.Parse(parameters[0]); // TODO remove comment to work normally var user = this.DataFactory.FindUser(userId); var userVisits = this.DataFactory.GetUserVisits(user.Id); ReportCreator.CreateUserReport(user, userVisits, this.DataFactory); return("Done"); }
public async Task <string> CreateMillenniumHealthReport([FromBody] string json) { try { MillenniumHealthCaseReportData obj = Newtonsoft.Json.JsonConvert.DeserializeObject <MillenniumHealthCaseReportData>(json); ReportCreator report = new ReportCreator(); return(await report.CreateMillenniumHealthReport(obj)); }catch (Exception ex) { throw ex; } }
public async Task <string> CreateLabOrderRequisitionReport([FromBody] LabOrderReport reportInfo) { string templateName = "ToxicologyAccessionCaseReport"; if (reportInfo != null && !string.IsNullOrEmpty(reportInfo.TemplateName)) { templateName = "MolecularRequisitionReport" + reportInfo.TemplateName; } ReportCreator report = new ReportCreator(); return(await report.CreateLabOrderRequisitionReport(reportInfo, templateName)); }
public async Task <string> CreateToxicologyAccessionReport([FromBody] ReportCaseData reportInfo) { string templateName = "ToxicologyAccessionCaseReport"; if (reportInfo != null && !string.IsNullOrEmpty(reportInfo.TemplateName)) { templateName = templateName + "_" + reportInfo.TemplateName; } ReportCreator report = new ReportCreator(); return(await report.CreateToxicologyAccessionReport(reportInfo, templateName)); }
public async Task <string> CreateAntiBodyTestReport([FromBody] LabOrderReport reportInfo) { string templateName = "AntiBodyTestReport"; if (reportInfo != null && !string.IsNullOrEmpty(reportInfo.TemplateName)) { templateName = templateName + "_" + reportInfo.TemplateName; } ReportCreator report = new ReportCreator(); return(await report.CreateAntiBodyTestReport(reportInfo, templateName)); }
public ActionResult DownloadTicketsPage(ContentModel model, string id) { var order = UvendiaContext.Orders.Single($"{nameof(Order.ExternalId)}=@ExternalId", new { ExternalId = id }); if (order != null && order.Paid && order.OrderStatus != OrderStatus.Cancelled) { var reportModel = ReportCreator.GenerateTicketPDF(order, Thread.CurrentThread.CurrentCulture.Name); var stream = ReportCreator.GenerateReportAsStream(reportModel, out string mimeType); return(File(stream, mimeType, reportModel.FileName)); } else { return(Redirect($"/{CurrentUser.LanguageCode}/error-400/")); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainForm mainform = new MainForm(); RawDataProcessor rawProcessor = new RawDataProcessor(); ReportCreator reportCreator = new ReportCreator(); DocumentCreator documentCreator = new DocumentCreator(); Presenter presenter = new Presenter(rawProcessor, reportCreator, documentCreator, mainform); Application.Run(mainform); }
protected override void Context() { _pdfReportFullPath = string.Empty; _reportSettings = A.Fake <ReportSettings>(); _buildSettings = new BuildSettings(); _builderRepository = A.Fake <ITeXBuilderRepository>(); _reportCompiler = A.Fake <IReportCompiler>(); _buildTrackerFactory = A.Fake <IBuildTrackerFactory>(); _artifactsManager = A.Fake <IArtifactsManager>(); _eventPublisher = A.Fake <IEventPublisher>(); var task = Task.Run(() => { }); A.CallTo(_reportCompiler).WithReturnType <Task>().Returns(task); sut = new ReportCreator(_builderRepository, _reportCompiler, _buildTrackerFactory, _artifactsManager, _eventPublisher); }
public void CreatesReportCorrectly() { var itemRetrieverMock = new ItemRetrieverMock(); var reportWriterMock = new ReportWriterMock(); var userContextMock = new UserContextMock(); var creator = new ReportCreator(itemRetrieverMock, reportWriterMock, userContextMock); itemRetrieverMock.AddUnreportedItem(1, "Name1", "Red", 100); itemRetrieverMock.AddUnreportedItem(2, "Name2", "Orange", 200); itemRetrieverMock.AddUnreportedItem(3, "Name3", "Yellow", 300); itemRetrieverMock.AddUnreportedItem(4, "Name4", "Green", 400); itemRetrieverMock.AddUnreportedItem(5, "Name5", "Blue", 500); itemRetrieverMock.AddUnreportedItem(6, "Name6", "Violet", 600); userContextMock.Username = "******"; creator.Create(5, 0.2m); var writeCall = reportWriterMock.WriteCalls.Single(); Assert.Equal("UnitTestUsername", writeCall.Username); var chunk = writeCall.Chunk; Assert.Equal(5, chunk.Items.Length); Assert.Equal(5, chunk.TotalItems); Assert.Equal(1500, chunk.TotalAmounts); Assert.Equal(100, chunk.TotalFees); Assert.Equal(1600, chunk.GrandTotal); var item1 = chunk.Items[0]; var item2 = chunk.Items[1]; var item3 = chunk.Items[2]; var item4 = chunk.Items[3]; var item5 = chunk.Items[4]; void AssertItem(ReportChunk.ReportChunkItem item, int id, string name, decimal amount, decimal fee) { Assert.Equal(id, item.Id); Assert.Equal(name, item.Name); Assert.Equal(amount, item.Amount); Assert.Equal(fee, item.Fee); } AssertItem(item1, 1, "Name1", 100, 20); AssertItem(item2, 2, "Name2", 200, 0); AssertItem(item3, 3, "Name3", 300, 0); AssertItem(item4, 4, "Name4", 400, 80); AssertItem(item5, 5, "Name5", 500, 0); }
public void FullIntegrationTest() { var creator = new ReportCreator(new SqlItemRetriever(sqlSettings), new FileReportWriter(fileSettings), userContext); creator.Create(5, 0.3m); var file = File.ReadAllText(fileSettings.GetRoot() + "\\report.txt"); Assert.Equal( @"Report for IntegrationTest 99904,Name99904,100.00,30.00 99905,Name99905,200.00,0.00 99906,Name99906,300.00,90.00 99907,Name99907,400.00,120.00 99908,Name99908,500.00,0.00 Total Items: 5 Total Amounts: 1500.00 Total Fees: 240.00 Grand Total: 1740.00", file); }
public void CreateReportTest() { ReportCreator creator = new ReportCreator(); creator.CreateReport(new CurrentWeatherReport( new WeatherData() { Country = "BE", Temperature = 12.5, Speed = 10.2, City = "Ghent", Pressure = 12, WindSpeed = 5, Id = Guid.NewGuid(), Humidty = 5, WindDirection = "NE", UpdateWeather = DateTime.Now.AddHours(5) })); Assert.IsNotNull(creator); }
/// <summary> /// Method that is called when the addin is started. /// </summary> /// <param name="sender">The sender</param> /// <param name="e">The event arguments</param> private void ThisAddInStartup(object sender, EventArgs e) { try { Stopwatch stopwatch = Stopwatch.StartNew(); Log.Info("SCORPIO plugin starting initialization"); #if DEBUG // If we are in debug, allow the incorrect certificate that the test-redmine at 192.168.0.93 has. ServicePointManager.ServerCertificateValidationCallback += AllowTestRedmineCertificate; #endif // Configure Log4net log4net.Config.XmlConfigurator.Configure(); Log.Info(string.Format("SCORPIO plugin configured Log4Net after {0} ms", stopwatch.ElapsedMilliseconds)); this._reportCreator = new ReportCreator(); // init the plugin logic this.CheckRequirements(this.Application.ActiveExplorer()); Log.Info(string.Format("SCORPIO plugin created necessary Outlook Objects after {0} ms", stopwatch.ElapsedMilliseconds)); // Initialization of the task pane takes about 2 seconds. Therefore, schedule it to the ui // thread for later execution to not slow down plugin startup times. var uiScheduler = TaskScheduler.FromCurrentSynchronizationContext(); var taskPaneTask = new Task(this.CreateCustomTaskPane); taskPaneTask.Start(uiScheduler); Log.Info(string.Format("SCORPIO plugin created task pane after {0} ms", stopwatch.ElapsedMilliseconds)); Log.Info(string.Format("SCORPIO plugin successfully initialized in {0} ms", stopwatch.ElapsedMilliseconds)); this.ReconnectToRedmine(); Log.Info(string.Format("SCORPIO plugin triggered connection to redmine after {0} ms", stopwatch.ElapsedMilliseconds)); stopwatch.Stop(); } catch (Exception ex) { Log.Error("SCORPIO plugin could not be initialized.", ex); throw; } }
static void Main(string[] args) { Console.WriteLine("Hello Factory!"); IPrinter mainPrinter = new Printer(); DocumentCreator cv = new CVCreator(); IDocument cvInstance = cv.CreateDocument(mainPrinter); cvInstance.Print(); DocumentCreator report = new ReportCreator(); IDocument reportInstance = report.CreateDocument(mainPrinter); reportInstance.Print(); DocumentCreator story = new StoryCreator(); IDocument storyInstance = story.CreateDocument(mainPrinter); storyInstance.Print(); }
public ActionResult DownloadPDF(ContentModel model, long invoice = 0, long tickets = 0) { var order = UvendiaContext.Orders.Single((invoice > 0 ? invoice : tickets)); if (invoice > 0) { var rm = ReportCreator.GenerateOrderInvoicePDF(order, Thread.CurrentThread.CurrentCulture.Name); var stream = ReportCreator.GenerateReportAsStream(rm, out string mimeType); return(File(stream, mimeType, rm.FileName)); } else if (tickets > 0) { var reportModel = ReportCreator.GenerateTicketPDF(order, Thread.CurrentThread.CurrentCulture.Name); var stream = ReportCreator.GenerateReportAsStream(reportModel, out string mimeType); return(File(stream, mimeType, reportModel.FileName)); } else { ShowAlertMessage("Tickets not available", "Sorry, our system couldn't find any tickets to download", AlertMessageType.Error); return(Redirect($"/{CurrentUser.LanguageCode}/")); } }