protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ZWL.Common.PublicMethod.CheckSession(); DataBindToGridview(); if (!String.IsNullOrEmpty(Request.QueryString["method"])) { //收取Internet中的邮件 DateTime MaxDate = DateTime.MinValue; try { MaxDate = DateTime.Parse(ZWL.DBUtility.DbHelperSQL.GetSHSL("select max(TimeStr) from ERPNetEmail where ToUser='******'")); } catch { } //获取现有设置 ZWL.BLL.ERPPOPAndSMTP MyModel = new ZWL.BLL.ERPPOPAndSMTP(); MyModel.GetModel(int.Parse(ZWL.Common.PublicMethod.GetSessionValue("UserID"))); try { Pop3ForJmail.GetNewMailIntoDataBase(MyModel.POP3UserName, MyModel.POP3UserPwd, MyModel.POP3Server, int.Parse(MyModel.POP3Port), MaxDate); Response.Write("<script>alert('邮件收取完毕!');</script>"); } catch (Exception ee) { string ErrMsg = ee.Message.ToString(); Response.Write("<script>alert('" + ErrMsg + "');</script>"); } DataBindToGridview(); } } }
protected void ImageButton5_Click(object sender, ImageClickEventArgs e) { //收取Internet中的邮件 DateTime MaxDate = DateTime.MinValue; try { MaxDate = DateTime.Parse(ZWL.DBUtility.DbHelperSQL.GetSHSL("select max(TimeStr) from ERPNetEmail where ToUser='******'")); } catch { } //获取现有设置 ZWL.BLL.ERPPOPAndSMTP MyModel = new ZWL.BLL.ERPPOPAndSMTP(); MyModel.GetModel(int.Parse(ZWL.Common.PublicMethod.GetSessionValue("UserID"))); try { Pop3ForJmail.GetNewMailIntoDataBase(MyModel.POP3UserName, MyModel.POP3UserPwd, MyModel.POP3Server, int.Parse(MyModel.POP3Port.Split('_')[1].Trim()), MaxDate); Response.Write("<script>alert('邮件收取完毕!');</script>"); } catch (Exception ee) { string ErrMsg = ee.Message.ToString(); Response.Write("<script>alert('" + ErrMsg + "');</script>"); } DataBindToGridview(); }