private ActionResult CreateEditView(TSending sending) { AddReferenceDataToViewBag(ViewBag, sending); sending.LaboratoryNumber = sending.IsolateLaboratoryNumber ?? ReportFormatter.ToLaboratoryNumber(GetNextSequentialIsolateNumber(), CurrentYear); return(View(sending)); }
protected override List <QueryRecord> QueryRecords() { var query = NotDeletedSendings().Select(x => new { x.MeningoSendingId, x.Isolate.MeningoIsolateId, x.Isolate.ReportStatus, x.Isolate.ReportDate, x.Patient.Initials, x.Patient.BirthDate, x.Isolate.StemNumber, x.ReceivingDate, x.SamplingLocation, x.OtherInvasiveSamplingLocation, x.OtherNonInvasiveSamplingLocation, x.Isolate.YearlySequentialIsolateNumber, x.Isolate.Year, x.SenderLaboratoryNumber, x.MeningoPatientId, PatientPostalCode = x.Patient.PostalCode, SenderPostalCode = db.Senders.FirstOrDefault(s => s.SenderId == x.SenderId).PostalCode, }); var queryRecords = query.ToList().Select(x => { var invasive = MeningoSending.IsInvasive(x.SamplingLocation) ? YesNo.Yes : YesNo.No; var samplingLocation = x.SamplingLocation == MeningoSamplingLocation.OtherInvasive ? Server.HtmlEncode(x.OtherInvasiveSamplingLocation) : x.SamplingLocation == MeningoSamplingLocation.OtherNonInvasive ? Server.HtmlEncode(x.OtherNonInvasiveSamplingLocation) : EnumEditor.GetEnumDescription(x.SamplingLocation); var laboratoryNumber = ReportFormatter.ToLaboratoryNumber(x.YearlySequentialIsolateNumber, x.Year, DatabaseType.Meningococci); return(new QueryRecord { SendingId = x.MeningoSendingId, IsolateId = x.MeningoIsolateId, PatientId = x.MeningoPatientId, Initials = x.Initials, BirthDate = x.BirthDate, StemNumber = x.StemNumber.ToStemNumberWithPrefix(DatabaseType.Meningococci), ReceivingDate = x.ReceivingDate, SamplingLocation = samplingLocation, Invasive = EnumEditor.GetEnumDescription(invasive), LaboratoryNumber = x.Year * 10000 + x.YearlySequentialIsolateNumber, LaboratoryNumberString = laboratoryNumber, ReportStatus = x.ReportStatus, PatientPostalCode = x.PatientPostalCode, SenderPostalCode = x.SenderPostalCode, SenderLaboratoryNumber = x.SenderLaboratoryNumber, FullTextSearch = string.Join(" ", x.Initials, x.BirthDate.ToReportFormat(), x.StemNumber.ToStemNumberWithPrefix(DatabaseType.Meningococci), x.ReceivingDate.ToReportFormat(), invasive, samplingLocation, laboratoryNumber, x.PatientPostalCode, x.SenderPostalCode, x.SenderLaboratoryNumber, x.MeningoPatientId) .ToLower() }); }).ToList(); return(queryRecords); }
public Report(DataAccess dataAccess, ReportFormatter reportFormatter, ReportPrinter reportPrinter) { _dataAccess = dataAccess; _reportFormatter = reportFormatter; _reportPrinter = reportPrinter; }
public void Report_OnSimpleExerciseTree_ProducesWellFormedReportK() { var rr = new ReportFormatter(); string actual = rr.CreateReport(ExerciseTestData.Exercises["simple"]); string expected = Utils.GetResourceAsString(Constants.ReportSimpleResource); Assert.Equal(expected, actual); }
public void ReportHeaderIsCorrect() { var reportFormatter = new ReportFormatter(); var expectedReportHeader = "Январь 2020"; var factReportHeader = reportFormatter.MakeReportHeader(2020, 1); Assert.AreEqual(expectedReportHeader, factReportHeader); }
public void Report_OnExerciseTree_ProducesWellFormedReport() { var rr = new ReportFormatter(); var merger = Utils.GetMergerFromResources( Constants.ExercisesResource, Constants.ManyDesignsResource); new ReportProcessor().Process(merger, reportWriter, testErrorWriter); Assert.NotEmpty(fakeReportHandler.Report); }
public void EmpSalaryInfoIsCorrect() { var reportFormatter = new ReportFormatter(); var emp = MocksGenerator.GetRandomEmployees(fillSalary: true).GroupBy(x => x.Department).First().First(); var expectedSalaryInfo = $"{Environment.NewLine}{emp.Name}\t{emp.Salary.ToString("C")}"; var factSalaryInfo = reportFormatter.MakeEmpSalaryInfo(emp); Assert.AreEqual(expectedSalaryInfo, factSalaryInfo); }
public void Print() { var dataAccess = new DataAccess() dataAccess.GetData(); var formatter = new ReportFormatter() formatter.FormatReport(); // SRP: this is actually an additional responsibility (output) Console.WriteLine("printingreport"); }
public void Print() { var dataAccess = new DataAccess() dataAccess.GetData(); var formatter = new ReportFormatter() formatter.FormatReport(); var printer = new ReportPrinter() printer.Send(); }
public void TotalSalaryInfoIsCorrect() { var reportFormatter = new ReportFormatter(); var empsByDepts = MocksGenerator.GetRandomEmployees(fillSalary: true).GroupBy(x => x.Department); var expectedTotalSalaryInfo = $"{Environment.NewLine}{dividerLine}{Environment.NewLine}Всего по предприятию: {empsByDepts.Sum(dept => dept.Sum(emp => emp.Salary)).ToString("C")}"; var factTotalSalaryInfo = reportFormatter.MakeTotalSalaryInfo(empsByDepts); Assert.AreEqual(expectedTotalSalaryInfo, factTotalSalaryInfo); }
public void DeptTitleIsCorrect() { var reportFormatter = new ReportFormatter(); var deptInfo = MocksGenerator.GetRandomEmployees(fillSalary: true).GroupBy(x => x.Department).First(); var expectedDeptTitle = $"{Environment.NewLine}{dividerLine}{Environment.NewLine}{deptInfo.Key}"; var factDeptTitle = reportFormatter.MakeDeptTitle(deptInfo); Assert.AreEqual(expectedDeptTitle, factDeptTitle); }
public void DeptSalaryInfoIsCorrect() { var reportFormatter = new ReportFormatter(); var deptInfo = MocksGenerator.GetRandomEmployees(fillSalary: true).GroupBy(x => x.Department).First(); var expectedDeptSalaryInfo = $"{Environment.NewLine}Всего по отделу: {deptInfo.Sum(x => x.Salary).ToString("C")}{Environment.NewLine}"; var factDeptSalaryInfo = reportFormatter.MakeDeptSalaryInfo(deptInfo); Assert.AreEqual(expectedDeptSalaryInfo, factDeptSalaryInfo); }
public CallProcessor() { // email to list m_emailList = System.Configuration.ConfigurationManager.AppSettings["EMailList"]; // get the time to sleep between failed file open operations m_ReportInterval = 1000 * Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["ReportIntervalInSecs"]); // get our db interface m_db = new CdrDbProcessor(); m_keeper = new TimeKeeper(); m_processor = new ReportDataProcessor(); _reportFormatter = new ReportFormatter(); }
public CallProcessor() { // email to list m_emailList = System.Configuration.ConfigurationManager.AppSettings["EMailList"]; // get the time to sleep between failed file open operations m_ReportInterval = 1000 * Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["ReportIntervalInSecs"]); // get our db interface m_db = new CdrDbProcessor(); m_keeper = new TimeKeeper(); m_processor = new ReportDataProcessor(); _reportFormatter = new ReportFormatter(); }
public void Print(List <Profile> data, IPrinter printer, DataFormatter formatter) { if (_options.Verbose) { printer.Print(formatter.Format(data)); } if (_options.Log) { printer = new FilePrinter(); formatter = new ReportFormatter(); printer.Print(formatter.Format(data)); wg.Generate(data); } }
private void HandleReport(object sender, RpcData rpcData) { var report = rpcData.GetData(AppInfo.PluginManager); tabletVisualizer.SetData(rpcData); if (report is IDeviceReport deviceReport) { reportPeriod += (stopwatch.Restart().TotalMilliseconds - reportPeriod) / 10.0f; reportRateBox.Update($"{(uint)(1000 / reportPeriod)}hz"); string formatted = ReportFormatter.GetStringFormat(deviceReport); tabletBox.Update(formatted); string raw = ReportFormatter.GetStringRaw(deviceReport); rawTabletBox.Update(raw); } }
private void HandleReport(object sender, DebugReportData data) { tabletVisualizer.SetData(data); var report = data.ToObject(); if (report is IDeviceReport deviceReport) { deviceNameBox.Update(data.Tablet.Properties.Name); reportPeriod += (stopwatch.Restart().TotalMilliseconds - reportPeriod) / 10.0f; reportRateBox.Update($"{(uint)(1000 / reportPeriod)}hz"); string formatted = ReportFormatter.GetStringFormat(deviceReport); tabletBox.Update(formatted); string raw = ReportFormatter.GetStringRaw(deviceReport); rawTabletBox.Update(raw); } }
public EmailSenderImpl(IMailTransport smtpClient, ReportFormatter reportFormatter, Settings settings) { this.smtpClient = smtpClient; this.reportFormatter = reportFormatter; this.settings = settings; }
public ReportWriter(IReportFileHandler reportFileHandler, ReportFormatter reportFormatter) { this.reportFileHandler = reportFileHandler; this.reportFormatter = reportFormatter; }
public TabletDebugger() : base(Application.Instance.MainForm) { Title = "Tablet Debugger"; var debugger = new StackLayout { HorizontalContentAlignment = HorizontalAlignment.Stretch, Height = 320, Padding = SPACING, Spacing = SPACING, Items = { new StackLayoutItem { Control = new StackLayout { Orientation = Orientation.Horizontal, VerticalContentAlignment = VerticalAlignment.Bottom, Items = { new StackLayoutItem { Expand = true, Control = new DebuggerGroup { Text = "Device", Content = deviceName = new Label { Font = Fonts.Monospace(LARGE_FONTSIZE) } } }, new DebuggerGroup { Text = "Report Rate", Width = LARGE_FONTSIZE * 6, Content = reportRate = new Label { Font = Fonts.Monospace(LARGE_FONTSIZE) } }, new StackLayoutItem { Control = new DebuggerGroup { Text = "Reports Recorded", Width = LARGE_FONTSIZE * 10, Content = reportsRecorded = new Label { Font = Fonts.Monospace(LARGE_FONTSIZE) } } }, new Group { Text = "Options", Content = enableDataRecording = new CheckBox { Text = "Enable Data Recording" } } } } }, new StackLayoutItem { Expand = true, Control = new StackLayout { Orientation = Orientation.Horizontal, VerticalContentAlignment = VerticalAlignment.Stretch, Height = 240, Items = { new StackLayoutItem { Expand = true, Control = new DebuggerGroup { Text = "Raw Tablet Data", Width = FONTSIZE * 33, Content = rawTablet = new Label { Font = Fonts.Monospace(FONTSIZE) } } }, new StackLayoutItem { Control = new DebuggerGroup { Text = "Tablet Report", Width = FONTSIZE * 33, Content = tablet = new Label { Font = Fonts.Monospace(FONTSIZE) } } } } } } } }; var splitter = new Splitter { Orientation = Orientation.Vertical, Width = 660, Height = 800, FixedPanel = SplitterFixedPanel.Panel2, Panel1 = new DebuggerGroup { Height = 200, Text = "Visualizer", Content = tabletVisualizer = new TabletVisualizer() }, Panel2 = debugger }; this.Content = new Scrollable { Content = splitter }; var reportBinding = ReportDataBinding.Child(c => (c.ToObject() as IDeviceReport)); deviceName.TextBinding.Bind(ReportDataBinding.Child(c => c.Tablet.Properties.Name)); rawTablet.TextBinding.Bind(reportBinding.Child(c => ReportFormatter.GetStringRaw(c))); tablet.TextBinding.Bind(reportBinding.Child(c => ReportFormatter.GetStringFormat(c))); reportRate.TextBinding.Bind(ReportPeriodBinding.Convert(c => Math.Round(1000.0 / c) + "hz")); reportsRecorded.TextBinding.Bind(NumberOfReportsRecordedBinding.Convert(c => c.ToString())); tabletVisualizer.ReportDataBinding.Bind(ReportDataBinding); App.Driver.DeviceReport += HandleReport; App.Driver.TabletsChanged += HandleTabletsChanged; App.Driver.Instance.SetTabletDebug(true); var outputStream = File.OpenWrite(Path.Join(AppInfo.Current.AppDataDirectory, "tablet-data.txt")); dataRecordingOutput = new StreamWriter(outputStream); }
public static string FormatReport <TTask>(this TasksDurations <TTask> tasksDurations, bool includeHeader = true, Func <TTask, string> taskNameFormatter = null, Func <TimeSpan, string> taskDurationFormatter = null) { return(ReportFormatter.FormatReport(tasksDurations, includeHeader, taskNameFormatter, taskDurationFormatter)); }
public TabletDebugger() { Title = "Tablet Debugger"; var debugger = new StackLayout { HorizontalContentAlignment = HorizontalAlignment.Stretch, Height = 400, Padding = 5, Spacing = 5, Items = { new DebuggerGroup { Text = "Device", Content = deviceName = new Label { Font = Fonts.Monospace(10) } }, new StackLayoutItem { Expand = true, Control = new StackLayout { Orientation = Orientation.Horizontal, VerticalContentAlignment = VerticalAlignment.Stretch, Items = { new StackLayoutItem { Expand = true, Control = new DebuggerGroup { Text = "Raw Tablet Data", Content = rawTablet = new Label { Font = Fonts.Monospace(10) } } }, new StackLayoutItem { Expand = true, Control = new DebuggerGroup { Text = "Tablet Report", Content = tablet = new Label { Font = Fonts.Monospace(10) } } } } } }, new DebuggerGroup { Text = "Report Rate", Content = reportRate = new Label { Font = Fonts.Monospace(10) } }, new StackLayoutItem { Control = new StackLayout { Orientation = Orientation.Horizontal, VerticalContentAlignment = VerticalAlignment.Bottom, Items = { new StackLayoutItem { Expand = true, Control = new DebuggerGroup { Text = "Reports Recorded", Content = reportsRecorded = new Label { Font = Fonts.Monospace(10) } } }, new Group { Text = "Options", Content = enableDataRecording = new CheckBox { Text = "Enable Data Recording" } } } } } } }; this.Content = new Splitter { Orientation = Orientation.Vertical, Width = 640, Height = 800, FixedPanel = SplitterFixedPanel.Panel2, Panel1 = new DebuggerGroup { Text = "Visualizer", Content = tabletVisualizer = new TabletVisualizer() }, Panel2 = debugger }; var reportBinding = ReportDataBinding.Child(c => (c.ToObject() as IDeviceReport)); deviceName.TextBinding.Bind(ReportDataBinding.Child(c => c.Tablet.Properties.Name)); rawTablet.TextBinding.Bind(reportBinding.Child(c => ReportFormatter.GetStringRaw(c))); tablet.TextBinding.Bind(reportBinding.Child(c => ReportFormatter.GetStringFormat(c))); reportRate.TextBinding.Bind(ReportPeriodBinding.Convert(c => Math.Round(1000.0 / c) + "hz")); reportsRecorded.TextBinding.Bind(NumberOfReportsRecordedBinding.Convert(c => c.ToString())); tabletVisualizer.ReportDataBinding.Bind(ReportDataBinding); Application.Instance.AsyncInvoke(() => { App.Driver.AddConnectionHook(ConnectionHook); }); var outputStream = File.OpenWrite(Path.Join(AppInfo.Current.AppDataDirectory, "tablet-data.txt")); dataRecordingOutput = new StreamWriter(outputStream); }