Example #1
0
    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();
            }
        }
    }
Example #2
0
    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();
            }
        }
    }
Example #3
0
    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();
    }
Example #4
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        ZWL.BLL.ERPNetEmail MyModel = new ZWL.BLL.ERPNetEmail();
        MyModel.EmailTitle   = this.TextBox1.Text;
        MyModel.EmailContent = this.TxtContent.Text;
        string filelist = ZWL.Common.PublicMethod.GetSessionValue("WenJianList");

        if (filelist != null && filelist != "")
        {
            MyModel.FuJian = ZWL.Common.PublicMethod.GetSessionValue("WenJianList");
        }
        else
        {
            MyModel.FuJian = null;
        }

        MyModel.FromUser   = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        MyModel.EmailState = "已发";
        MyModel.TimeStr    = DateTime.Now;
        MyModel.ToUser     = this.TextBox2.Text.Trim();

        try
        {
            //获取现有设置
            ZWL.BLL.ERPPOPAndSMTP MySMTPModel = new ZWL.BLL.ERPPOPAndSMTP();
            MySMTPModel.GetModel(int.Parse(ZWL.Common.PublicMethod.GetSessionValue("UserID")));
            //发送邮件到Internet地址

            //FengGu.Common.MailSender.Send(MySMTPModel.SMTPServer, MySMTPModel.SMTPFromEmail, MyModel.ToUser, MyModel.EmailTitle, MyModel.EmailContent, true, Encoding.UTF8, true, MyModel.FuJian);
            Pop3ForJmail.SendMail(MySMTPModel.SMTPUserName, MySMTPModel.SMTPUserPwd, MySMTPModel.SMTPServer, MyModel.EmailTitle, MyModel.EmailContent, MySMTPModel.SMTPFromEmail, MyModel.ToUser, MyModel.FuJian);

            MyModel.Add();

            ZWL.Common.MessageBox.ShowAndRedirect(this, "Internet邮件添加成功!", "NetMailShou.aspx");
        }
        catch
        {
            MyModel.EmailState = "草稿";

            MyModel.Add();

            Response.Write("<script>alert('发送邮件时发生错误,请检查您的邮件参数设置是否正确!已保存至草稿!');</script>");
        }
        //写系统日志
        ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi();
        MyRiZhi.UserName    = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        MyRiZhi.DoSomething = "用户添加新邮件(" + this.TextBox1.Text + ")";
        MyRiZhi.IpStr       = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();
        MyRiZhi.Add();
    }
Example #5
0
    protected void ImageButton2_Click(object sender, EventArgs e)
    {
        string IDlist = ZWL.Common.PublicMethod.CheckCbx(this.GVData, "CheckSelect", "LabVisible");

        if (ZWL.DBUtility.DbHelperSQL.ExecuteSQL("update ERPNetEmail set EmailState='已发' where ID in (" + IDlist + ")") == -1)
        {
            Response.Write("<script>alert('发送邮件时发生错误!请重新登陆后重试!');</script>");
        }
        else
        {
            string[] IDArray = IDlist.Split(',');
            for (int jk = 0; jk < IDArray.Length; jk++)
            {
                if (IDArray[jk].Trim().Length > 0 && IDArray[jk].Trim() != "0")
                {
                    ZWL.BLL.ERPNetEmail MyModel = new ZWL.BLL.ERPNetEmail();
                    MyModel.GetModel(int.Parse(IDArray[jk].Trim()));
                    //Jmail发送邮件到InterNet
                    ZWL.BLL.ERPPOPAndSMTP MySMTPModel = new ZWL.BLL.ERPPOPAndSMTP();
                    MySMTPModel.GetModel(int.Parse(ZWL.Common.PublicMethod.GetSessionValue("UserID")));
                    //发送邮件到Internet地址
                    try
                    {
                        Pop3ForJmail.SendMail(MySMTPModel.SMTPUserName, MySMTPModel.SMTPUserPwd, MySMTPModel.SMTPServer, MyModel.EmailTitle, MyModel.EmailContent, MySMTPModel.SMTPFromEmail, MyModel.ToUser, MyModel.FuJian);
                    }
                    catch
                    {
                        //Response.Write("<script>alert('发送邮件时发生错误,请检查您的邮件参数设置是否正确!');</script>");
                    }
                }
            }

            DataBindToGridview();
            //写系统日志
            ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi();
            MyRiZhi.UserName    = ZWL.Common.PublicMethod.GetSessionValue("UserName");
            MyRiZhi.DoSomething = "用户发送草稿箱中的邮件";
            MyRiZhi.IpStr       = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();
            MyRiZhi.Add();

            Response.Write("<script>alert('邮件发送完毕!');</script>");
        }
    }
Example #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ZWL.Common.PublicMethod.CheckSession();
            ZWL.BLL.ERPPOPAndSMTP MyModel = new ZWL.BLL.ERPPOPAndSMTP();
            MyModel.GetModel(int.Parse(ZWL.Common.PublicMethod.GetSessionValue("UserID")));
            this.TextBox1.Text = MyModel.POP3UserName;
            this.TextBox2.Text = MyModel.POP3UserPwd;
            this.TextBox3.Text = MyModel.POP3Server;
            this.TextBox4.Text = MyModel.POP3Port;
            this.TextBox5.Text = MyModel.SMTPUserName;
            this.TextBox6.Text = MyModel.SMTPUserPwd;
            this.TextBox7.Text = MyModel.SMTPServer;
            this.TextBox8.Text = MyModel.SMTPFromEmail;

            //设定按钮权限
            ImageButton1.Visible = ZWL.Common.PublicMethod.StrIFIn("|023m|", ZWL.Common.PublicMethod.GetSessionValue("QuanXian"));
        }
    }
Example #7
0
    protected void ImageButton1_Click(object sender, EventArgs e)
    {
        ZWL.BLL.ERPNetEmail MyModel = new ZWL.BLL.ERPNetEmail();
        MyModel.EmailTitle   = this.TextBox1.Text;
        MyModel.EmailContent = this.TxtContent.Value;
        MyModel.FuJian       = ZWL.Common.PublicMethod.GetSessionValue("WenJianList");
        MyModel.FromUser     = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        MyModel.EmailState   = "已发";
        MyModel.TimeStr      = DateTime.Now;
        string[] ToWhoList = this.TextBox2.Text.Trim().Split(',');
        for (int i = 0; i < ToWhoList.Length; i++)
        {
            if (ToWhoList[i].Trim().Length > 0)
            {
                MyModel.ToUser = ToWhoList[i].Trim();
                MyModel.Add();

                //获取现有设置
                ZWL.BLL.ERPPOPAndSMTP MySMTPModel = new ZWL.BLL.ERPPOPAndSMTP();
                MySMTPModel.GetModel(int.Parse(ZWL.Common.PublicMethod.GetSessionValue("UserID")));
                //发送邮件到Internet地址
                try
                {
                    Pop3ForJmail.SendMail(MySMTPModel.SMTPUserName, MySMTPModel.SMTPUserPwd, MySMTPModel.SMTPServer, MyModel.EmailTitle, MyModel.EmailContent, MySMTPModel.SMTPFromEmail, MyModel.ToUser, MyModel.FuJian);
                }
                catch
                {
                    Response.Write("<script>alert('发送邮件时发生错误,请检查您的邮件参数设置是否正确!');</script>");
                }
            }
        }
        //写系统日志
        ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi();
        MyRiZhi.UserName    = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        MyRiZhi.DoSomething = "用户添加新邮件(" + this.TextBox1.Text + ")";
        MyRiZhi.IpStr       = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();
        MyRiZhi.Add();

        ZWL.Common.MessageBox.ShowAndRedirect(this, "Internet邮件添加成功!", "NetMailShou.aspx");
    }
Example #8
0
    protected void ImageButton1_Click(object sender, EventArgs e)
    {
        ZWL.BLL.ERPNetEmail MyModel = new ZWL.BLL.ERPNetEmail();
        MyModel.EmailTitle = this.TextBox1.Text;
        MyModel.EmailContent = this.TxtContent.Value;
        MyModel.FuJian = ZWL.Common.PublicMethod.GetSessionValue("WenJianList");
        MyModel.FromUser = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        MyModel.EmailState = "已发";
        MyModel.TimeStr = DateTime.Now;
        string[] ToWhoList = this.TextBox2.Text.Trim().Split(',');
        for (int i = 0; i < ToWhoList.Length; i++)
        {
            if (ToWhoList[i].Trim().Length > 0)
            {
                MyModel.ToUser = ToWhoList[i].Trim();
                MyModel.Add();

                //获取现有设置
                ZWL.BLL.ERPPOPAndSMTP MySMTPModel = new ZWL.BLL.ERPPOPAndSMTP();
                MySMTPModel.GetModel(int.Parse(ZWL.Common.PublicMethod.GetSessionValue("UserID")));
                //发送邮件到Internet地址
                try
                {
                    Pop3ForJmail.SendMail(MySMTPModel.SMTPUserName, MySMTPModel.SMTPUserPwd, MySMTPModel.SMTPServer, MyModel.EmailTitle, MyModel.EmailContent, MySMTPModel.SMTPFromEmail, MyModel.ToUser, MyModel.FuJian);
                }
                catch
                {
                    Response.Write("<script>alert('发送邮件时发生错误,请检查您的邮件参数设置是否正确!');</script>");
                }
            }
        }
        //写系统日志
        ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi();
        MyRiZhi.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        MyRiZhi.DoSomething = "用户添加新邮件(" + this.TextBox1.Text + ")";
        MyRiZhi.IpStr = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();
        MyRiZhi.Add();

        ZWL.Common.MessageBox.ShowAndRedirect(this, "Internet邮件添加成功!", "NetMailShou.aspx");
    }
Example #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ZWL.Common.PublicMethod.CheckSession();
            ZWL.BLL.ERPPOPAndSMTP MyModel = new ZWL.BLL.ERPPOPAndSMTP();
            MyModel.GetModel(int.Parse(ZWL.Common.PublicMethod.GetSessionValue("UserID")));
            this.TextBox1.Text = MyModel.POP3UserName;
            this.TextBox2.Text = MyModel.POP3UserPwd;
            this.TextBox3.Text = MyModel.POP3Server;
            this.TextBox4.Text = MyModel.POP3Port;
            this.TextBox5.Text = MyModel.SMTPUserName;
            this.TextBox6.Text = MyModel.SMTPUserPwd;
            this.TextBox7.Text = MyModel.SMTPServer;
            this.TextBox8.Text = MyModel.SMTPFromEmail;

            TextBox2.Attributes.Add("value", MyModel.POP3UserPwd);
            TextBox6.Attributes.Add("value", MyModel.SMTPUserPwd);

            //设定按钮权限
            ImageButton1.Visible = ZWL.Common.PublicMethod.StrIFIn("|096M|", ZWL.Common.PublicMethod.GetSessionValue("QuanXian"));
        }
    }