Beispiel #1
0
    private void BindData()
    {
        string      id     = Request.QueryString["id"];
        ZX_Email1BU email1 = new ZX_Email1BU();
        DataSet     ds1    = email1.GetSendMail(id);

        this.title.Text  = ds1.Tables[0].Rows[0]["title"].ToString();
        this.remark.Text = (Util.ChangeToShow(ds1.Tables[0].Rows[0]["remark"].ToString())).Replace("<br>", "");
    }
Beispiel #2
0
    //绑定数据
    private void BindData()
    {
        string      id    = Request.QueryString["id"].ToString();
        ZX_Email1BU emal1 = new ZX_Email1BU();
        DataSet     ds1   = emal1.GetSendMail(id);

        this.mailForm1.DataSource = ds1;
        this.mailForm1.DataBind();
        emal1.Close();
    }
Beispiel #3
0
    //bind data
    private void BindData()
    {
        ZX_Email1BU email1   = new ZX_Email1BU();
        int         totalRow = 0;
        int         curpage  = 1;

        if (ViewState["curpage"] != null)
        {
            curpage = (int)ViewState["curpage"];
        }
        string orderby = null;

        if (ViewState["orderby"] != null)
        {
            orderby = ((SqlOrderBy)(ViewState["orderby"])).OrderExpression;
        }
        DataSet ds1 = new DataSet();

        ds1 = email1.GetSendMail(curpage, this.PageNavigator1.PageSize, orderby, out totalRow);
        this.GridView1.DataSource = ds1;
        this.GridView1.DataBind();

        this.PageNavigator1.TotalRows   = totalRow;
        this.PageNavigator1.CurrentPage = curpage;

        if (ds1.Tables[0].Rows.Count == 0 && curpage > 1)
        {
            ViewState["curpage"] = curpage - 1;
            this.BindData();
        }

        //隐藏删除等控件
        if (totalRow > 0)
        {
            this.info2.Visible = true;
        }
        else
        {
            this.info2.Visible = false;
        }
        email1.Close();
    }
Beispiel #4
0
    //删除邮件
    protected void Button1_Click(object sender, EventArgs e)
    {
        ZX_Email1BU emal1 = new ZX_Email1BU();
        string      id    = Request.QueryString["id"];
        DataSet     ds1   = emal1.GetSendMail(id);
        string      file1 = ds1.Tables[0].Rows[0]["file1"].ToString();

        if (file1 != "" && file1 != null)
        {
            ZX_EmailBu email1 = new ZX_EmailBu();
            bool       Cunzai = email1.IfCzFile(file1, "1");
            if (Cunzai == false)
            {
                File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file1));
            }
            email1.Dispose();
        }
        string file2 = ds1.Tables[0].Rows[0]["file2"].ToString();

        if (file2 != "" && file2 != null)
        {
            ZX_EmailBu email2  = new ZX_EmailBu();
            bool       Cunzai2 = email2.IfCzFile(file2, "2");
            if (Cunzai2 == false)
            {
                File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file2));
            }
            email2.Dispose();
        }
        string file3 = ds1.Tables[0].Rows[0]["file3"].ToString();

        if (file3 != "" && file3 != null)
        {
            ZX_EmailBu email3  = new ZX_EmailBu();
            bool       Cunzai3 = email3.IfCzFile(file3, "3");
            if (Cunzai3 == false)
            {
                File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file3));
            }
            email3.Dispose();
        }
        string file4 = ds1.Tables[0].Rows[0]["file4"].ToString();

        if (file4 != "" && file4 != null)
        {
            ZX_EmailBu email4  = new ZX_EmailBu();
            bool       Cunzai4 = email4.IfCzFile(file4, "4");
            if (Cunzai4 == false)
            {
                File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file4));
            }
            email4.Dispose();
        }
        string file5 = ds1.Tables[0].Rows[0]["file5"].ToString();

        if (file5 != "" && file5 != null)
        {
            ZX_EmailBu email5  = new ZX_EmailBu();
            bool       Cunzai5 = email5.IfCzFile(file5, "5");
            if (Cunzai5 == false)
            {
                File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file5));
            }
            email5.Dispose();
        }
        emal1.DelMail(id);
        emal1.Close();
        Comm.ShowInfo("操作提示:删除留言数据成功!", Application["root"] + "/info/SendMail.aspx");
    }
Beispiel #5
0
    //设置邮件信息
    private void setMail()
    {
        DataSet ds1 = null;
        string  id  = null;

        if (Request.QueryString["tousers"] != null)
        {
            this.to1.Text = Server.UrlDecode(Request.QueryString["tousers"]);
        }

        if (Request.QueryString["sendid"] != null || Request.QueryString["inboxid"] != null)
        {
            //来自发件箱
            if (Request.QueryString["sendid"] != null)
            {
                id = Request.QueryString["sendid"];
                ZX_Email1BU email1 = new ZX_Email1BU();
                ds1 = email1.GetSendMail(id);
                email1.Close();
            }
            else
            {
                //来自收件箱
                id = Request.QueryString["inboxid"];
                ZX_EmailBu email2 = new ZX_EmailBu();
                ds1 = email2.GetUserMail(id);
                email2.Close();
            }
        }

        if (ds1 != null)
        {
            DataRow dr = ds1.Tables[0].Rows[0];
            if (Request["back"] != null)
            {
                this.Title      = "回复邮件"; //回复邮件
                this.title.Text = "回复:" + dr["title"].ToString();
                this.to1.Text   = dr["from1"].ToString();
                if (dr["remark"] != DBNull.Value)
                {
                    this.remark.Text = "<br><br><b>原邮件内容</b>:<br><hr>" + dr["remark"].ToString();
                }
            }
            else if (Request["transfer"] != null)
            {
                this.Title      = "转发邮件"; //转发邮件
                this.title.Text = "转发:" + dr["title"].ToString();
                if (dr["remark"] != DBNull.Value)
                {
                    this.remark.Text = dr["remark"].ToString();
                }

                //设置转发邮件列表(2008年6月1日)
                //编码:金寿吉 时间:2008年6月1日
                /*----设置转发邮件---------*/
                DataTable FileTable = ViewState["FileTable"] as DataTable;
                if (FileTable == null)
                {
                    FileTable = new DataTable();
                    FileTable.Columns.Add("FileName");
                    FileTable.Columns.Add("FileName1");
                    for (int i = 1; i <= 5; i++)
                    {
                        if (dr["file" + i].ToString().Trim() != String.Empty)
                        {
                            DataRow dr1 = FileTable.NewRow();
                            dr1["FileName"]  = dr["file" + i].ToString().Trim();
                            dr1["FileName1"] = dr["file" + i].ToString().Trim().Split('_')[2];
                            FileTable.Rows.Add(dr1);
                        }
                    }
                    ViewState["FileTable"] = FileTable;
                }
                if (FileTable.Rows.Count > 0)
                {
                    this.transRow.Visible         = true;
                    this.tranReapeater.DataSource = FileTable;
                    this.tranReapeater.DataBind();
                }
                /*----设置转发邮件---------*/
            }
            else if (Request["again"] != null)
            {
                this.Title      = "重发邮件"; //重发邮件
                this.title.Text = dr["title"].ToString();
                this.to1.Text   = dr["to1"].ToString();
                if (dr["remark"] != DBNull.Value)
                {
                    this.remark.Text = dr["remark"].ToString();
                }
            }
            else
            {
                ;
            }
        }
    }
Beispiel #6
0
    //del mail
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string     id    = this.GridView1.DataKeys[e.RowIndex].Value.ToString();
        ZX_EmailBu emal1 = new ZX_EmailBu();
        DataSet    ds1   = emal1.GetUserMail(id);
        string     file1 = ds1.Tables[0].Rows[0]["file1"].ToString();

        if (file1 != "" && file1 != null)
        {
            ZX_Email1BU email1 = new ZX_Email1BU();
            bool        Cunzai = email1.IfCzFile(file1, "1");
            if (Cunzai == false)
            {
                File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file1));
            }
            email1.Dispose();
        }
        string file2 = ds1.Tables[0].Rows[0]["file2"].ToString();

        if (file2 != "" && file2 != null)
        {
            ZX_Email1BU email2  = new ZX_Email1BU();
            bool        Cunzai2 = email2.IfCzFile(file2, "2");
            if (Cunzai2 == false)
            {
                File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file2));
            }
            email2.Dispose();
        }
        string file3 = ds1.Tables[0].Rows[0]["file3"].ToString();

        if (file3 != "" && file3 != null)
        {
            ZX_Email1BU email3  = new ZX_Email1BU();
            bool        Cunzai3 = email3.IfCzFile(file3, "3");
            if (Cunzai3 == false)
            {
                File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file3));
            }
            email3.Dispose();
        }
        string file4 = ds1.Tables[0].Rows[0]["file4"].ToString();

        if (file4 != "" && file4 != null)
        {
            ZX_Email1BU email4  = new ZX_Email1BU();
            bool        Cunzai4 = email4.IfCzFile(file4, "4");
            if (Cunzai4 == false)
            {
                File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file4));
            }
            email4.Dispose();
        }
        string file5 = ds1.Tables[0].Rows[0]["file5"].ToString();

        if (file5 != "" && file5 != null)
        {
            ZX_Email1BU email5  = new ZX_Email1BU();
            bool        Cunzai5 = email5.IfCzFile(file5, "5");
            if (Cunzai5 == false)
            {
                File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file5));
            }
            email5.Dispose();
        }
        emal1.DelMail(id);
        this.BindData();
        emal1.Close();
    }
Beispiel #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         if (Request["kind"] != null && Request["kind"] == "1")
         {
             ZX_EmailBu Email = new ZX_EmailBu();
             DataSet    ds1   = Email.GetUserMail1(Request["id"].ToString());
             for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
             {
                 string file1 = ds1.Tables[0].Rows[i]["file1"].ToString();
                 if (file1 != "" && file1 != null)
                 {
                     ZX_Email1BU email1 = new ZX_Email1BU();
                     bool        Cunzai = email1.IfCzFile(file1, "1");
                     if (Cunzai == false)
                     {
                         File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file1));
                     }
                     email1.Dispose();
                 }
                 string file2 = ds1.Tables[0].Rows[i]["file2"].ToString();
                 if (file2 != "" && file2 != null)
                 {
                     ZX_Email1BU email2  = new ZX_Email1BU();
                     bool        Cunzai2 = email2.IfCzFile(file2, "2");
                     if (Cunzai2 == false)
                     {
                         File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file2));
                     }
                     email2.Dispose();
                 }
                 string file3 = ds1.Tables[0].Rows[i]["file3"].ToString();
                 if (file3 != "" && file3 != null)
                 {
                     ZX_Email1BU email3  = new ZX_Email1BU();
                     bool        Cunzai3 = email3.IfCzFile(file3, "3");
                     if (Cunzai3 == false)
                     {
                         File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file3));
                     }
                     email3.Dispose();
                 }
                 string file4 = ds1.Tables[0].Rows[i]["file4"].ToString();
                 if (file4 != "" && file4 != null)
                 {
                     ZX_Email1BU email4  = new ZX_Email1BU();
                     bool        Cunzai4 = email4.IfCzFile(file4, "4");
                     if (Cunzai4 == false)
                     {
                         File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file4));
                     }
                     email4.Dispose();
                 }
                 string file5 = ds1.Tables[0].Rows[i]["file5"].ToString();
                 if (file5 != "" && file5 != null)
                 {
                     ZX_Email1BU email5  = new ZX_Email1BU();
                     bool        Cunzai5 = email5.IfCzFile(file5, "5");
                     if (Cunzai5 == false)
                     {
                         File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file5));
                     }
                     email5.Dispose();
                 }
                 string id = ds1.Tables[0].Rows[i]["id"].ToString();
                 Email.DelMail(id);
                 Email.Close();
             }
             Response.Redirect("ReceiveMail.aspx", false);
         }
         else if (Request["kind"] != null && Request["kind"] == "2")
         {
             ZX_Email1BU emal1 = new ZX_Email1BU();
             DataSet     ds1   = emal1.GetSendMail1(Request["id"].ToString());
             for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
             {
                 string file1 = ds1.Tables[0].Rows[0]["file1"].ToString();
                 if (file1 != "" && file1 != null)
                 {
                     ZX_EmailBu email1 = new ZX_EmailBu();
                     bool       Cunzai = email1.IfCzFile(file1, "1");
                     if (Cunzai == false)
                     {
                         File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file1));
                     }
                     email1.Dispose();
                 }
                 string file2 = ds1.Tables[0].Rows[0]["file2"].ToString();
                 if (file2 != "" && file2 != null)
                 {
                     ZX_EmailBu email2  = new ZX_EmailBu();
                     bool       Cunzai2 = email2.IfCzFile(file2, "2");
                     if (Cunzai2 == false)
                     {
                         File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file2));
                     }
                     email2.Dispose();
                 }
                 string file3 = ds1.Tables[0].Rows[0]["file3"].ToString();
                 if (file3 != "" && file3 != null)
                 {
                     ZX_EmailBu email3  = new ZX_EmailBu();
                     bool       Cunzai3 = email3.IfCzFile(file3, "3");
                     if (Cunzai3 == false)
                     {
                         File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file3));
                     }
                     email3.Dispose();
                 }
                 string file4 = ds1.Tables[0].Rows[0]["file4"].ToString();
                 if (file4 != "" && file4 != null)
                 {
                     ZX_EmailBu email4  = new ZX_EmailBu();
                     bool       Cunzai4 = email4.IfCzFile(file4, "4");
                     if (Cunzai4 == false)
                     {
                         File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file4));
                     }
                     email4.Dispose();
                 }
                 string file5 = ds1.Tables[0].Rows[0]["file5"].ToString();
                 if (file5 != "" && file5 != null)
                 {
                     ZX_EmailBu email5  = new ZX_EmailBu();
                     bool       Cunzai5 = email5.IfCzFile(file5, "5");
                     if (Cunzai5 == false)
                     {
                         File.Delete(Server.MapPath(Application["root"] + "/Common/MailFiles/" + file5));
                     }
                     email5.Dispose();
                 }
                 string id = ds1.Tables[0].Rows[i]["id"].ToString();
                 emal1.DelMail(id);
                 emal1.Close();
             }
             Response.Redirect("SendMail.aspx", false);
         }
     }
 }