Esempio n. 1
0
        static void Main(string[] args)
        {
            try
            {
                EnrollmentDetailReportCommand command = new EnrollmentDetailReportCommand(@"Data Source=DESKTOP-LVR47M8\SQLSERVER2019;Initial Catalog=CourseReport;Integrated Security=True");
                IList<EnrollmentDetailReportModel> models = command.GetList();

                var reportFileName = "EnrollmentDetailsReport.xlsx";
                EnrollmentDetailReportSpreadSheetCreator enrollmentSheetCreator = new EnrollmentDetailReportSpreadSheetCreator();
                enrollmentSheetCreator.Create(reportFileName, models);

                EnrollmentDetailReportEmailSender emailer = new EnrollmentDetailReportEmailSender();
                emailer.Send(reportFileName);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Something went wrong: {0}", ex.Message);
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            try
            {
                EnrollmentDetailReportCommand       cmd    = new EnrollmentDetailReportCommand("Data Source=localhost;Initial Catalog=CourseReport;Integrated Security=True");
                IList <EnrollmentDetailReportModel> models = cmd.GetList();

                var reportFileName = "EnrollmentDetailsReport.xlsx";
                EnrollmentDetailReportSpreadsheetCreator enrollmentSheetCreator = new EnrollmentDetailReportSpreadsheetCreator();
                enrollmentSheetCreator.Create(reportFileName, models);

                EnrollmentDetailReportEmailSender sender = new EnrollmentDetailReportEmailSender();
                sender.Send(reportFileName);
            }
            catch (Exception e)
            {
                Console.WriteLine("Something went wrong: {0}", e.Message);
            }
        }