public void PeriodLoadBrewsFromWorkSheetTestCase()
        {
            Period period = new XlPeriod("2018", "January", connectionString);

            period.LoadBrews();

            Assert.AreEqual(2, period.Brews.Count);
        }
Exemplo n.º 2
0
        public XlReport(XlPeriod period, string reportName, string reportPath)
        {
            this.period     = period;
            this.reportName = reportName;
            this.fileInfo   = new FileInfo(reportPath + Path.DirectorySeparatorChar + reportName + ".xlsx");

            xlBrewingFormWorksheet = period.XlBrewingFormWorksheet;

            templatePath  = appSettings.ReportTemplateFilePath;
            this.template = new FileInfo(templatePath);

            CreateReportWorkSheet();
            CopyParametersFromPeriod();
        }
Exemplo n.º 3
0
        private void CopyParametersFromPeriod()
        {
            using (xlPackage = new ExcelPackage(fileInfo))
            {
                XlPeriod xlPeriod = (BrewingModel.Datasources.XlPeriod)period;
                xlReportWorksheet = xlPackage.Workbook.Worksheets[reportWorksheet];

                for (int column = 1; column <= xlPeriod.XlBrewingFormWorksheet.Dimension.Columns; column++)
                {
                    for (int row = 1; row <= xlPeriod.XlBrewingFormWorksheet.Dimension.Rows; row++)
                    {
                        xlReportWorksheet.Cells[row, column].Value = xlPeriod.XlBrewingFormWorksheet.Cells[row, column].Value;
                    }
                }

                xlPackage.Save();
            }
        }
Exemplo n.º 4
0
        public override void CreateReport(string year, Month month, string reportName, string reportPath)
        {
            XlPeriod period = (XlPeriod)GetPeriod(year, month);

            report = new XlReport(period, reportName, reportPath);
        }
Exemplo n.º 5
0
 private void CreatePeriod()
 {
     datasource = new XlDatasource(connectionString, periodTemplateFilePath);
     period     = (BrewingModel.Datasources.XlPeriod)datasource.CreatePeriod("2018", Month.September);
 }