public void AmWork(object source, ElapsedEventArgs e) { TCPMail oMail = new TCPMail(); string mailHead = "ICSON Daemon Running---" + DateTime.Now.ToString(AppConst.DateFormatLong); if ( oMail.Send(AppConfig.AdminEmail, mailHead, "OK") ) { } else { ErrorLog.GetInstance().Write("����emailʧ��:" + mailHead); } }
public void DoProductSaleTrend(object source, ElapsedEventArgs e) { //if ( DateTime.Now.Hour >= 22 && DateTime.Now.Hour < 23) if (DateTime.Now.Hour >= 9 && DateTime.Now.Hour < 10) { ProductSaleTrendManager.GetInstance().UpToDate(); TCPMail oMail = new TCPMail(); string mailHead = "������������---" + DateTime.Now.ToString(AppConst.DateFormatLong); if ( oMail.Send(AppConfig.AdminEmail, mailHead, "OK") ) { } else { ErrorLog.GetInstance().Write("����emailʧ��:" + mailHead); } } }
public void DoDelayPoint() { string sql = @"select sp.* ,sm.pointamt,sm.customersysno from sale_pointdelay sp(nolock) inner join so_master sm(nolock) on sm.sysno = sp.sosysno inner join finance_soincome fs(nolock) on sm.sysno=fs.ordersysno where sm.pointamt <> 0 and sm.status = "+(int)AppEnum.SOStatus.OutStock+" and sp.status = "+(int)AppEnum.TriStatus.Origin+" and createtime<="+ Util.ToSqlString( DateTime.Now.AddDays(-3).ToString(AppConst.DateFormatLong)) + " and fs.ordertype=" + (int)AppEnum.SOIncomeOrderType.SO + " and fs.status=" + (int)AppEnum.SOIncomeStatus.Confirmed; DataSet ds = SqlHelper.ExecuteDataSet(sql); if(Util.HasMoreRow(ds)) { Hashtable failHash = new Hashtable(); foreach(DataRow dr in ds.Tables[0].Rows) { SalePointDelayInfo spInfo = new SalePointDelayInfo(); this.map(spInfo,dr); try { this.doDelayPoint(spInfo,(int)dr["PointAmt"],(int)dr["CustomerSysNo"]); } catch { failHash.Add(spInfo.SysNo,spInfo); } } TCPMail oMail = new TCPMail(); if(failHash.Count>0) { StringBuilder sb = new StringBuilder(); sb.Append("<table align='center' border='1' cellpadding='0' cellspacing='0'>"); sb.Append(" <tr>"); sb.Append(" <td>SysNo</td>"); sb.Append(" <td>SOSysNo</td>"); sb.Append(" <td>CreateTime</td>"); sb.Append(" </tr>"); foreach(SalePointDelayInfo failInfo in failHash.Values) { sb.Append("<tr>"); sb.Append(" <td>"+failInfo.SysNo+"</td>"); sb.Append(" <td>"+failInfo.SOSysNo+"</td>"); sb.Append(" <td>"+failInfo.CreateTime+"</td>"); sb.Append("</tr>"); } sb.Append("</table>"); oMail.Send(AppConfig.AdminEmail,"Add Delay Point---Failed : "+DateTime.Now.ToString(AppConst.DateFormatLong),sb.ToString()); } else oMail.Send(AppConfig.AdminEmail,"Add Delay Point---OK : "+DateTime.Now.ToString(AppConst.DateFormatLong), ""); } else { TCPMail oMail = new TCPMail(); oMail.Send(AppConfig.AdminEmail, "Add Delay Point None---: " + DateTime.Now.ToString(AppConst.DateFormatLong), ""); } }
public void CheckUserScore() { string sql = @"select customersysno,sum(pointamount) as PointLogTotal ,validscore from customer_pointlog cp inner join customer c on c.sysno = cp.customersysno where c.status ="+(int)AppEnum.BiStatus.Valid +@" group by customersysno,validscore having sum(pointamount)<>validscore"; DataSet ds = SqlHelper.ExecuteDataSet(sql); Hashtable errorHash = new Hashtable(); Hashtable failHash = new Hashtable(); TCPMail oMail = new TCPMail(); if(Util.HasMoreRow(ds)) { foreach(DataRow dr in ds.Tables[0].Rows) { try { Hashtable paramHash = new Hashtable(); paramHash.Add("SysNo",(int)dr["CustomerSysNo"]); paramHash.Add("Status",(int)AppEnum.BiStatus.InValid); CustomerManager.GetInstance().Update(paramHash); errorHash.Add((int)dr["CustomerSysNo"],dr); } catch { failHash.Add((int)dr["CustomerSysNo"],dr); } } } if(errorHash.Count>0) { StringBuilder sb = new StringBuilder(); sb.Append("<table align='center' border='0' cellpadding='0' cellspacing='0'>"); sb.Append(" <tr>"); sb.Append(" <td>CustomerSysNo</td>"); sb.Append(" <td>PointLogTotal</td>"); sb.Append(" <td>ValidScore</td>"); sb.Append(" </tr>"); foreach(DataRow drer in errorHash.Values) { sb.Append("<tr>"); sb.Append(" <td>"+drer["CustomerSysNo"].ToString()+"</td>"); sb.Append(" <td>"+drer["PointLogTotal"].ToString()+"</td>"); sb.Append(" <td>"+drer["ValidScore"].ToString()+"</td>"); sb.Append("</tr>"); } sb.Append("</table>"); oMail.Send(AppConfig.AdminEmail,"ScoreErrorUpdated:"+DateTime.Now.ToLongDateString(),sb.ToString()); } if(failHash.Count>0) { StringBuilder sb1 = new StringBuilder(); sb1.Append("<table align='center' border='0' cellpadding='0' cellspacing='0'>"); sb1.Append(" <tr>"); sb1.Append(" <td>CustomerSysNo</td>"); sb1.Append(" <td>PointLogTotal</td>"); sb1.Append(" <td>ValidScore</td>"); sb1.Append(" </tr>"); foreach(DataRow drer in errorHash.Values) { sb1.Append("<tr>"); sb1.Append(" <td>"+drer["CustomerSysNo"].ToString()+"</td>"); sb1.Append(" <td>"+drer["PointLogTotal"].ToString()+"</td>"); sb1.Append(" <td>"+drer["ValidScore"].ToString()+"</td>"); sb1.Append("</tr>"); } sb1.Append("</table>"); oMail.Send(AppConfig.AdminEmail,"ScoreErrorNotUpdated:"+DateTime.Now.ToLongDateString(),sb1.ToString()); } }