Exemplo n.º 1
0
        public async Task UnknownRuntimes()
        {
            var client = new ReportGenerator();
            var report = await client.GetReport(AppRunTimeDetails.Build("abc"));

            Assert.Null(report.IsVulnerable);
            Assert.Equal("Running on unknown runtime abc. Not able to check for security patches.", report.Details);
        }
Exemplo n.º 2
0
        public void GenerateReports(int orderNumber)
        {
            var order = SearchByOrderNumber(orderNumber);

            ReportGenerator.GenerateInvoice(order);
            ReportGenerator.GenerateCuttingListReport(order);
            ReportGenerator.GeneratePaintingReport(order);
        }
Exemplo n.º 3
0
 public override void Execute(CommandSwitchValues values)
 {
     using (var scriptController = ControllerFactory.MakeEventScriptController())
     {
         ReportGenerator generator = new ReportGenerator(Console.Out);
         generator.DisplayScripts(scriptController.GetAllScripts());
     }
 }
Exemplo n.º 4
0
 public override void Execute(CommandSwitchValues values)
 {
     using (var imageController = ControllerFactory.MakeImageController())
     {
         ReportGenerator generator = new ReportGenerator(Console.Out);
         generator.DisplayImages(imageController.GetAllImages());
     }
 }
Exemplo n.º 5
0
        private void GenerateReport()
        {
            ReportGenerator rg             = new ReportGenerator("baza.db");
            string          reportFileName = "Raporty/" + (string)reportComboBox.SelectedItem;
            string          report         = rg.Generate(reportFileName, "template.html");

            browser.NavigateToString(report);
        }
Exemplo n.º 6
0
 public BenchmarkRunner()
 {
     _suiteManager         = new BenchmarkSuiteManager(this);
     _process              = new BenchmarkProcess(this);
     _configurationManager = new ConfigurationManager(this);
     _reportGenerator      = new ReportGenerator(this);
     _environmentState     = new EnvironmentState(this);
 }
Exemplo n.º 7
0
 private void GenerateLogAndReport()
 {
     if (Source == AppSettingsConstants.InputSource.List)
     {
         ReportGenerator.GenerateSummaryLog();
         ReportGenerator.GenerateCombinedOutput();
     }
 }
Exemplo n.º 8
0
 public override void Execute(CommandSwitchValues values)
 {
     using (var orderController = ControllerFactory.MakeOrderController())
     {
         ReportGenerator generator = new ReportGenerator(Console.Out);
         generator.DisplayOrders(orderController.GetAllOrders());
     }
 }
Exemplo n.º 9
0
        public static void setJsonObject(this ReportGenerator context, JObject json)
        {
            var flattenContents = new Dictionary <string, JToken>();
            var contentKeys     = json.Properties().Where(p => p.Name != "Style").Select(p => p.Name);

            foreach (var key in contentKeys)
            {
                var tokens = json.ContainsKey(key) ? json[key].DeserializeAndFlatten() : new Dictionary <string, JToken>();
                if (tokens.Any())
                {
                    foreach (var token in tokens)
                    {
                        flattenContents.Add(string.Format("{0}.{1}", key, token.Key), token.Value);
                    }
                }
            }
            var flattenStyles = json.ContainsKey("Style") ? json["Style"].DeserializeAndFlatten(1) : new Dictionary <string, JToken>();

            foreach (var item in flattenContents)
            {
                var contentKey = item.Key;
                var token      = item.Value;
                if (token.Type == JTokenType.Array)
                {
                    if (token[0].Type == JTokenType.Array)
                    {
                        var values = token.Children().Select(t => t.Children().Select(c => ((JValue)c).Value.ToString()).ToArray()).ToArray();
                        if (flattenStyles.ContainsKey(contentKey))
                        {
                            var styles      = flattenStyles[contentKey].ToObject <ReportLabelStyle[][]>();
                            var valueStyles = values.Select((v, iv) => v.Select((e, ie) => new KeyValuePair <string, ReportLabelStyle>(e, styles[iv][ie])).ToArray()).ToArray();
                            context.setTableParagraph(contentKey, valueStyles);
                        }
                        else
                        {
                            context.setTableParagraph(contentKey, values);
                        }
                    }
                    else
                    {
                        context.setParagraphs(contentKey, token.Children().Select(t => ((JValue)t).Value.ToString()).ToArray());
                    }
                }
                else
                {
                    var value = ((JValue)item.Value).Value.ToString();
                    if (flattenStyles.ContainsKey(contentKey))
                    {
                        var styleToken = flattenStyles[contentKey].ToObject <ReportLabelStyle>();
                        context.setParagraph(contentKey, value, styleToken);
                    }
                    else
                    {
                        context.setParagraph(contentKey, value);
                    }
                }
            }
        }
Exemplo n.º 10
0
        private void GenerateExcelReport()
        {
            IExcelReportGenerator excelReportGenerator = new ReportGenerator();

            string reportsPath     = Constants.ExcelReportsPath;
            string excelReportName = Constants.ExcelReportName;

            excelReportGenerator.GenerateExcelReport(reportsPath, excelReportName);
        }
Exemplo n.º 11
0
 public ReportService(IDatabaseProvider provider = null, IReportGenerator reportGenerator = null)
     : base(provider)
 {
     if (reportGenerator == null)
     {
         reportGenerator = new ReportGenerator();
     }
     this._reportGenerator = reportGenerator;
 }
Exemplo n.º 12
0
        public void ShowReport()
        {
            XtraReport report = ReportGenerator.GenerateReport(gridView);

            using (ReportPrintTool printTool = new ReportPrintTool(report))
            {
                printTool.ShowRibbonPreviewDialog();
            }
        }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            string locationOfLibreOfficeSoffice =
                @"C:\Users\Hasan\Downloads\Programs\LibreOfficePortable\App\libreoffice\program\soffice.exe";

            var test = new ReportGenerator(locationOfLibreOfficeSoffice);

            test.Convert(@"‪C:\Users\Hasan\Desktop\dummy.docx", @"‪C:\Users\Hasan\Desktop\dummy.pdf");
        }
Exemplo n.º 14
0
        private void BindDataToGridView()
        {
            //List<Student> list = new List<Student>();
            //list = GetDataSource().Where(a => { return a.Age == 24; }).ToList();
            //gvMain.DataSource = list;

            //IEnumerable<Student> list;
            //List<Student> list2;
            //list = GetDataSource().Where(a => a.Age == 24);
            //list2 = list.ToList();

            //gvMain.DataSource = GetDataSource().Where(a => a.Age == 24).ToList();

            List <Student> list = new List <Student>();

            //List<Student> list2;

            list.Add(new Student()
            {
                StuId = 2008011217, StuName = "陈义", Age = 24
            });
            list.Add(new Student()
            {
                StuId = 2008011218, StuName = "陈林", Age = 26
            });

            string json = JsonHelper.SerializeObject(list);

            IEnumerable <Student> studentInfo = JsonHelper.DeserializeJsonToCollection <Student>(json);


            gvMain.DataSource = studentInfo;

            DataTable dt = new DataTable();

            DataColumn dc = new DataColumn();

            dc.ColumnName = "Name";
            dt.Columns.Add(dc);
            DataRow dr = dt.NewRow();

            dr["Name"] = "陈义";
            dt.Rows.Add(dr);

            Option <string> o = new Option <string>();
            ReportGenerator r = new ReportGenerator(dt, o);

            var r2 = r.AddSubReport(o);

            r2.ChangePreReport(r, dt);

            var r3 = r.AddSubReport(o);

            r2.DropReport();
            r2.DropReport();
            //list2 = list.Where(c => c.Age == 24).ToList();
        }
Exemplo n.º 15
0
        public void should_indicate_that_it_behaves_like_another_context()
        {
            string contextRendering = ReportGenerator.RenderContext(_context);

            if (contextRendering.Contains("Behaves like") == true)
            {
                Assert.Fail("Should not contain \"behaves like\"");
            }
        }
Exemplo n.º 16
0
        public void Can_Create_Report_With_Local_Datetime()
        {
            var config = new ExceptionReportInfo {
                ExceptionDateKind = DateTimeKind.Local, MainException = new Exception()
            };
            var report = new ReportGenerator(config);

            Assert.That(config.ExceptionDate.Kind == DateTimeKind.Local);
        }
Exemplo n.º 17
0
        public void Run()
        {
            DomainModel dm = new DomainModel();

            // Test of existing report generator
            IReportGenerator irg = new ReportGenerator();

            dm.GenerateReports(irg);
        }
 public BulkSenderService(ILog logger, LocalMonitor localMonitor, FtpMonitor ftpMonitor, ReportGenerator reportGenerator, CleanProcessor cleanProcessor)
 {
     _logger          = logger;
     _localMonitor    = localMonitor;
     _ftpMonitor      = ftpMonitor;
     _cleanProcessor  = cleanProcessor;
     _reportGenerator = reportGenerator;
     InitializeComponent();
 }
Exemplo n.º 19
0
        private static async Task GenerateReportAsync(string directoryPath, Dictionary <string, ReportData> reportData)
        {
            var reportGenerator   = new ReportGenerator <ReportData>(ReportCsvDelimiter, ReportGeneratorRules.HeaderColumnNames, ReportGeneratorRules.DataRowGenerationRules);
            var orderedReportData = reportData.Values.OrderBy(x => x.Band).ThenBy(x => x.Plc);

            var reportFileName = $"report-{DateTime.Now:yyyy-MM-dd_hhmmss}{CsvFileExtension}";
            var reportPath     = Path.Combine(directoryPath, reportFileName);
            await reportGenerator.GenerateAsync(reportPath, orderedReportData);
        }
Exemplo n.º 20
0
        static void Main(string[] args)
        {
            CompanyBL.Company company     = new CompanyBL.Company();
            List <string>     TelSarasas1 = new List <string>();
            List <string>     TelSarasas2 = new List <string>();
            var company1 = new CompanyBL.Company(1, "Ideju sala", TelSarasas1, false);
            var company2 = new CompanyBL.Company(2, "Geras namas", TelSarasas2, false);
            List <CompanyBL.Company> kompanijos = new List <CompanyBL.Company>();

            kompanijos.Add(company1);
            kompanijos.Add(company2);
            TelSarasas1.Add("3706451236");
            TelSarasas1.Add("3706451236");
            TelSarasas2.Add("3706854521");
            TelSarasas2.Add("3706452563");
            TelSarasas2.Add("3706553254");
            Console.WriteLine("Company ID, Neme, Phone Numbers");

            Console.WriteLine("{0} {1}", company1.ID, company1.Name);
            Console.WriteLine("Telefonai:");
            foreach (var tel in TelSarasas1)
            {
                Console.WriteLine(tel);
            }
            Console.WriteLine("{0} {1}", company2.ID, company2.Name);
            foreach (var tel in TelSarasas2)
            {
                Console.WriteLine(tel);
            }
            Console.WriteLine("Iveskite imones ID, pagal kurį būtų paskaiciuota telefonu sk.");
            int id = Convert.ToInt16(Console.ReadLine());

            Console.WriteLine("Telefono Nr. skaičius:");
            Console.WriteLine(company.TelefonoNrSkaicius(kompanijos, id));

            CompanyRepository repo = new CompanyRepository();
            var kompanijuSarasas   = repo.Retrieve();

            Console.WriteLine("Kompanijos ID ir vardas:");
            foreach (var elementas in kompanijuSarasas)
            {
                Console.WriteLine($"ID={elementas.ID}, Vardas={elementas.Name} ");
            }
            Console.WriteLine("Iveskite imones ID kuria reikia parodyti:");
            int nr = Convert.ToInt16(Console.ReadLine());

            Console.WriteLine($"ID={repo.Retrieve(nr).ID}, Vardas={repo.Retrieve(nr).Name}, Nekomercine Organizacija={repo.Retrieve(nr).NekomercineOrganizacija} ");
            var ReportGenerator = new ReportGenerator(repo);

            ReportGenerator.GenerateCompanyReport();
            string kompanijuAtaskaita = ReportGenerator.GenerateCompanyReport();

            Console.WriteLine("Ataskaita:");
            Console.WriteLine(kompanijuAtaskaita);
            Console.ReadLine();
        }
Exemplo n.º 21
0
 private void Awake()
 {
     renderMaterial  = GetComponent <Renderer>();
     originalColor   = renderMaterial.material.color;
     dmgf            = damageFrequency;
     delay           = dmgf;
     healthBar       = GameObject.Find("HealthBar").GetComponent <HealthBar>();
     reportGenerator = GameObject.Find("ReportGenerator").GetComponent <ReportGenerator>();
     levelManager    = GameObject.Find("LevelManager").GetComponent <LevelManager>();
 }
        public void WriteToCsvMethodCallCheck_Success()
        {
            var tradeWorkerMock = new Mock <ITradeWorker>();

            var reportGeneratorService = new ReportGenerator(writerMock.Object, tradeWorkerMock.Object, loggerStub.Object);

            reportGeneratorService.GenerateReport();

            writerMock.Verify(m => m.WriteToCsv(It.IsAny <DateTime>(), It.IsAny <IEnumerable <PowerPeriodSummary> >()), Times.Once);
        }
        public void GetPowerPeriodsMethodCallCheck_Success()
        {
            var tradeWorkerMock = new Mock <ITradeWorker>();

            var reportGeneratorService = new ReportGenerator(writerMock.Object, tradeWorkerMock.Object, loggerStub.Object);

            reportGeneratorService.GenerateReport();

            tradeWorkerMock.Verify(m => m.GetPowerPeriodsSummary(It.IsAny <DateTime>()), Times.Once);
        }
Exemplo n.º 24
0
        public void ReportGeneratorConstructor_AllConstructorParameterNotNull_ReturnsReportGenerator()
        {
            var fakeDataLoader       = NSubstitute.Substitute.For <IDataLoader>();;
            var fakeOfficerViewModel = NSubstitute.Substitute.For <IOfficerViewModelDataMapper>();
            var fakeOutputFormatter  = NSubstitute.Substitute.For <IOutputFormatter>();

            var reportGenerator = new ReportGenerator(fakeDataLoader, fakeOfficerViewModel, fakeOutputFormatter);

            Assert.NotNull(reportGenerator);
        }
Exemplo n.º 25
0
        internal Notifications(IDbConnection connection, MessagingSettingsModel settings, string overrideEmail)
        {
            _connection = connection ?? throw new ArgumentNullException(nameof(connection));
            _connection?.Open();

            _settings        = settings;
            _overrideEmail   = overrideEmail;
            _contacts        = new Contacts(_connection);
            _reportGenerator = new ReportGenerator(_connection);
        }
        public void SetUp()
        {
            _info = new ExceptionReportInfo {
                MainException = new Exception()
            };
            _reportGenerator = new ReportGenerator(_info);

            // set for testing because the AppAssembly filled by default, is null in a test environment
            _info.AppAssembly = Assembly.GetExecutingAssembly();
        }
Exemplo n.º 27
0
 private void AddInformationsToReport()
 {
     if (CheckIfReportsNameIsNotEmpty())
     {
         player.Play();
         rp = new ReportGenerator(ReportNameTXT.Text);
         IterateThroughGroupBox();
         SaveReport();
     }
 }
        public override void Execute(CommandSwitchValues values)
        {
            string name = values.GetSwitch("-name");

            using (var imageController = ControllerFactory.MakeImageController())
            {
                ReportGenerator generator = new ReportGenerator(Console.Out);
                generator.DisplayImages(imageController.ViewImagesWithSimilarName(name));
            }
        }
Exemplo n.º 29
0
        private void button1_Click(object sender, EventArgs e)
        {
            ReportGenerator repGen = new ReportGenerator();

            repGen.createReport();
            Reports reports = new Reports();

            reports.Show();
            System.GC.Collect();
        }
Exemplo n.º 30
0
        public async Task GenerateAsync_GivenValidSqliteDatabase_GeneratesReportsWithoutError()
        {
            var database = GetDatabase();

            using var tempDir = new TemporaryDirectory();
            var exporter = new ReportGenerator(Connection, database, tempDir.DirectoryPath);
            await exporter.GenerateAsync().ConfigureAwait(false);

            Assert.Pass();
        }
        public override void Execute(CommandSwitchValues values)
        {
            string type = values.GetSwitch("-eventType");

            using (var orderController = ControllerFactory.MakeOrderController())
            {
                ReportGenerator generator = new ReportGenerator(Console.Out);
                generator.DisplayOrders(orderController.ViewOrdersWithSimilarEvent(type));
            }
        }
        public override void Execute(CommandSwitchValues values)
        {
            string type = values.GetSwitch("-type");

            using (var scriptController = ControllerFactory.MakeEventScriptController())
            {
                ReportGenerator generator = new ReportGenerator(Console.Out);
                generator.DisplayScripts(scriptController.ViewScriptsWithSimilarType(type));
            }
        }
        public void GetReportHtml_WithManipulatedModel_ReportIsGenerated()
        {
            ReportResourcesRepository rep = new ReportResourcesRepository();
            ReportGenerator target = new ReportGenerator(rep);
            string reportName = "CustomerReport2";

            var customer = new CustomerRepository().GetCustomer();
            var result = target.GetReportHtml(customer, reportName);
            // Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void GetReportHtml_WithoutModel_ReportIsGenerated()
        {
            ReportResourcesRepository rep = new ReportResourcesRepository();
            ReportGenerator target = new ReportGenerator(rep);
            string reportName = "Report1";

            var result = target.GetReportHtml(null, reportName);

            // Assert.Inconclusive("Verify the correctness of this test method.");
        }
Exemplo n.º 35
0
        public override void Execute(CommandSwitchValues values)
        {
            int id = values.GetSwitchAsInt("-id");

            using (var scriptController = ControllerFactory.MakeEventScriptController())
            {
                ReportGenerator generator = new ReportGenerator(Console.Out);
                generator.DisplayScript(scriptController.GetScriptbyId(id));
            }
        }
Exemplo n.º 36
0
        public override void Execute(CommandSwitchValues values)
        {
            int id = values.GetSwitchAsInt("-id");

            using (var orderController = ControllerFactory.MakeOrderController())
            {
                ReportGenerator generator = new ReportGenerator(Console.Out);
                generator.DisplayScriptID(orderController.ShowAttachedScriptID(id));
            }
        }
Exemplo n.º 37
0
        public void ReportGenerator_SumsInteractionsCorrectly()
        {
            var expectedInteractions = new List <Interaction>()
            {
                new Interaction()
                {
                    WaitingTime = new TimeWithUnit()
                    {
                        Value = 50, Unit = Unit.Minutes
                    },
                    Duration = new TimeWithUnit()
                    {
                        Value = 10, Unit = Unit.Seconds
                    },
                    IssueStatus    = IssueStatus.Resolved,
                    CustomerStatus = CustomerStatus.VIP
                },
                new Interaction()
                {
                    WaitingTime = new TimeWithUnit()
                    {
                        Value = 10, Unit = Unit.Hours
                    },
                    Duration = new TimeWithUnit()
                    {
                        Value = 40, Unit = Unit.Minutes
                    },
                    IssueStatus    = IssueStatus.Pending,
                    CustomerStatus = CustomerStatus.LowPriority
                },
                new Interaction()
                {
                    WaitingTime = new TimeWithUnit()
                    {
                        Value = 2000, Unit = Unit.Seconds
                    },
                    Duration = new TimeWithUnit()
                    {
                        Value = 5000, Unit = Unit.Milliseconds
                    },
                    IssueStatus    = IssueStatus.Resolved,
                    CustomerStatus = CustomerStatus.VIP
                }
            };

            var report = ReportGenerator.GenerateReport(expectedInteractions);

            Assert.AreEqual(41000000, report.TotalWaitTime.Value);
            Assert.AreEqual(2415000, report.TotalDuration.Value);
            Assert.AreEqual(13666666, report.AverageWaitTime.Value);
            Assert.AreEqual(2, report.IssuesResolved);
            Assert.AreEqual(3, report.TotalInteractions);
            Assert.AreEqual(1, report.TrafficByCustomerStatus.LowPriority);
            Assert.AreEqual(2, report.TrafficByCustomerStatus.VIP);
        }
Exemplo n.º 38
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            try
            {
                if (DGrid.RowCount <= 0)
                {
                    return;
                }
                if (DGrid.CurrentRow == null)
                {
                    return;
                }

                var frm = new frmSetPrintSize(false);
                if (frm.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                var list = new List <GardeshPrintViewModel>();
                foreach (var item in _listData)
                {
                    list.Add(new GardeshPrintViewModel()
                    {
                        PrintDateSh = Calendar.MiladiToShamsi(DateTime.Now),
                        DateM       = item.DateM,
                        Description = item.Description,
                        Debit       = item.Debit,
                        Credit      = item.Credit,
                        DateSh      = item.DateSh,
                        SumCredit   = _listData.Sum(q => q.Credit),
                        SumDebit    = _listData.Sum(q => q.Debit),
                        Rem_        = item.Rem,
                        TafsilName  = item.TafsilName,
                        TafsilCode  = item.TafsilCode
                    });
                }

                list = list?.OrderBy(q => q.DateM)?.ToList();

                if (frm._PrintType == EnPrintType.Excel)
                {
                    return;
                }
                var cls = new ReportGenerator(StiType.Account_Performence_List, frm._PrintType)
                {
                    Lst = new List <object>(list)
                };
                cls.PrintNew();
            }
            catch (Exception ex)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(ex);
            }
        }
Exemplo n.º 39
0
 public BenchmarkRunner()
 {
     _configuration = new ConfigurationManager();
     _parameters    = new ParametersManager(_configuration);
     _results       = new ResultsManager();
     _benchmarks    = new BenchmarksManager(_parameters);
     _execution     = new ExecutionManager(_configuration, _results);
     _environment   = new EnvironmentManager();
     _report        = new ReportGenerator(_configuration, _results, _parameters,
                                          _benchmarks, _environment);
 }
Exemplo n.º 40
0
        public void Should_Throw_With_Missing_Field_Information()
        {
            var template = Environment.CurrentDirectory + @"\Resources\SampleContentTemplate.docx";
            var report   = new ReportGenerator(template);

            report.setParagraph("Blah", "");
            var outputPath = string.Format(@"{0}\{1}{2}.docx", Path.GetDirectoryName(template), Path.GetFileNameWithoutExtension(template), DateTime.Now.Ticks);

            report.GenerateToFile(outputPath);
            Assert.IsFalse(File.Exists(outputPath));
        }
Exemplo n.º 41
0
        static void Main(string[] args)
        {
            if (args.Count() >= 4)
            {
                string teamCityUrl = args[0].Trim();
                int buildsDeep = int.Parse(args[1]);
                string[] buildTypes = args[2].Split(new char[] { ',', ';' });
                string outputXmlFile = args[3];
                string xsltFile = args[4];

                TCConnection tcConnection = new TCConnection(teamCityUrl);

                XElement root = new XElement("reports");

                foreach (string buildTypeId in buildTypes)
                {
                    ReportParameters parameters = new ReportParameters(
                        teamCityUrl,
                        buildTypeId,
                        0,
                        buildsDeep,
                        f => { return (f.DefaultBranch == true); }
                        );

                    IReportGenerator<ReportParameters> reportGenerator = new ReportGenerator();
                    IReport<ReportParameters> report = reportGenerator.Generate(parameters);
                    root.Add(report.ToXML(buildTypeId));
                }

                XDocument xdoc = new XDocument(
                    new XDeclaration("1.0", "utf-8", null),
                    root);

                xdoc.Save(outputXmlFile);

                if (!String.IsNullOrEmpty(xsltFile))
                {
                    string outputHtmlFile = Path.Combine(
                        Path.GetDirectoryName(outputXmlFile),
                        String.Concat(Path.GetFileNameWithoutExtension(outputXmlFile), ".html"));

                    XslCompiledTransform myXslTrans = new XslCompiledTransform();
                    myXslTrans.Load(xsltFile);
                    myXslTrans.Transform(outputXmlFile, outputHtmlFile);
                }
            }
            else
            {
                Console.WriteLine("Invalid arguments");
            }
        }
Exemplo n.º 42
0
        public void TestReport()
        {
            /* jetbrains local test server */
            ReportParameters parameters = new ReportParameters(
                "http://192.168.137.49",
                "NTeamCity_NTeamCityMain",
                0,
                3,
                f => { return (f.Status == BuildStatus.SUCCESS); }
            );

            IReportGenerator<ReportParameters> reportGenerator = new ReportGenerator();
            var report = reportGenerator.Generate(parameters);
            var xml = report.ToXML("Tests");
        }
Exemplo n.º 43
0
        public PdfWriter(ReportGenerator report)
        {
            // Store report locally
            this._report = report;

            // Create new PDF document (with Migradoc)
            _document = new Document();

            // Setup the title and footer
            _title = report.GetTitle();
            _footer = "Generated by Commerce Bank's Productivity Analysis System on "
                     + DateTime.Now.ToString("ddd, MMMM d, yyyy, hh:mm");

            // Styles are stored internally in document, so this sets those up
            DefineStyles();
        }
Exemplo n.º 44
0
        private void outputButton_Click(object sender, EventArgs e)
        {
            //Uncomment these lines to randomly generate events every button click.
            RandomEventGenerator reg = new RandomEventGenerator(DateTime.Now, this.sqlCmd, this.sqlRdr);
            reg.insertRecords(5);

            ReportGenerator rg = new ReportGenerator(this.sqlCmd, this.sqlRdr);
            if (htmlButton.Checked)
            {
                rg.generateHTMLReport();
                status.Text = "Generated HTML Report.";
            }
            else if (csvButton.Checked)
            {
                rg.generateCSV();
                status.Text = "Saved in Project Folder. Opening...";
            }
        }
Exemplo n.º 45
0
 public MainWindow()
 {
     InitializeComponent();
     //CreateModel();
     //OxyPlotChartTime.Model = model1;
     openFileDialog = new OpenFileDialog();
     // Instantiate the writer
     TextWriter _writer = new TextBoxStreamWriter(OutputTextbox);
     // Redirect the out Console stream
     Console.SetOut(_writer);
     Console.WriteLine("Now redirecting console output to the text box");
     testsInProgress = false;
     //Initializing the Background Worker
     _backgroundWorker = new BackgroundWorker();
     _backgroundWorker.WorkerSupportsCancellation = true;
     _backgroundWorker.DoWork += _backgroundWorker_DoWork;
     _backgroundWorker.RunWorkerCompleted += _backgroundWorker_RunWorkerCompleted;
     reportGenerator = new ReportGenerator();
     reportGenerator.ResultsChange += reportGenerator_ResultsChange;
 }
Exemplo n.º 46
0
        static void Main(string[] args)
        {
            var db = new EmployeeDB();

            // Add some employees
            db.AddEmployee(new Employee("Anne", 3000, 10));
            db.AddEmployee(new Employee("Berit", 2000, 12));
            db.AddEmployee(new Employee("Christel", 1000, 4));

            var reportGenerator = new ReportGenerator(db);

            // Create a default (name-first) report
            reportGenerator.CompileReport();

            Console.WriteLine("");
            Console.WriteLine("");

            // Create a salary-first report
            reportGenerator.CompileReport();
        }
Exemplo n.º 47
0
        public override void Execute(CommandSwitchValues values)
        {
            int orderid = values.GetSwitchAsInt("-orderid");
            if (orderid <= 0)
                throw new SystemException("ID value must be more than 0");

            int scriptid = values.GetSwitchAsInt("-scriptid");
            if (scriptid <= 0)
                throw new SystemException("ID value must be more than 0");

            using(var scriptController = ControllerFactory.MakeEventScriptController())
            {
                if (scriptController.ScriptExist(scriptid))
                {
                    using (var orderController = ControllerFactory.MakeOrderController())
                    {
                        ReportGenerator generator = new ReportGenerator(Console.Out);
                        orderController.AttachScriptID(orderid, scriptid);
                        Console.WriteLine("Success!");
                    }
                }
            }
        }
Exemplo n.º 48
0
        private async void GenerateReport(List<int> tradeIDs)
        {
            if (tradeIDs == null) throw new NullReferenceException("tradeIDs");
            if (tradeIDs.Count == 0)
            {
                await DialogService.ShowMessageAsync(this, "Error", "No trades meet the given criteria");
                return;
            }

            var gen = new ReportGenerator();
            ProgressDialogController progressDialog = await DialogService.ShowProgressAsync(this, "Generating Report", "Generating Report");
            var ds = await Task.Run(() => gen.TradeStats(tradeIDs, PerformanceReportPageViewModel.ReportSettings, Datasourcer, progressDialog));
            progressDialog.CloseAsync().Forget(); //don't await it!

            var window = new PerformanceReportWindow(ds, PerformanceReportPageViewModel.ReportSettings);
            window.Show();
        }
Exemplo n.º 49
0
        private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            ReportGenerator reportGenerator;
            backgroundWorker.ReportProgress(0);

            reportGenerator = new ReportGenerator(m_network, m_database);
            backgroundWorker.ReportProgress(10);

            reportGenerator.GenerateHeader();
            backgroundWorker.ReportProgress(15);

            reportGenerator.GenerateNetworkDetails();
            backgroundWorker.ReportProgress(20);

            reportGenerator.GenerateSchemaDetails();
            backgroundWorker.ReportProgress(30);

            reportGenerator.GenerateTrainingDetails();
            backgroundWorker.ReportProgress(40);

            reportGenerator.GenerateTestingSummary();
            backgroundWorker.ReportProgress(50);

            reportGenerator.GenerateTestingDetails();
            backgroundWorker.ReportProgress(60);

            reportGenerator.GenerateNormalization();
            backgroundWorker.ReportProgress(70);

            reportGenerator.GenerateWeights();
            backgroundWorker.ReportProgress(80);

            reportGenerator.GenerateFooter();
            backgroundWorker.ReportProgress(90);

            e.Result = reportGenerator.Report;
        }
Exemplo n.º 50
0
        public FileResult ExportPdf()
        {
            string reportIdString = Request["reportId"];
            string startDateString = Request["startDate"];
            string endDateString = Request["endDate"];

            if (!(ValidateReportId(reportIdString) && ValidateDateRange(startDateString, endDateString)))
                return File(Encoding.UTF8.GetBytes(TempData["Error"].ToString()), "text/plain", "Error.txt");

            int reportId = int.Parse(reportIdString);
            DateTime startDate = DateTime.Parse(startDateString);
            DateTime endDate = DateTime.Parse(endDateString);

            ReportGenerator reportData;
            ReportGenerator cachedReport = (ReportGenerator)Session["cachedReport"];

            if (cachedReport != null && cachedReport.GetReportId() == reportId && cachedReport.startDateTime == startDate && cachedReport.endDateTime == endDate)
                reportData = cachedReport;
            else
                reportData = new ReportGenerator(reportId, startDate, endDate, _db);

            PdfWriter pdfWriter = new PdfWriter(reportData);
            MemoryStream stream = pdfWriter.GetPdfStream();

            return File(stream, "application/pdf", _repository.GetRportName(reportId) + "_" + DateTime.Today.ToString("yyyy-MM-dd") + ".pdf");
        }
Exemplo n.º 51
0
        //Sets up and redirects to the View Report Page with a report that was seleted in the Main Report Page
        public ActionResult ViewReport()
        {
            string reportStringId = Request["reportId"];
            if (!ValidateReportId(reportStringId))
                return RedirectToAction("Index");
            int id = Convert.ToInt32(reportStringId);

            string startDateString = Request["dateFrom"];
            string endDateString = Request["dateTo"];
            if (!ValidateDateRange(startDateString, endDateString))
                return RedirectToAction("Index");
            DateTime startDate = DateTime.Parse(startDateString);
            DateTime endDate = DateTime.Parse(endDateString);

            ReportGenerator reportData = new ReportGenerator(id, startDate, endDate, _db);

            TempData["report"] = reportData;
            Session["cachedReport"] = reportData;
            return View(reportData);
        }
Exemplo n.º 52
0
        public FileResult ExportCsv()
        {
            ReportGenerator reportData;
            ReportGenerator chachedReport = (ReportGenerator)Session["cachedReport"];
            ReportGenerator originalChachedReport = chachedReport;

            string reportIdString = Request["reportId"];
            if (!(ValidateReportId(reportIdString)))
                return File(Encoding.UTF8.GetBytes(TempData["Error"].ToString()), "text/plain", "Error.txt");
            int reportId = int.Parse(reportIdString);

            if (chachedReport == null)
            {
                string startDateString = Request["startDate"];
                string endDateString = Request["endDate"];
                if (ValidateDateRange(startDateString, endDateString))
                    return File(Encoding.UTF8.GetBytes(TempData["Error"].ToString()), "text/plain", "Error.txt");
                DateTime startDate = DateTime.Parse(startDateString);
                DateTime endDate = DateTime.Parse(endDateString);

                reportData = new ReportGenerator(reportId, startDate, endDate, _db);
            }
            else
                reportData = chachedReport;

            CsvWriter csvWriter = new CsvWriter(_repository.GetRportName(reportId) + "_report_" + DateTime.Today.ToString("yyyy-MM-dd") + ".csv", reportData);
            Session["cachedReport"] = originalChachedReport;

            string csvString = csvWriter.ExportCsv();
            if (csvString.IsNullOrWhiteSpace())
                return File(Encoding.UTF8.GetBytes("Failed to export csv"), "text/plain", "Error.txt");

            return File(Encoding.UTF8.GetBytes(csvString), "text/csv", csvWriter.Filename.Replace(" ", "_"));
        }
Exemplo n.º 53
0
		private void GenerateReportInventaireEquipementComplet(string nomFichier) {
			if (nomFichier != null) {
				var gen = new ReportGenerator<ReportInventaireEquipementComplet>(
						ServiceReportingAdapter.EquipementsToReportInventaireEquipementComplet(this.Equipements.OrderBy(e => e.Modele.ToString()).ToList()),
						nomFichier
					);

				gen.SetTitle(string.Format(ResEquipements.TitreRapportInventaireComplet, DateTime.Now.ToShortDateString()));
				gen.SetSubTitle(string.Format(ResEquipements.SousTitreInventaireSimple, this.Equipements.Count()));
				gen.GenerateExcelReport();

				this.ShowUserNotification(string.Format(ResCommon.InfoRapportGenere, nomFichier));
			}
		}
Exemplo n.º 54
0
        void reportGenerator_ResultsChange(object sender, ReportGenerator.ResultsChangedEventArgs results)
        {
            //Updating Charts
            var plotData = results.CurrentResults;
            if (plotData != null && plotData.Tests.Count > 0)
            {
                //Preparing Grid
                System.Windows.Threading.DispatcherOperation
                    dispatcherOp = ChartsGrid.Dispatcher.BeginInvoke(
                        System.Windows.Threading.DispatcherPriority.Normal,
                        new Action(
                            delegate()
                            {
                                if (plotData.Tests.Count != ChartsGrid.RowDefinitions.Count)
                                {
                                    //Removing charts
                                    ChartsGrid.Children.Clear();
                                    ChartsGrid.RowDefinitions.Clear();
                                    //Adding components
                                    var plot1 = new OxyPlot.Wpf.Plot() { Height = 500 };
                                    plot1.Name = "chart0_0";
                                    plot1.SetValue(Grid.RowProperty, 0);
                                    plot1.SetValue(Grid.ColumnProperty, 0);
                                    plot1.BorderBrush = new SolidColorBrush(Colors.Black);
                                    plot1.VerticalAlignment = System.Windows.VerticalAlignment.Top;
                                    var split = new GridSplitter() { Width = 4 };
                                    var plot2 = new OxyPlot.Wpf.Plot() { Height = 500 };
                                    plot2.Name = "chart0_1";
                                    plot2.SetValue(Grid.RowProperty, 0);
                                    plot2.SetValue(Grid.ColumnProperty, 1);
                                    plot2.BorderBrush = new SolidColorBrush(Colors.Black);
                                    plot2.VerticalAlignment = System.Windows.VerticalAlignment.Top;
                                    ChartsGrid.Children.Add(plot1);
                                    ChartsGrid.Children.Add(split);
                                    ChartsGrid.Children.Add(plot2);
                                    ChartsGrid.Height = 700;
                                    ChartsGrid.RowDefinitions.Add(new RowDefinition() { });
                                    if (plotData.Tests.Count > 1)
                                    {
                                        for (int i = 1; i < plotData.Tests.Count; i++)
                                        {
                                            var plot3 = new OxyPlot.Wpf.Plot() { Height = 500 };
                                            plot3.Name = String.Format("chart{0}_0", i);
                                            plot3.SetValue(Grid.RowProperty, i);
                                            plot3.SetValue(Grid.ColumnProperty, 0);
                                            plot3.BorderBrush = new SolidColorBrush(Colors.Black);
                                            plot3.VerticalAlignment = System.Windows.VerticalAlignment.Top;
                                            var split1 = new GridSplitter() { Width = 4 };
                                            split1.SetValue(Grid.RowProperty, i);
                                            var plot4 = new OxyPlot.Wpf.Plot() { Height = 500 };
                                            plot4.Name = String.Format("chart{0}_1", i);
                                            plot4.SetValue(Grid.RowProperty, i);
                                            plot4.SetValue(Grid.ColumnProperty, 1);
                                            plot4.BorderBrush = new SolidColorBrush(Colors.Black);
                                            plot4.VerticalAlignment = System.Windows.VerticalAlignment.Top;
                                            ChartsGrid.Children.Add(plot3);
                                            ChartsGrid.Children.Add(split1);
                                            ChartsGrid.Children.Add(plot4);
                                            ChartsGrid.RowDefinitions.Add(new RowDefinition() { });
                                        }
                                        ChartsGrid.Height = plotData.Tests.Count * 500 + plotData.Tests.Count * 4;
                                    }
                                    ChartsGrid.UpdateLayout();
                                }
                            }));
                //For all Tests in Tests Data
                for (int testIndex = 0; testIndex < plotData.Tests.Count; testIndex++)
                {
                    var test = plotData.Tests[testIndex];
                    //Creating Model for Time
                    var tmp = new PlotModel("Duration", "using OxyPlot and NPerf");
                    if (isLogarithmic)
                    {
                        tmp.Axes.Add(new LogarithmicAxis(AxisPosition.Right, "Logarithmic"));
                    }
                    tmp.Title = "Duration (" + test.Name + ")";
                    int typeIndex = 0;
                    int testIndexInner = testIndex;

                    var runTotal = test.Runs[0];
                    var series =
                        (from PerfResult trun in runTotal.Results
                         select new LineSeries(trun.TestedType) { MarkerType = MarkerType.Circle }).Cast<Series>().ToList();

                    foreach (var run in test.Runs)
                    {
                        typeIndex = 0;
                        foreach (var trun in run.Results)
                        {
                            if (typeIndex < run.Results.Count)
                            {
                                //Series name: run.Results[index].testedtype
                                // Value -> run.Results[index]
                                (series[typeIndex] as LineSeries).Points.Add(new DataPoint(run.Value,
                                                                                           run.Results[typeIndex].
                                                                                               Duration));
                            }
                            typeIndex++;
                        }
                    }
                    tmp.Series = new System.Collections.ObjectModel.Collection<Series>(series);

                    //Creating model for Memory
                    var tmp1 = new PlotModel("Memory", "using OxyPlot and NPerf");
                    if (isLogarithmic)
                    {
                        tmp1.Axes.Add(new LogarithmicAxis(AxisPosition.Right, "Logarithmic"));
                    }
                    typeIndex = 0;
                    tmp1.Title = "Memory (" + test.Name + ")";
                    var runTotal1 = test.Runs[0];
                    var series1 =
                        (from PerfResult trun in runTotal1.Results
                         select new LineSeries(trun.TestedType) { MarkerType = MarkerType.Circle }).Cast<Series>().ToList();
                    foreach (var run in test.Runs)
                    {
                        typeIndex = 0;
                        foreach (var trun in run.Results)
                        {
                            if (typeIndex < run.Results.Count)
                            {
                                //Series name: run.Results[index].testedtype
                                // Value -> run.Results[index]
                                (series1[typeIndex] as LineSeries).Points.Add(new DataPoint(run.Value,
                                                                                            run.Results[typeIndex].
                                                                                                MemoryUsageMb));
                            }
                            typeIndex++;
                        }
                    }
                    tmp1.Series = new System.Collections.ObjectModel.Collection<Series>(series1);

                    System.Windows.Threading.DispatcherOperation
                        dispatcherOp1 = ChartsGrid.Dispatcher.BeginInvoke(
                            System.Windows.Threading.DispatcherPriority.Normal,
                            new Action(
                                delegate()
                                {
                                    //Setting models
                                    foreach (var el in ChartsGrid.Children)
                                    {
                                        if (el is OxyPlot.Wpf.Plot &&
                                            (el as OxyPlot.Wpf.Plot).Name.Equals(String.Format("chart{0}_0",
                                                                                               testIndexInner)))
                                        {
                                            (el as OxyPlot.Wpf.Plot).Model = tmp;
                                            break;
                                        }
                                    }
                                    foreach (var el in ChartsGrid.Children)
                                    {
                                        if (el is OxyPlot.Wpf.Plot &&
                                            (el as OxyPlot.Wpf.Plot).Name.Equals(String.Format("chart{0}_1",
                                                                                               testIndexInner)))
                                        {
                                            (el as OxyPlot.Wpf.Plot).Model = tmp1;
                                            break;
                                        }
                                    }
                                    ChartsGrid.UpdateLayout();
                                }
                                ));
                }
            }
        }
Exemplo n.º 55
0
		private void GenerateReport(string nomFichier) {
			if (nomFichier != null) {
				switch (this._currentItem.Code) {
					case CodesReport.InventaireSimpleEquipementExcel:
						var genInvSimple = new ReportGenerator<ReportInventaireEquipementSimple>(this._cacheInventaireSimple, nomFichier);
						genInvSimple.SetTitle(this._currentItem.ToString());
						genInvSimple.GenerateExcelReport();
						break;

					case CodesReport.InventaireCompletEquipementExcel:
						var genInvComplet = new ReportGenerator<ReportInventaireEquipementComplet>(this._cacheInventaireComplet, nomFichier);
						genInvComplet.SetTitle(this._currentItem.ToString());
						genInvComplet.GenerateExcelReport();
						break;

					case CodesReport.ListeAdherents:
						var genListAdh = new ReportGenerator<ReportListeAdherents>(this._cacheListeAdherents, nomFichier);
						genListAdh.SetTitle(this._currentItem.ToString());
						genListAdh.GenerateExcelReport();
						break;

					case CodesReport.RepartitionAdherentsAge:
						var genRepAdh = new ReportGenerator<ReportRepartitionAdherentsAge>(this._cacheRepartitionAdherentsAge, nomFichier);
						genRepAdh.SetTitle(this._currentItem.ToString());
						genRepAdh.GenerateExcelReport();
						break;
				}

				this.ShowUserNotification(string.Format(ResCommon.InfoRapportGenere, nomFichier));
			}
		}
Exemplo n.º 56
0
		private void GenerateReportListeAdherentsGroupe(string nomFichier) {
			if (nomFichier != null) {
				var gen = new ReportGenerator<ReportListeAdherents>(
						ServiceReportingAdapter.GroupeToReportListeAdherents(this.SelectedGroupe),
						nomFichier
					);

				gen.SetTitle(ResGroupes.TitreRapportListeAdherents);
				gen.SetSubTitle(string.Format(ResGroupes.SousTitreRapportListeAdherents, this.SelectedGroupe.Inscriptions.Count()));
				gen.GenerateExcelReport();

				this.ShowUserNotification(string.Format(ResCommon.InfoRapportGenere, nomFichier));
			}
		}
		private void GenerateReportCampagneVerification(string nomFichier) {
			if (nomFichier != null) {
				var gen = new ReportGenerator<ReportVerificationEquipement>(
						ServiceReportingAdapter.CampagneVerificationToReportVerificationEquipement(this.SelectedCampagneVerification),
						nomFichier
					);

				gen.SetTitle(string.Format(ResCampagnesVerification.TitreRapportVerificationEquipement, this.SelectedCampagneVerification.Date.ToShortDateString()));
				gen.SetSubTitle(string.Format(ResCampagnesVerification.SousTitreRapportVerificationEquipement, this.SelectedCampagneVerification.Responsable, this.SelectedCampagneVerification.NbEquipements));
				gen.GenerateExcelReport();

				this.ShowUserNotification(string.Format(ResCommon.InfoRapportGenere, nomFichier));
			}
		}
        /// <summary>
        /// Initializes a new instance of the reporting type and 
        /// </summary>
        /// <param name="traceId">A unique identifier used to correlate the debugging and diagnostics messages</param>
        /// <param name="logger">An instance used to write debugging and diagnostics information</param>
        /// <param name="componentName">The name of the component for debugging and diagnostics messages</param>
        /// <param name="reportSourceId">A unique id used to represent the source of the health report</param>
        /// <param name="reportCallback">A method to be called when the health data is required</param>
        /// <param name="context">The service fabric context that is assocaited with the entity being reported on</param>
        /// <param name="reportType">The entity type the health report is for</param>
        /// <param name="reportingInterval">How often the report will be sent</param>
        /// <param name="batchInterval">The amount of time to delay before sending for batching purposes, 0 for immediate</param>
        /// <param name="timeout">The timeout for sending a report</param>
        /// <param name="retryInterval">The amount of time to wait before trying to resend a report</param>
        public HealthReporter(Guid traceId, ILogger logger, string componentName, string reportSourceId, ReportGenerator reportCallback, ServiceContext context, ReportTypes reportType, TimeSpan? reportingInterval = null, TimeSpan? batchInterval = null, TimeSpan? timeout = null, TimeSpan? retryInterval = null)
        {
            if (string.IsNullOrEmpty(reportSourceId)) throw new ArgumentException("Parameter cannot be null or empty.", nameof(reportSourceId));
            if (reportCallback == null) throw new ArgumentNullException(nameof(reportCallback));

            this.logger = logger;
            this.componentName = componentName;
            this.logger.Informational(traceId, this.componentName, "Instantiated health reporter");


            this.reportSourceId = reportSourceId;
            this.reportType = reportType;
            this.reportCallback = reportCallback;

            this.client = new FabricClient(new FabricClientSettings
            {
                HealthReportRetrySendInterval = retryInterval ?? TimeSpan.FromSeconds(40),
                HealthReportSendInterval = batchInterval ?? TimeSpan.FromSeconds(0),
                HealthOperationTimeout = timeout ?? TimeSpan.FromSeconds(120)
            });
            
            this.context = context;

            this.interval = reportingInterval ?? TimeSpan.FromSeconds(30);
            if (this.interval < TimeSpan.FromSeconds(5)) this.interval = TimeSpan.FromSeconds(15);

            this.timeToLive = TimeSpan.FromSeconds((this.interval.TotalSeconds * 2.0) + 1.0);
        }
Exemplo n.º 59
0
 //Report csv constructor
 public CsvWriter(string filename, ReportGenerator repot)
 {
     SetupCommonAttributes(filename);
     _report = repot;
     BuildReportCsv();
 }
Exemplo n.º 60
0
    protected void DownloadReport(Guid clientGuid)
    {
        Client client = Client.GetClientByGUID(clientGuid);
        var repgen = new ReportGenerator(client);
        string tempDocName = repgen.CreateReport();

        try {
            Response.ClearContent();
            Response.ClearHeaders();
            Response.AppendHeader("Content-Disposition", "attachment; filename=repgen.docx");
            Response.AppendHeader("Content-Type", "application/msword");
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.TransmitFile(tempDocName);
            Response.Flush();
            Response.Close();
        } finally {
            if (File.Exists(tempDocName))
                File.Delete(tempDocName);
        }
    }