Example #1
0
        private bool InsertSendMailtoRecord(ScheduleReportItems schedule, string attachFile)
        {
            StringBuilder sqlinsert = new StringBuilder();

            sqlinsert.Append("insert into t_email_record ");
            sqlinsert.Append(@"(reportname,reporttype,Minutes,hours,day,date,month,subject,attach,inputdate) values ('");
            sqlinsert.Append(schedule.ReportName + "' , '" + schedule.ReportType + "' , '" + schedule.Minutes + "' , '" + schedule.Hours + "', '" + "" + "' , '" + "" + "', '");
            sqlinsert.Append("" + "' , '" + schedule.Subject + "' , '" + attachFile + "' , '" + DateTime.Now + "' )");
            sqlCON insert = new sqlCON();

            insert.sqlExecuteNonQuery(sqlinsert.ToString(), false);
            return(true);
        }
Example #2
0
 private void ReportSchechule_FormClosed(object sender, FormClosedEventArgs e)
 {
     try
     {
         dtScheduleSendMail = new DataTable();
         StringBuilder sql = new StringBuilder();
         sql.Append("select reportname, reporttype,Minutes ,hours, day, date, month,isBodyHTML,subject, attach, comments from t_report_schedule where 1=1 ");
         sqlCON tf = new sqlCON();
         tf.sqlDataAdapterFillDatatable(sql.ToString(), ref dtScheduleSendMail);
         dgv_show.DataSource = dtScheduleSendMail;
         dgv_show.Refresh();
         listReport = new List <ScheduleReportItems>();
         listReport = Listreport(dtScheduleSendMail);
     }
     catch (Exception ex)
     {
         Logfile.Output(StatusLog.Error, "Load data from SQL fail: ", ex.Message);
     }
 }
Example #3
0
        private List <EmailNeedSend> EmailNeedSends(string reportName)
        {
            List <EmailNeedSend> listEmailsend = new List <EmailNeedSend>();

            try
            {
                dtListEmail = new DataTable();
                StringBuilder sqllistmail = new StringBuilder();
                sqllistmail.Append("select emailaddress, deptcode, status, usingfunction from m_email where status = 'YES' and usingfunction = '" + reportName + "'");
                sqlCON tf = new sqlCON();
                tf.sqlDataAdapterFillDatatable(sqllistmail.ToString(), ref dtListEmail);
                listEmailsend = ListEmailNeedSend(dtListEmail);
            }
            catch (Exception ex)
            {
                Logfile.Output(StatusLog.Error, "Load list email send fail ", ex.Message);
            }

            return(listEmailsend);
        }
Example #4
0
 private bool CheckIsSentMailComplete(ScheduleReportItems scheduleReport)
 {
     if (scheduleReport.ReportType == "Daily")
     {
         DataTable     dtRecord = new DataTable();
         StringBuilder sql      = new StringBuilder();
         sql.Append("select reportname,reporttype,Minutes,hours,day,date,month,subject,attach,inputdate from t_email_record where ");
         sql.Append("reportname = '" + scheduleReport.ReportName + "' and ");
         sql.Append("reporttype = '" + scheduleReport.ReportType + "' and ");
         sql.Append("Minutes = '" + scheduleReport.Minutes + "' and ");
         sql.Append("hours = '" + scheduleReport.Hours + "' and ");
         sql.Append("inputdate > '" + DateTime.Now.Date + "'");
         sqlCON tf = new sqlCON();
         tf.sqlDataAdapterFillDatatable(sql.ToString(), ref dtRecord);
         if (dtRecord.Rows.Count > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else if (scheduleReport.ReportType == "Weekly")
     {
         DataTable     dtRecord = new DataTable();
         StringBuilder sql      = new StringBuilder();
         sql.Append("select reportname,reporttype,hours,day,date,month,subject,attach,inputdate from t_email_record where ");
         sql.Append("reportname = '" + scheduleReport.ReportName + "' and ");
         sql.Append("reporttype = '" + scheduleReport.ReportType + "' and ");
         sql.Append("day = '" + scheduleReport.Day + "' and ");
         sql.Append("hours = '" + scheduleReport.Hours + "' and ");
         sql.Append("Minutes = '" + scheduleReport.Minutes + "' and ");
         sql.Append("inputdate > '" + DateTime.Now.Date + "'");
         sqlCON tf = new sqlCON();
         tf.sqlDataAdapterFillDatatable(sql.ToString(), ref dtRecord);
         if (dtRecord.Rows.Count > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else if (scheduleReport.ReportType == "Monthly")
     {
         DataTable     dtRecord = new DataTable();
         StringBuilder sql      = new StringBuilder();
         sql.Append("select reportname,reporttype,hours,day,date,month,subject,attach,inputdate from t_email_record where ");
         sql.Append("reportname = '" + scheduleReport.ReportName + "' and ");
         sql.Append("reporttype = '" + scheduleReport.ReportType + "' and ");
         sql.Append("date = '" + scheduleReport.Date + "' and ");
         sql.Append("hours = '" + scheduleReport.Hours + "' and ");
         sql.Append("Minutes = '" + scheduleReport.Minutes + "' and ");
         sql.Append("inputdate > '" + DateTime.Now.Date + "'");
         sqlCON tf = new sqlCON();
         tf.sqlDataAdapterFillDatatable(sql.ToString(), ref dtRecord);
         if (dtRecord.Rows.Count > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else if (scheduleReport.ReportType == "Yearly")
     {
         DataTable     dtRecord = new DataTable();
         StringBuilder sql      = new StringBuilder();
         sql.Append("select reportname,reporttype,hours,day,date,month,subject,attach,inputdate from t_email_record where ");
         sql.Append("reportname = '" + scheduleReport.ReportName + "' and ");
         sql.Append("reporttype = '" + scheduleReport.ReportType + "' and ");
         sql.Append("month = '" + scheduleReport.Month + "' and ");
         sql.Append("date = '" + scheduleReport.Date + "' and ");
         sql.Append("hours = '" + scheduleReport.Hours + "' and ");
         sql.Append("Minutes = '" + scheduleReport.Minutes + "' and ");
         sql.Append("inputdate > '" + DateTime.Now.Date + "'");
         sqlCON tf = new sqlCON();
         tf.sqlDataAdapterFillDatatable(sql.ToString(), ref dtRecord);
         if (dtRecord.Rows.Count > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     return(false);
 }