Beispiel #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            EmailExecuter ex = new EmailExecuter();

            ex.SendDailyUSMails();
            ex.SendDailyCNMails();
        }
 public string SendTimeSheetEmail(string password)
 {
     if (password == Config.TimesheetNoticeSvrPw)
     {
         EmailExecuter execute  = new EmailExecuter();
         bool          cnresult = false;
         bool          usresult = false;
         string        country  = "";
         try
         {
             int start = Config.TimesheetNoticeTimeStart;
             if (DateTime.Now.Hour >= start && DateTime.Now.Hour < start + 1)
             {
                 usresult = execute.SendDailyUSMails(DateTime.Now.AddDays(-1));
                 cnresult = execute.SendDailyCNMails(DateTime.Now.AddDays(-1));
                 //country += "AO: " + execute.SendDailyMail(DateTime.Now.AddDays(-1), "AO");
                 //country += ", D1: " + execute.SendDailyMail(DateTime.Now.AddDays(-1), "D1");
                 //country += ", D2: " + execute.SendDailyMail(DateTime.Now.AddDays(-1), "D2");
             }
             return(string.Format("CN:{0},US:{1}, {2}", cnresult, usresult, country));
         }
         catch (Exception ex)
         {
             WebLogAgent.Write(ex);
             return(ex.Message);
         }
     }
     else
     {
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.Append("###################Failed timesheet notice access###########")
         .AppendFormat("IP: {0}", Context.Request.UserHostAddress)
         .AppendFormat("Hostname: {0}", Context.Request.UserHostName)
         .AppendFormat("Referer: {0}", Context.Request.UrlReferrer)
         .AppendFormat("Password: {0}", password)
         .Append("#############################################################");
         WebLogAgent.Write(stringBuilder.ToString());
         return(false.ToString());
     }
 }
 public string SendTimeSheetEmail(string password)
 {
     if (password == Config.TimesheetNoticeSvrPw)
     {
         EmailExecuter execute = new EmailExecuter();
         bool          ret     = false;
         string        country = "CN";
         try
         {
             if (DateTime.Now.Hour >= 9 && DateTime.Now.Hour <= 11)
             {
                 ret = execute.SendDailyCNMails();
             }
             else
             {
                 ret     = execute.SendDailyUSMails();
                 country = "US";
             }
             return(string.Format("{0}-{1}", country, ret.ToString()));
         }
         catch (Exception ex)
         {
             WebLogAgent.Write(ex);
             return(ex.Message);
         }
     }
     else
     {
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.Append("###################Failed timesheet notice access###########")
         .AppendFormat("IP: {0}", Context.Request.UserHostAddress)
         .AppendFormat("Hostname: {0}", Context.Request.UserHostName)
         .AppendFormat("Referer: {0}", Context.Request.UrlReferrer)
         .AppendFormat("Password: {0}", password)
         .Append("#############################################################");
         WebLogAgent.Write(stringBuilder.ToString());
         return(false.ToString());
     }
 }