コード例 #1
0
        private void BacklogReport_Load(object sender, EventArgs e)
        {
            string       ReportName   = "BackLogReport";
            GetDataEmail getDataEmail = new GetDataEmail();
            List <ScheduleReportItems> scheduleReportItems = getDataEmail.GetScheduleReportCommon(ReportName);
            List <EmailNeedSend>       emailNeedSends      = getDataEmail.GetEmailNeedSends(ReportName);
            string PathFoler = @"C:\ERP_Temp\";

            if (scheduleReportItems != null && scheduleReportItems.Count == 1)
            {
                if (emailNeedSends != null && emailNeedSends.Count > 0)
                {
                    SendMailFunction sendmail = new SendMailFunction();
                    var isOK = sendmail.SendMailwithExportExcelbyCompanyMail(scheduleReportItems[0], emailNeedSends, ref dtgr, PathFoler, "");
                    if (isOK)
                    {
                        Log.Logfile.Output(Log.StatusLog.Normal, "Send mail BackLogReport OK");
                    }
                    else
                    {
                        Log.Logfile.Output(Log.StatusLog.Normal, "Send mail BackLogReport fail ");
                    }
                }
            }
            this.Close();
        }
コード例 #2
0
        private void ReliabilityReportMonthly_Load(object sender, EventArgs e)
        {
            string       ReportName   = "Reliability_Report";
            GetDataEmail getDataEmail = new GetDataEmail();
            List <ScheduleReportItems> scheduleReportItems = getDataEmail.GetScheduleReportCommon(ReportName);
            List <EmailNeedSend>       emailNeedSends      = getDataEmail.GetEmailNeedSends(ReportName);

            if (scheduleReportItems != null && scheduleReportItems.Count == 1)
            {
                if (emailNeedSends != null && emailNeedSends.Count > 0)
                {
                    SendMailFunction sendmail = new SendMailFunction();
                    sendmail.SendMailwithExportExceReliabilitybyCompanyMailForMonthly(scheduleReportItems[0], emailNeedSends);
                }
            }
            this.Close();
        }
コード例 #3
0
        private bool SendEmailStatus(List <ScheduleReportItems> listReport)
        {
            foreach (var item in listReport)
            {
                if (item.ReportType == "Daily")
                {
                    if (DateTime.Now.Hour == int.Parse(item.Hours) && DateTime.Now.Minute == int.Parse(item.Minutes))
                    {
                        List <EmailNeedSend> emailNeeds = new List <EmailNeedSend>();
                        emailNeeds = EmailNeedSends(item.ReportName);
                        if (CheckIsSentMailComplete(item) == false)
                        {
                            if (emailNeeds != null && emailNeeds.Count > 0)
                            {
                                if (item.ReportName == "BackLogReport")
                                {
                                    SendMailFunction sendmail = new SendMailFunction();
                                    var isOK = sendmail.SendMailwithExportExcelbyCompanyMail(item, emailNeeds, ref dgv_export, item.AttachedFolder, version);

                                    if (isOK)
                                    {
                                        InsertSendMailtoRecord(item, item.AttachedFolder);
                                        isExportExcel = false;
                                    }
                                }
                                else if (item.ReportName == "MQC_Daily")
                                {
                                    SendMailFunction sendmail = new SendMailFunction();
                                    PeriodProduction period   = new PeriodProduction();
                                    if (int.Parse(item.Hours) == 8)
                                    {
                                        period = PeriodProduction.AllDay;
                                    }
                                    else if (int.Parse(item.Hours) == 20)
                                    {
                                        period = PeriodProduction.dayshift;
                                    }
                                    else if (int.Parse(item.Hours) < 8)
                                    {
                                        period = PeriodProduction.nightshift;
                                    }
                                    else if (int.Parse(item.Hours) > 8 && int.Parse(item.Hours) < 20)
                                    {
                                        period = PeriodProduction.dayshift;
                                    }

                                    if (sendmail.SendMailwithExportExceMQCbyCompanyMail(period, item, emailNeeds))
                                    {
                                        InsertSendMailtoRecord(item, item.AttachedFolder);
                                        isExportExcel = false;
                                    }
                                }
                            }
                        }
                    }
                }
                else if (item.ReportType == "Weekly")
                {
                    if (DateTime.Now.DayOfWeek.ToString() == item.Day && DateTime.Now.Hour == int.Parse(item.Hours) && DateTime.Now.Minute == int.Parse(item.Minutes))
                    {
                        List <EmailNeedSend> emailNeeds = new List <EmailNeedSend>();
                        emailNeeds = EmailNeedSends(item.ReportName);
                        if (CheckIsSentMailComplete(item) == false)
                        {
                            if (emailNeeds != null && emailNeeds.Count > 0)
                            {
                                SendMailFunction sendmail = new SendMailFunction();
                                if (sendmail.SendMailtoReportByCompanyMail(item, emailNeeds))
                                {
                                    InsertSendMailtoRecord(item, item.AttachedFolder);
                                }
                            }
                        }
                    }
                }
                else if (item.ReportType == "Monthly")
                {
                    if (DateTime.Now.Date.ToString() == item.Date && DateTime.Now.Hour == int.Parse(item.Hours) && DateTime.Now.Minute == int.Parse(item.Minutes))
                    {
                        List <EmailNeedSend> emailNeeds = new List <EmailNeedSend>();
                        emailNeeds = EmailNeedSends(item.ReportName);
                        if (CheckIsSentMailComplete(item) == false)
                        {
                            if (emailNeeds != null && emailNeeds.Count > 0)
                            {
                                SendMailFunction sendmail = new SendMailFunction();
                                if (sendmail.SendMailtoReportByCompanyMail(item, emailNeeds))
                                {
                                    InsertSendMailtoRecord(item, item.AttachedFolder);
                                }
                            }
                        }
                    }
                }
                else if (item.ReportType == "Yearly")
                {
                    if (DateTime.Now.ToString("MMMM") == item.Month && DateTime.Now.Date.ToString() == item.Date && DateTime.Now.Hour == int.Parse(item.Hours) && DateTime.Now.Minute == int.Parse(item.Minutes))
                    {
                        List <EmailNeedSend> emailNeeds = new List <EmailNeedSend>();
                        emailNeeds = EmailNeedSends(item.ReportName);
                        if (CheckIsSentMailComplete(item) == false)
                        {
                            if (emailNeeds != null && emailNeeds.Count > 0)
                            {
                                SendMailFunction sendmail = new SendMailFunction();
                                if (sendmail.SendMailtoReportByCompanyMail(item, emailNeeds))
                                {
                                    InsertSendMailtoRecord(item, item.AttachedFolder);
                                }
                            }
                        }
                    }
                }
            }
            return(false);
        }