private void Button4_Click(object sender, EventArgs e)
        {
            DateTime from = dtPickerFrom.Value;
            DateTime to   = dtPickerTo.Value;

            //Class.DateTimeControl.ReturnDateTimeForWeekly(ref from, ref to);
            //Class.DateTimeControl.ReturnDateTimeForMonthly(ref from, ref to);
            ExportExcelTool   exportExcelTool   = new ExportExcelTool();
            string            path              = @"C:\ERP_Temp\Reliability Report_" + DateTime.Now.ToString("ddMMyy HHmmss") + ".xlsx";
            string            pathTemplate      = Environment.CurrentDirectory + @"\Resources\Reliability.xlsx";
            RealabilityReport realabilityReport = new RealabilityReport();
            //   realabilityReport.SendMailReliabilityReportWeekly();
            List <ReliabilitySummary> ListReliability     = new List <ReliabilitySummary>();
            List <ReliabilitySummary> ListReliabilityDept = new List <ReliabilitySummary>();

            ListReliability = realabilityReport.GetDataForReliability(from, to, out ListReliabilityDept);
            exportExcelTool.ExportToReliabilityReport(pathTemplate, path, ListReliability, ListReliabilityDept, from, to);
        }
Beispiel #2
0
        public bool SendMailReliabilityReportMonthly()
        {
            try
            {
                DateTimeControl.ReturnDateTimeForMonthly(ref dateFrom, ref dateTo);
                RealabilityReport         realabilityReport   = new RealabilityReport();
                List <ReliabilitySummary> ListReliability     = new List <ReliabilitySummary>();
                List <ReliabilitySummary> ListReliabilityDept = new List <ReliabilitySummary>();
                ListReliability = realabilityReport.GetDataForReliability(dateFrom, dateTo, out ListReliabilityDept);
                ExportExcelTool exportExcelTool = new ExportExcelTool();
                string          path            = @"C:\ERP_Temp\Reliability_Report_" + DateTime.Now.ToString("ddMMyy HHmmss") + ".xlsx";
                exportExcelTool.ExportToReliabilityReport(pathTemplate, path, ListReliability, ListReliabilityDept, dateFrom, dateTo);
            }

            catch (Exception ex)
            {
                Logfile.Output(StatusLog.Error, "SendMailReliabilityReportWeekly()", ex.Message);
                return(false);
            }
            return(true);
        }