Esempio n. 1
0
        public async Task <IActionResult> ReportAllFormer()
        {
            var myContext = _context.EmployeeViewModel.Include(e => e.Department).Include(e => e.Job);
            List <EmployeeViewModel> listaDep = myContext.Where(x => x.EndDate != null).ToList();
            ReportFormer             rep      = new ReportFormer(_pdfWebHostEnvironment, listaDep);

            return(File(rep.Report(), "application/pdf"));
        }
 private void LstBoxReports_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     try
     {
         if (lstBoxReports.SelectedItem == null)
         {
             return;
         }
         ReportFormer reportFormer = new ReportFormer(Tournament);
         Category = lstBoxReports.SelectedItem as Category;
         reportFormer.Category = Category;
         if (reportFormer.OpenWorkbook())
         {
             MessageBox.Show("Дождитесь сообщения об окончании формирования отчета, не трогайте Excel!");
             reportFormer.WriteHeaderPlayersList();
             reportFormer.WriteHeaderWS1(reportFormer.Worksheet, "A4", "H4");
             int lastMan = reportFormer.PlayerListFormer("A6", "H6", "Юноши");
             lastMan += 8 + reportFormer.PlayerListFormer("A" + (8 + lastMan), "H" + (8 + lastMan), "Женщины");
             reportFormer.JudgeWriter(reportFormer.Sheets[1], "E" + (lastMan + 2), "G" + (lastMan + 2));
             for (int i = 2; i < 7; i++)
             {
                 reportFormer.WriteHeaderResults(reportFormer.Sheets[i], sheetsList[i - 2]);
                 reportFormer.WriteHeaderNameResults(reportFormer.Sheets[i], categoriesList[i - 2]);
                 reportFormer.WriteHeaderForTableResults(reportFormer.Sheets[i], "A4", "I4");
                 lastMan = reportFormer.ResultsPlayersWithPlaces(reportFormer.Sheets[i], i);
                 reportFormer.JudgeWriter(reportFormer.Sheets[i], "E" + (lastMan + 8), "G" + (lastMan + 8));
             }
             for (int i = 7; i < 12; i++)
             {
                 reportFormer.WriteDrawHeader(reportFormer.Sheets[i], sheetsList[i - 7]);
                 reportFormer.DrawFullSheet(reportFormer.Sheets[i]);
             }
             MessageBox.Show("Завершено!");
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
     }
 }