/// <summary>
        /// Листенер нажатия на кнопку "Создать отчеты"
        /// </summary>
        private void btnCreateReport_Click(object sender, RoutedEventArgs e)
        {
            Dictionary <string, object> dict = new Dictionary <string, object>();
            bool xml = (bool)cbXML.IsChecked;
            bool xls = (bool)cbXLS.IsChecked;

            dict.Add("Company", tbCompany.Text);
            dict.Add("InDate", dpInDate.SelectedDate);
            dict.Add("OutDate", dpOutDate.SelectedDate);

            try
            {
                if (cbUserReportBox.IsChecked == true)
                {
                    Report userReport = new UserReport(new UserReportFactory());
                    userReport.CreateReport(LogLineCollection, dict);
                    userReport.Write(ReportFolder, xml, xls);
                }
                if (cbIPReportBox.IsChecked == true)
                {
                    Report ipreport = new IPReport(new IPReportFactory());
                    ipreport.CreateReport(LogLineCollection, dict);
                    ipreport.Write(ReportFolder, xml, xls);
                }
                if (cbCompanyReportBox.IsChecked == true)
                {
                    Report companyReport = new CompanyReport(new CompanyReportFactory());
                    companyReport.CreateReport(LogLineCollection, dict);
                    companyReport.Write(ReportFolder, xml, xls);
                }
                if (cbCompanyUserReportBox.IsChecked == true)
                {
                    Report companyUserReport = new CompanyUserReport(new CompanyUserReportFactory());
                    companyUserReport.CreateReport(LogLineCollection, dict);
                    companyUserReport.Write(ReportFolder, xml, xls);
                }
                if (cbErrorReportBox.IsChecked == true)
                {
                    Report errorreport = new ErrorReport(new ErrorReportFactory());
                    errorreport.CreateReport(LogLineCollection, dict);
                    errorreport.Write(ReportFolder, xml, xls);
                }
                MessageBox.Show("Отчеты сохранены в " + ReportFolder);
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
            }
        }
Example #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Report userReport = new UserReport(logLineList);

            userReport.WriteToXML(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Report.xml");
        }