Example #1
0
    private void DataPlay()
    {
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        if (this.Request.QueryString["id"] != null)
        {
            this.txtid.Value = this.Request.QueryString["id"].ToString();
        }
        HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();
        DataTable dt = Hyoa_mail.Getmail(this.txtid.Value);
        if (dt.Rows.Count > 0)
        {
            this.txtdocid.Value = dt.Rows[0]["DOCID"].ToString();
            this.txtid.Value = dt.Rows[0]["ID"].ToString();

            this.lblhy_fsrid.Text = dt.Rows[0]["hy_fsrid"].ToString();
            this.txtfsrid.Text = dt.Rows[0]["hy_fsrid"].ToString();
            this.lblhy_fsrname.Text = dt.Rows[0]["hy_fsrname"].ToString();
            this.txtfrsname.Text = dt.Rows[0]["hy_fsrname"].ToString();
            this.lblhy_datetime.Text = dt.Rows[0]["hy_datetime"].ToString();
            this.txthy_jsrid.Text = dt.Rows[0]["hy_jsrid"].ToString();
            this.lblhy_title.Text = dt.Rows[0]["hy_title"].ToString();

            //附件
            HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt();
            DataTable dt_fileatt = Hyoa_fileatt.GetfileattByFatherid(this.txtdocid.Value);
            if (dt_fileatt.Rows.Count > 0)
            {
                string ls_temp = "";
                for (var i = 0; i < dt_fileatt.Rows.Count; i++)
                {
                    ls_temp += (i + 1).ToString() + "、<a href='/" + dt_fileatt.Rows[i]["hy_filepath"].ToString() + "' target='_blank'>" + dt_fileatt.Rows[i]["hy_filename"].ToString() + "</a><br />";
                }
                this.lblhy_field2.Text = ls_temp;
            }

            this.lblhy_content1.Text = dt.Rows[0]["hy_body"].ToString();
        }

        //20120210 start
        string sccksj = System.DateTime.Now.ToString();
        string sql = "";
        if (dt.Rows[0]["hy_type"].ToString() == "收件" & dt.Rows[0]["hy_sccksj"].ToString() == "")
        {
            sql = "update hyt_mail set hy_sccksj = '" + sccksj + "' where ID='" + this.txtid.Value + "' ";
            Hyoa_global.ExcuteSQL(sql);

        }
        //20120210 end
    }
 protected void btnmoveinfo_Click(object sender, EventArgs e)
 {
     HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();
     String[] v_uids = this.txtuids.Value.Split(',');
     for (var i = 0; i < v_uids.Length; i++)
     {
         if (v_uids[i] != "")
         {
             Hyoa_mail.Movemail(v_uids[i], this.ddlwjj.SelectedValue);
         }
     }
     this.txtuids.Value = "";
     //DataPlay(1);
     DataPlay(System.Int32.Parse(this.curpage.Text));
 }
Example #3
0
 protected void btndelinfo_Click(object sender, EventArgs e)
 {
     HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
     if (txtmid.Text == "dbsy" || txtmid.Text == "dysy" || txtmid.Text == "ybsy" || txtmid.Text == "yysy")
     {
         HyoaClass.Hyoa_dbsy Hyoa_dbsy = new HyoaClass.Hyoa_dbsy();
         Hyoa_dbsy.ID = this.txtuids.Value;
         Hyoa_dbsy.Delete();
     }
     if (this.Request.QueryString["mid"] == "mail")
     {
         HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();
         Hyoa_mail.ID = this.txtuids.Value;
         Hyoa_mail.Delete();
     }
     if (this.Request.QueryString["mid"] == "Mudelrcap")
     {
         string sql = "delete from hyc_Tablercap where DOCID='" + this.txtuids.Value + "'";
         Hyoa_global.ExcuteSQL(sql);
         //删除文档时将待办事宜删除start
         HyoaClass.Hyoa_dbsy Hyoa_dbsy = new HyoaClass.Hyoa_dbsy();
         Hyoa_dbsy.DOCID = this.txtuids.Value;
         Hyoa_dbsy.Deletebydocid(this.txtuids.Value);
         //删除文档时将待办事宜删除end
     }
     if (this.Request.QueryString["mid"] == "Mudelgrtxl" || this.Request.QueryString["mid"] == "Mudelgrtxllb" || this.Request.QueryString["mid"] == "Mudeltzgg" || this.Request.QueryString["mid"] == "Mudelgzrz" || this.Request.QueryString["mid"] == "Mudelqjsq")
     {
         string sql = "delete from hyc_" + this.Request.QueryString["tableid"] + " where DOCID='" + this.txtuids.Value + "'";
         Hyoa_global.ExcuteSQL(sql);
     }
     if (this.Request.QueryString["mid"] == "gwk")
     {
         string sql = "delete from hyp_gwk where ID='" + this.txtuids.Value + "'";
         Hyoa_global.ExcuteSQL(sql);
     }
     this.txtuids.Value = "";
     DataPlay(System.Int32.Parse(this.curpage.Text));
 }
    public void display()
    {
        //需要首先设置这些信息
        HyoaClass.Hyoa_mail_config Hyoa_mail_config = new HyoaClass.Hyoa_mail_config();
        DataTable dtconfig = Hyoa_mail_config.Getmailconfigbyuserid(this.Session["hyuid"].ToString());
        if (dtconfig.Rows.Count > 0)
        {
            string pop3Server = dtconfig.Rows[0]["hy_pop3url"].ToString();// "pop.163.com";    //邮箱服务器 如:"pop.sina.com.cn";或 "pop.qq.com" 好像sina的比较快
            int pop3Port = System.Int32.Parse(dtconfig.Rows[0]["hy_pop3port"].ToString()); //110;          //端口号码   用"110"好使。最好看一下你的邮箱服务器用的是什么端口号
            bool pop3UseSsl = false;
            string lsmailid = dtconfig.Rows[0]["hy_mailid"].ToString();
            string username = lsmailid.Substring(0, lsmailid.IndexOf("@"));//"ztmfang2008";        //你的邮箱用户名
            string password = Decrypt(dtconfig.Rows[0]["hy_mailpwd"].ToString()); //"20120328";      //你的邮箱密码
            List<string> gotEmailIds = new List<string>();
            List<Mime> result = new List<Mime>();
            using (POP3_Client pop3 = new POP3_Client())
            {
                //与Pop3服务器建立连接
                pop3.Connect(pop3Server, pop3Port, pop3UseSsl);
                //验证身份
                pop3.Authenticate(username, password, false);
                //获取邮件信息列表
                POP3_ClientMessageCollection infos = pop3.Messages;
                foreach (POP3_ClientMessage info in infos)
                {
                    //每封Email会有一个在Pop3服务器范围内唯一的Id,检查这个Id是否存在就可以知道以前有没有接收过这封邮件
                    if (gotEmailIds.Contains(info.UID))
                        continue;
                    //获取这封邮件的内容
                    byte[] bytes = info.MessageToByte();
                    //记录这封邮件的Id
                    gotEmailIds.Add(info.UID);
                    //this.Response.Write("<script>alert('" + info.UID + "');</script>");
                    //解析从Pop3服务器发送过来的邮件信息
                    Mime m = Mime.Parse(bytes);

                    HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
                    HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();
                    HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt();
                    //this.Response.Write("<script>alert('aaa');</script>");
                    string lsid = Hyoa_global.GetRandom();
                    string lsdocid = info.UID.ToString();

                    DataTable dtmail = Hyoa_mail.Getmailbydocid(lsdocid);
                    if (dtmail.Rows.Count > 0)
                    { }
                    else
                    {
                        Hyoa_mail.ID = lsid;
                        Hyoa_mail.DOCID = lsdocid;
                        Hyoa_mail.hy_type = "收件";
                        Hyoa_mail.hy_foldername = "收件箱";
                        Hyoa_mail.hy_fsrid = m.MainEntity.From.ToAddressListString().ToString();
                        Hyoa_mail.hy_fsrname = m.MainEntity.From.ToAddressListString().ToString();
                        Hyoa_mail.hy_jsrid = this.Session["hyuid"].ToString();
                        Hyoa_mail.hy_wbjsrid = m.MainEntity.To.ToAddressListString().ToString();
                        Hyoa_mail.hy_jsrname = this.Session["hyuname"].ToString();
                        Hyoa_mail.hy_title = m.MainEntity.Subject.ToString();
                        Hyoa_mail.hy_body = m.BodyHtml.ToString();
                        Hyoa_mail.hy_datetime = m.MainEntity.Date.ToString();
                        Hyoa_mail.hy_ifsavetofjx = "";
                        Hyoa_mail.hy_yxj = "";
                        Hyoa_mail.hy_yjbg = "";
                        Hyoa_mail.hy_zycd = "";
                        Hyoa_mail.hy_hz = "";

                        Hyoa_mail.Insert();
                        //this.Response.Write("<script>alert('bbb');</script>");

                        //获取附件
                        foreach (MimeEntity entry in m.Attachments)
                        {
                            string lsfileattid = Hyoa_global.GetRandom();
                            string fileName = entry.ContentDisposition_FileName; //获取文件名称
                            string path = Server.MapPath("~\\fileatt\\" + lsfileattid);
                            Directory.CreateDirectory(path);
                            path += "\\" + fileName;
                            if (File.Exists(path))
                            {
                                Random random = new Random();
                                int newfile = random.Next(1, 100000);
                                path = Server.MapPath("~\\fileatt\\" + lsfileattid + "\\" + newfile.ToString());
                                Directory.CreateDirectory(path);
                                path += "\\" + fileName;
                            }
                            byte[] data = entry.Data;
                            FileStream pFileStream = null;
                            pFileStream = new FileStream(path, FileMode.Create);
                            pFileStream.Write(data, 0, data.Length);
                            pFileStream.Close();

                            //向附件表插入记录
                            Hyoa_fileatt.ID = lsfileattid;
                            Hyoa_fileatt.hy_fatherid = lsdocid;
                            Hyoa_fileatt.hy_filename = fileName;
                            Hyoa_fileatt.hy_filepath = path.Substring(path.IndexOf("fileatt\\"));
                            Hyoa_fileatt.hy_filesize = data.Length.ToString();
                            Hyoa_fileatt.hy_userid = this.Session["hyuid"].ToString();
                            Hyoa_fileatt.hy_djsj = m.MainEntity.Date.ToString();
                            Hyoa_fileatt.hy_fatherfield = "";
                            Hyoa_fileatt.Insert();

                            //this.Response.Write("<script>alert('ccc');</script>");
                        }
                    }
                    //Response.Write("<br>From:" + m.MainEntity.From.ToAddressListString());
                    //Response.Write("<br>To:" + m.MainEntity.To.ToAddressListString());
                    //Response.Write("<br>Time:" + m.MainEntity.Date);            //发送时间
                    //Response.Write("<br>Subject:" + m.MainEntity.Subject);      //主题
                    //Response.Write("<br>Plain Body:" + m.BodyText);             //内容
                    //Response.Write("<br>Html Body:" + m.BodyHtml);              //HTML格式内容
                }
                this.Response.Write("<script>alert('邮件接收完成!');window.opener.location.reload();window.close();</script>");
            }
        }
        else
        {
            this.Response.Write("<script>alert('请先配置外网邮件信息!');</script>");
        }
    }
Example #5
0
    //发布投票add by fy 2014-02-23
    protected void Button_Pub_Click(object sender, EventArgs e)
    {
        //发布投票时发送邮件给参与投票人
        HyoaClass.DAO db = new HyoaClass.DAO();
        HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();
        string ls_yqmlists = "";

        if (this.hy_field43.Text == "")
        {
            //从人员库中读取人员
            DataTable dt = Hyoa_user.GetusersOrderbydeptsortandusersort();
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string ls_jsrid = dt.Rows[i]["hy_userid"].ToString();
                    string ls_jsrname = dt.Rows[i]["hy_username"].ToString();
                    string ls_yqm = "";
                    string ls_yqms = GetRandom3();
                    if (ls_jsrid == "admin")
                    {
                        ls_yqm = "000" + ls_yqms;
                    }
                    else
                    {
                        ls_yqm = ls_jsrid.Substring(ls_jsrid.Length - 3) + ls_yqms;  //获得6位数字的随机数
                    }
                    //string ls_dburl = "/wstp.aspx?yqm=" + ls_yqm + "&rnd=" + Hyoa_global.GetRandom();
                    string ls_dburl = "/wstp.aspx?rnd=" + Hyoa_global.GetRandom();
                    string ls_body = this.Session["hyuname"].ToString() + "发起投票,您的投票邀请码为:" + ls_yqm + "。<a href=" + ls_dburl + " target=\"_blank\">请点击进入</a>";
                    String ls_sql = "insert into hyt_mail(ID,DOCID,hy_type,hy_foldername,hy_fsrid,hy_fsrname,hy_jsrid,hy_wbjsrid,hy_jsrname,hy_title,hy_body,hy_datetime,hy_ifsavetofjx,hy_yxj,hy_yjbg,hy_zycd,hy_hz,hy_wbjszh) values ";
                    ls_sql += "('" + Hyoa_global.GetRandom() + "','" + Hyoa_global.GetRandom() + "','收件','收件箱','" + this.hy_djrid.Text + "','" + this.hy_djrname.Text + "','" + ls_jsrid + "','','" + ls_jsrname + "','" + this.hy_field23.Text + "','" + ls_body + "','" + System.DateTime.Now.ToString() + "','','','','','','') ";

                    db.Execute(ls_sql);

                    //将邀请码
                    if (ls_yqmlists == "")
                    {
                        ls_yqmlists = ls_yqm;
                    }
                    else
                    {
                        ls_yqmlists = ls_yqmlists + "+" + ls_yqm;
                    }
                }
            }
        }
        else
        {
            string ls_jsrid = this.hy_field43.Text;
            string ls_jsrname = this.hy_field41.Text;

            string[] lv_jsrid = ls_jsrid.Split('+');
            string[] lv_jsrname = ls_jsrname.Split('+');
            for (var i = 0; i < lv_jsrid.Length; i++)
            {
                if (lv_jsrid[i] != "")
                {
                    string ls_yqm = "";
                    string ls_yqms = GetRandom3();
                    if (lv_jsrid[i] == "admin")
                    {
                        ls_yqm = "000" + ls_yqms;
                    }
                    else
                    {
                        ls_yqm = lv_jsrid[i].Substring(lv_jsrid[i].Length - 3) + ls_yqms;  //获得6位数字的随机数
                    }

                    ////发送待办
                    //string ls_dburl = "wstp.aspx?rnd=" + Hyoa_global.GetRandom();
                    //string ls_body = this.Session["hyuname"].ToString() + "发起投票,请您参与";
                    //Hyoa_global.Senddbsy_global(this.txtdocid.Value, lv_jsrid[i].ToString(), lv_jsrname[i].ToString(),
                    //    this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), ls_dburl, "待办", this.hy_mudelid.Text, "待办箱", "一般", ls_body, "请参与", 0, "", "");
                    //给参与的人发送邮件
                    //string ls_dburl = "/wstp.aspx?yqm=" + ls_yqm + "&rnd=" + Hyoa_global.GetRandom();
                    string ls_dburl = "/wstp.aspx?rnd=" + Hyoa_global.GetRandom();
                    string ls_body = this.Session["hyuname"].ToString() + "发起投票,您的投票邀请码为:" + ls_yqm + "。<a href=" + ls_dburl + " target=\"_blank\">请点击进入</a>";
                    String ls_sql = "insert into hyt_mail(ID,DOCID,hy_type,hy_foldername,hy_fsrid,hy_fsrname,hy_jsrid,hy_wbjsrid,hy_jsrname,hy_title,hy_body,hy_datetime,hy_ifsavetofjx,hy_yxj,hy_yjbg,hy_zycd,hy_hz,hy_wbjszh) values ";
                    ls_sql += "('" + Hyoa_global.GetRandom() + "','" + Hyoa_global.GetRandom() + "','收件','收件箱','" + this.hy_djrid.Text + "','" + this.hy_djrname.Text + "','" + lv_jsrid[i].ToString() + "','','" + lv_jsrname[i].ToString() + "','" + this.hy_field23.Text + "','" + ls_body + "','" + System.DateTime.Now.ToString() + "','','','','','','') ";

                    db.Execute(ls_sql);

                    //将邀请码
                    if (ls_yqmlists == "")
                    {
                        ls_yqmlists = ls_yqm;
                    }
                    else
                    {
                        ls_yqmlists = ls_yqmlists + "+" + ls_yqm;
                    }
                }
            }
        }

        //更新表
        string sql = "update hyp_flowmain set hy_field30='" + ls_yqmlists + "',hy_field100=1 where docid='" + this.txtdocid.Value + "'";
        db.Execute(sql);
        db.Close();
        db.Dispose();

        Response.Write("<script>alert('发布投票成功!');window.location = '/list_tpgl.aspx?mid=moduletpgl&tableid=bb4c4ac0-53b4-4c7f-89a6-4bde425c24fd';</script>");
    }
    private void DataPlay(int PageNo)
    {
        //得到当前页号
        this.curpage.Text = PageNo.ToString();
        HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();

        //DataTable dt;
        //dt = Hyoa_mail.Getmail_sjx(Session["hyuid"].ToString(), "收件", "收件箱");
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        string ls_sql = "select * from hyt_mail where hy_jsrid='" + this.Session["hyuid"].ToString() + "' and hy_type='收件' and hy_foldername='收件箱' and hy_sccksj is not null order by hy_datetime desc ";
        DataTable dt = Hyoa_global.GetDataTable(ls_sql);

        DataTable tempTable = dt.Clone();
        for (int i = (PageNo - 1) * System.Int32.Parse(PageSize.Text); i < PageNo * System.Int32.Parse(PageSize.Text); i++)
        {
            if (i > dt.Rows.Count - 1)
                break;

            DataRow dr = tempTable.NewRow();
            for (int j = 0; j < dt.Columns.Count; j++)
            {
                dr[dt.Columns[j].ColumnName] = dt.Rows[i][j];
            }
            tempTable.Rows.Add(dr);
        }

        int TotalRecord = dt.Rows.Count;
        this.sumts.Text = TotalRecord.ToString();
        this.sumts2.Text = TotalRecord.ToString();
        this.ShowTotalRecord.Text = TotalRecord.ToString();
        //计算及显示总页数
        int TotalPage;
        if (TotalRecord < System.Int32.Parse(PageSize.Text))
        {
            TotalPage = 1;
        }
        else
        {
            if (TotalRecord % System.Int32.Parse(PageSize.Text) != 0)
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text) + 1;

            }
            else
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text);

            }
        }
        this.ShowTotalPage.Text = TotalPage.ToString();
        this.rptlist.DataSource = tempTable;
        this.rptlist.DataBind();
        dt.Clear();
    }
Example #7
0
    //发布
    protected void btnpubinfo_Click(object sender, EventArgs e)
    {
        //判断选中的投票项目是否一致
        HyoaClass.Hyoa_flowmain Hyoa_flowmain = new HyoaClass.Hyoa_flowmain();
        HyoaClass.DAO db = new HyoaClass.DAO();
        string ls_tplb = "", ls_cyr = "";
        String[] v_uids = this.txtuids.Value.Split(',');

        //通过ID得到信息
        DataTable dt = Hyoa_flowmain.Getflowmain(v_uids[0]);
        if (dt.Rows.Count > 0)
        {
            ls_tplb = dt.Rows[0]["hy_field20"].ToString();
            ls_cyr = dt.Rows[0]["hy_field41"].ToString();
            if (ls_cyr != "" && ls_cyr.IndexOf('+') < 0)
            {
                Response.Write("<script>alert('多个可投票人员需要用加号分割,发布投票失败!');window.location = '/list_tpgl.aspx?mid=moduletpgl&tableid=bb4c4ac0-53b4-4c7f-89a6-4bde425c24fd';</script>");
                return;
            }
        }

        //判断该投票类别是否已经发布过
        string ls_sql22 = "select * from hyp_flowmain where hy_field20='" + ls_tplb + "' and hy_field100=1 ";
        DataTable dtlb = db.GetDataTable(ls_sql22);
        if (dtlb.Rows.Count > 0)
        {
            Response.Write("<script>alert('该投票类别已发布,发布投票失败!');window.location = '/list_tpgl.aspx?mid=moduletpgl&tableid=bb4c4ac0-53b4-4c7f-89a6-4bde425c24fd';</script>");
            return;
        }
        //for (var i = 0; i < v_uids.Length; i++)
        //{
        //    //通过ID得到信息
        //    DataTable dt1 = Hyoa_flowmain.Getflowmain(v_uids[i]);
        //    if (dt1.Rows.Count > 0)
        //    {
        //        if (ls_tpxm != dt1.Rows[0]["hy_field10"].ToString())
        //        {
        //            Response.Write("<script>alert('选择的投票项目不一致,发布投票失败!');window.location = '/list_tpgl.aspx?mid=moduletpgl&tableid=bb4c4ac0-53b4-4c7f-89a6-4bde425c24fd';</script>");
        //            return;
        //        }
        //        if (dt.Rows[0]["hy_field100"].ToString() == "1")
        //        {
        //            Response.Write("<script>alert('选择的投票项目已发布,发布投票失败!');window.location = '/list_tpgl.aspx?mid=moduletpgl&tableid=bb4c4ac0-53b4-4c7f-89a6-4bde425c24fd';</script>");
        //            return;
        //        }
        //    }
        //}
        //Response.Write("<script>alert('" + ls_tpxm + "');</script>");
        //return;
        //发布投票时发送邮件给参与投票人

        HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();

        string ls_yqmlists = "";

        if (ls_cyr == "")
        {
            //从人员库中读取人员
            string sql2 = "select * from hyt_user order by hy_sort";
            DataTable dt2 = db.GetDataTable(sql2);
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt2.Rows.Count; i++)
                {
                    string ls_jsrid = dt2.Rows[i]["hy_userid"].ToString();
                    string ls_jsrname = dt2.Rows[i]["hy_username"].ToString();
                    string ls_yqm = "";
                    string ls_yqms = GetRandom3();
                    if (ls_jsrid == "admin")
                    {
                        ls_yqm = "000" + ls_yqms;
                    }
                    else
                    {
                        ls_yqm = ls_jsrid.Substring(ls_jsrid.Length - 3) + ls_yqms;  //获得6位数字的随机数
                    }
                    //string ls_dburl = "/wstp.aspx?yqm=" + ls_yqm + "&rnd=" + Hyoa_global.GetRandom();
                    string ls_dburl = "/wstp.aspx?rnd=" + Hyoa_global.GetRandom();
                    string ls_title = "[投票管理]-请参与" + ls_tplb + "的投票";
                    string ls_body = "您投票的邀请码为:" + ls_yqm + "。<a href=" + ls_dburl + " target=\"_blank\">请点击进入投票页面!</a>";
                    String ls_sql = "insert into hyt_mail(ID,DOCID,hy_type,hy_foldername,hy_fsrid,hy_fsrname,hy_jsrid,hy_wbjsrid,hy_jsrname,hy_title,hy_body,hy_datetime,hy_ifsavetofjx,hy_yxj,hy_yjbg,hy_zycd,hy_hz,hy_wbjszh) values ";
                    ls_sql += "('" + Hyoa_global.GetRandom() + "','" + Hyoa_global.GetRandom() + "','收件','收件箱','admin','管理员','" + ls_jsrid + "','','" + ls_jsrname + "','" + ls_title + "','" + ls_body + "','" + System.DateTime.Now.ToString() + "','','','','','','') ";

                    db.Execute(ls_sql);

                    //将邀请码
                    if (ls_yqmlists == "")
                    {
                        ls_yqmlists = ls_yqm;
                    }
                    else
                    {
                        ls_yqmlists = ls_yqmlists + "+" + ls_yqm;
                    }
                }
            }
        }
        else
        {

            string ls_jsrname = ls_cyr;
            string[] lv_jsrname = ls_jsrname.Split('+');
            for (var i = 0; i < lv_jsrname.Length; i++)
            {
                if (lv_jsrname[i] != "")
                {
                    string ls_jsrid = "";
                    string sqluser = "select * from hyt_user where hy_username='" + lv_jsrname[i] + "'";
                    DataTable dtuser = db.GetDataTable(sqluser);
                    if (dtuser.Rows.Count > 0)
                    {
                        ls_jsrid = dtuser.Rows[0]["hy_userid"].ToString();
                    }

                    string ls_yqm = "";
                    string ls_yqms = GetRandom3();
                    if (lv_jsrname[i] == "管理员")
                    {
                        ls_yqm = "000" + ls_yqms;
                    }
                    else
                    {
                        //Response.Write("<script>alert('" + ls_jsrid + "')</script>");
                        //return;
                        if (ls_jsrid != "" && ls_jsrid.Length - 3 > 0)
                        {
                            ls_yqm = ls_jsrid.Substring(ls_jsrid.Length - 3) + ls_yqms;  //获得6位数字的随机数
                        }
                    }

                    ////发送待办
                    //string ls_dburl = "wstp.aspx?rnd=" + Hyoa_global.GetRandom();
                    //string ls_body = this.Session["hyuname"].ToString() + "发起投票,请您参与";
                    //Hyoa_global.Senddbsy_global(this.txtdocid.Value, lv_jsrid[i].ToString(), lv_jsrname[i].ToString(),
                    //    this.Session["hyuid"].ToString(), this.Session["hyuname"].ToString(), ls_dburl, "待办", this.hy_mudelid.Text, "待办箱", "一般", ls_body, "请参与", 0, "", "");
                    //给参与的人发送邮件
                    //string ls_dburl = "/wstp.aspx?yqm=" + ls_yqm + "&rnd=" + Hyoa_global.GetRandom();
                    string ls_dburl = "/wstp.aspx?rnd=" + Hyoa_global.GetRandom();
                    string ls_title = "[投票管理]-请参与" + ls_tplb + "的投票";
                    string ls_body = "您投票的邀请码为:" + ls_yqm + "。<a href=" + ls_dburl + " target=\"_blank\">请点击进入投票页面!</a>";
                    String ls_sql = "insert into hyt_mail(ID,DOCID,hy_type,hy_foldername,hy_fsrid,hy_fsrname,hy_jsrid,hy_wbjsrid,hy_jsrname,hy_title,hy_body,hy_datetime,hy_ifsavetofjx,hy_yxj,hy_yjbg,hy_zycd,hy_hz,hy_wbjszh) values ";
                    ls_sql += "('" + Hyoa_global.GetRandom() + "','" + Hyoa_global.GetRandom() + "','收件','收件箱','admin','管理员','" + ls_jsrid + "','','" + lv_jsrname[i].ToString() + "','" + ls_title + "','" + ls_body + "','" + System.DateTime.Now.ToString() + "','','','','','','') ";

                    db.Execute(ls_sql);

                    //将邀请码
                    if (ls_yqmlists == "")
                    {
                        ls_yqmlists = ls_yqm;
                    }
                    else
                    {
                        ls_yqmlists = ls_yqmlists + "+" + ls_yqm;
                    }
                }
            }
        }

        //更新表
        string sql = "update hyp_flowmain set hy_field30='" + ls_yqmlists + "',hy_field100=1 where hy_field20='" + ls_tplb + "'";
        db.Execute(sql);
        db.Close();
        db.Dispose();

        this.txtuids.Value = "";
        //DataPlay(System.Int32.Parse(this.curpage.Text));
        Response.Write("<script>alert('发布投票成功!');window.location = '/list_tpgl.aspx?mid=moduletpgl&tableid=bb4c4ac0-53b4-4c7f-89a6-4bde425c24fd';</script>");
    }
Example #8
0
    private void DataPlay(int PageNo)
    {
        //得到当前页号
        this.curpage.Text = PageNo.ToString();
        HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();

        DataTable dt;
        dt = Hyoa_mail.Getmail_ljx(Session["hyuid"].ToString(), "收件", "垃圾箱");

        DataTable tempTable = dt.Clone();
        for (int i = (PageNo - 1) * System.Int32.Parse(PageSize.Text); i < PageNo * System.Int32.Parse(PageSize.Text); i++)
        {
            if (i > dt.Rows.Count - 1)
                break;

            DataRow dr = tempTable.NewRow();
            for (int j = 0; j < dt.Columns.Count; j++)
            {
                dr[dt.Columns[j].ColumnName] = dt.Rows[i][j];
            }
            tempTable.Rows.Add(dr);
        }

        int TotalRecord = dt.Rows.Count;
        this.sumts.Text = TotalRecord.ToString();
        this.sumts2.Text = TotalRecord.ToString();
        this.ShowTotalRecord.Text = TotalRecord.ToString();
        //计算及显示总页数
        int TotalPage;
        if (TotalRecord < System.Int32.Parse(PageSize.Text))
        {
            TotalPage = 1;
        }
        else
        {
            if (TotalRecord % System.Int32.Parse(PageSize.Text) != 0)
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text) + 1;

            }
            else
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text);

            }
        }
        this.ShowTotalPage.Text = TotalPage.ToString();
        this.rptlist.DataSource = tempTable;
        this.rptlist.DataBind();
        dt.Clear();
    }
Example #9
0
 protected void btnsendinfo_Click(object sender, EventArgs e)
 {
     HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();
     HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
     String[] v_uids = this.txtuids.Value.Split(',');
     for (var i = 0; i < v_uids.Length; i++)
     {
         if (v_uids[i] != "")
         {
             DataTable dt = Hyoa_mail.Getmail(v_uids[i]);
             if (dt.Rows.Count > 0)
             {
                 //考虑多人情况
                 String[] v_jsrids = dt.Rows[0]["hy_jsrid"].ToString().Split('+');
                 String[] v_jsrnames = dt.Rows[0]["hy_jsrname"].ToString().Split('+');
                 for (var j = 0; j < v_jsrids.Length; j++)
                 {
                     if (v_jsrids[j] != "")
                     {
                         //发送
                         Hyoa_mail.ID = Hyoa_global.GetRandom();
                         Hyoa_mail.DOCID = dt.Rows[0]["ID"].ToString();
                         Hyoa_mail.hy_type = "收件";
                         Hyoa_mail.hy_foldername = "收件箱";
                         Hyoa_mail.hy_fsrid = Session["hyuid"].ToString();
                         Hyoa_mail.hy_fsrname = Session["hyuname"].ToString();
                         Hyoa_mail.hy_jsrid = v_jsrids[j];
                         Hyoa_mail.hy_wbjsrid = "";
                         Hyoa_mail.hy_jsrname = v_jsrnames[j];
                         Hyoa_mail.hy_title = dt.Rows[0]["hy_title"].ToString();
                         Hyoa_mail.hy_body = dt.Rows[0]["hy_body"].ToString();
                         Hyoa_mail.hy_datetime = System.DateTime.Now.ToString();
                         Hyoa_mail.hy_ifsavetofjx = "";
                         Hyoa_mail.hy_yxj = "";
                         Hyoa_mail.hy_yjbg = "";
                         Hyoa_mail.hy_zycd = "";
                         Hyoa_mail.hy_hz = "";
                         Hyoa_mail.Insert();
                     }
                     if (dt.Rows[0]["hy_wbjsrid"].ToString() != "")
                     {
                         sendmail(dt.Rows[0]["hy_wbjsrid"].ToString(), dt.Rows[0]["hy_title"].ToString(), dt.Rows[0]["hy_body"].ToString(), dt.Rows[0]["ID"].ToString());
                     }
                 }
             }
         }
     }
     this.txtuids.Value = "";
     //DataPlay(1);
     Response.Write("<script>alert('发送成功!');</script>");
     DataPlay(System.Int32.Parse(this.curpage.Text));
 }
Example #10
0
    private void DataPlay(int PageNo)
    {
        //加载外部收件账号
        string lswbjszh = "--按账号查看--";
        if (this.Request.QueryString["wbjszh"] != null)
        {
            lswbjszh = this.Request.QueryString["wbjszh"].ToString();
        }
        HyoaClass.Hyoa_mail_config Hyoa_mail_config = new HyoaClass.Hyoa_mail_config();
        DataTable dtmailconfig = Hyoa_mail_config.Getmailconfigbyuserid(this.Session["hyuid"].ToString());
        if (dtmailconfig.Rows.Count > 0)
        {
            this.ddlwbjszh.DataSource = dtmailconfig;
            this.ddlwbjszh.DataTextField = "hy_mailid";
            this.ddlwbjszh.DataValueField = "hy_mailid";
            this.ddlwbjszh.DataBind();
            this.ddlwbjszh.Items.Insert(0, new ListItem("本系统邮件", "本系统邮件"));
            this.ddlwbjszh.Items.Insert(0, new ListItem("--按账号查看--", "--按账号查看--"));

            this.ddlwbjszh.SelectedValue = lswbjszh;
        }

        //得到当前页号
        this.curpage.Text = PageNo.ToString();
        HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();

        DataTable dt;
        if (lswbjszh == "--按账号查看--")
            lswbjszh = "";
        if (lswbjszh == "本系统邮件")
            lswbjszh = "本系统邮件";
        dt = Hyoa_mail.Getmail_sjx(Session["hyuid"].ToString(), "收件", "收件箱", lswbjszh);

        DataTable tempTable = dt.Clone();
        DataColumn col = new DataColumn("wdyj", typeof(String)); //定义新的一列  add
        tempTable.Columns.Add(col);  //追加一列  add
        for (int i = (PageNo - 1) * System.Int32.Parse(PageSize.Text); i < PageNo * System.Int32.Parse(PageSize.Text); i++)
        {
            if (i > dt.Rows.Count - 1)
                break;

            DataRow dr = tempTable.NewRow();
            for (int j = 0; j < dt.Columns.Count; j++)
            {
                dr[dt.Columns[j].ColumnName] = dt.Rows[i][j];
            }
            //得到是否未读
            string ls_wdyj = "<font color=red>未读</font>";   //add
            if(dt.Rows[i]["hy_sccksj"].ToString()!="")
                ls_wdyj = "已读";
            dr["wdyj"] = ls_wdyj;  //将新值赋给相应的列  add
            tempTable.Rows.Add(dr);
        }

        int TotalRecord = dt.Rows.Count;
        this.sumts.Text = TotalRecord.ToString();
        this.sumts2.Text = TotalRecord.ToString();
        this.ShowTotalRecord.Text = TotalRecord.ToString();
        //计算及显示总页数
        int TotalPage;
        if (TotalRecord < System.Int32.Parse(PageSize.Text))
        {
            TotalPage = 1;
        }
        else
        {
            if (TotalRecord % System.Int32.Parse(PageSize.Text) != 0)
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text) + 1;

            }
            else
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text);

            }
        }
        this.ShowTotalPage.Text = TotalPage.ToString();
        this.rptlist.DataSource = tempTable;
        this.rptlist.DataBind();
        dt.Clear();
    }
Example #11
0
    private void DataPlay()
    {
        HyoaClass.Hyoa_mail_config Hyoa_mail_config = new HyoaClass.Hyoa_mail_config ();
        DataTable dtmailcon = Hyoa_mail_config.Getmailconfigbyuserid(Session["hyuid"].ToString());
        for(int ii=0;ii<dtmailcon.Rows.Count;ii++)
        {
             this.ddlmailset.Items.Insert(ii,dtmailcon.Rows[ii]["hy_mailid"].ToString());
        }

        //新文档
        if (this.txtop.Value == "add")
        {
            HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
            this.txtdocid.Value = Hyoa_global.GetRandom();
            this.lblhy_fsrid.Text = Session["hyuid"].ToString();
            this.lblhy_fsrname.Text = Session["hyuname"].ToString();
            this.lblhy_datetime.Text = System.DateTime.Now.ToString();
            //如果是回复
            if (this.Request.QueryString["fhid"] != null)
            {
                HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();
                DataTable dt = Hyoa_mail.Getmail(this.Request.QueryString["fhid"].ToString());
                if (dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["hy_wbjsrid"].ToString() != "")
                    {
                        //this.txthy_jsrid.Text = dt.Rows[0]["hy_fsrid"].ToString();
                        this.txthy_wbjsrid.Text = dt.Rows[0]["hy_fsrid"].ToString();
                        //this.txthy_jsrid.Text = dt.Rows[0]["txthy_wbjsrid"].ToString();
                        //this.txthy_jsrname.Value = dt.Rows[0]["hy_fsrname"].ToString();
                        this.txthy_title.Text = "回复:" + dt.Rows[0]["hy_title"].ToString();
                    }
                    else
                    {
                        this.txthy_jsrid.Text = dt.Rows[0]["hy_fsrid"].ToString();
                        //this.txthy_wbjsrid.Text = dt.Rows[0]["hy_fsrid"].ToString();
                        this.txthy_jsrname.Value = dt.Rows[0]["hy_fsrname"].ToString();
                        this.txthy_title.Text = "回复:" + dt.Rows[0]["hy_title"].ToString();
                    }
                }
            }
             //如果是从在线人员中过来的
            if (this.Request.QueryString["recuserid"] != null)
            {
                HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();
                DataTable dtuser = Hyoa_user.Getuserallinfo(this.Request.QueryString["recuserid"].ToString());
                if (dtuser.Rows.Count > 0)
                {
                    this.txthy_jsrid.Text = this.Request.QueryString["recuserid"].ToString();
                    this.txthy_jsrname.Value = dtuser.Rows[0]["hy_username"].ToString();
                }
            }
            //如果是转发
            if (this.Request.QueryString["zfid"] != null)
            {
                HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();
                DataTable dt = Hyoa_mail.Getmail(this.Request.QueryString["zfid"].ToString());
                if (dt.Rows.Count > 0)
                {
                    this.txthy_title.Text = "转发:" + dt.Rows[0]["hy_title"].ToString();
                    this.hy_content1.Value = dt.Rows[0]["hy_body"].ToString();
                    this.txtdocid.Value = dt.Rows[0]["docid"].ToString();

                    //附件
                    HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt();
                    DataTable dt_fileatt = Hyoa_fileatt.GetfileattByFatherid(dt.Rows[0]["DOCID"].ToString());
                    if (dt_fileatt.Rows.Count > 0)
                    {
                        string ls_temp = "";
                        for (var i = 0; i < dt_fileatt.Rows.Count; i++)
                        {
                            ls_temp += (i + 1).ToString() + "、<a href='/" + dt_fileatt.Rows[i]["hy_filepath"].ToString() + "' target='_blank'>" + dt_fileatt.Rows[i]["hy_filename"].ToString() + "</a><br />";
                        }
                        this.lblhy_field2.Text = ls_temp;

                    }
                }
                this.uploadhy_field2.Visible = false;
            }
        }
        else
        {
            if (this.Request.QueryString["id"] != null)
            {
                this.txtid.Value = this.Request.QueryString["id"].ToString();
            }
            HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();
            DataTable dt = Hyoa_mail.Getmail(this.txtid.Value);
            if (dt.Rows.Count > 0)
            {
                this.txtdocid.Value = dt.Rows[0]["DOCID"].ToString();
                this.txtid.Value = dt.Rows[0]["ID"].ToString();

                this.lblhy_fsrid.Text = dt.Rows[0]["hy_fsrid"].ToString();
                this.lblhy_fsrname.Text = dt.Rows[0]["hy_fsrname"].ToString();
                this.lblhy_datetime.Text = dt.Rows[0]["hy_datetime"].ToString();
                this.txthy_jsrname.Value = dt.Rows[0]["hy_jsrname"].ToString();
                this.txthy_jsrid.Text = dt.Rows[0]["hy_jsrid"].ToString();
                this.txthy_wbjsrid.Text = dt.Rows[0]["hy_wbjsrid"].ToString();
                this.txthy_title.Text = dt.Rows[0]["hy_title"].ToString();

                //附件
                HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt();
                DataTable dt_fileatt = Hyoa_fileatt.GetfileattByFatherid(this.txtdocid.Value);
                if (dt_fileatt.Rows.Count > 0)
                {
                    string ls_temp = "";
                    for (var i = 0; i < dt_fileatt.Rows.Count; i++)
                    {
                        ls_temp += (i + 1).ToString() + "、<a href='/" + dt_fileatt.Rows[i]["hy_filepath"].ToString() + "' target='_blank'>" + dt_fileatt.Rows[i]["hy_filename"].ToString() + "</a><br />";
                    }
                    this.lblhy_field2.Text = ls_temp;
                }

                this.hy_content1.Value = dt.Rows[0]["hy_body"].ToString();
                this.ddlifsavetofjx.SelectedValue = dt.Rows[0]["hy_ifsavetofjx"].ToString();

            }

            //20120210 start
            if (dt.Rows[0]["hy_type"].ToString() == "发件" & dt.Rows[0]["hy_foldername"].ToString() == "发件箱")
            {

                string text = "<TR height='30'><TD width='20%' align='center' class='Tdcellleft'>序号</TD><TD width='40%' align='center' class='Tdcellleft'>姓名</TD><TD width='40%' align='center' class='Tdcellleft'>回执时间</TD></TR>";
                HyoaClass.DAO db = new HyoaClass.DAO();
                string sql = "";
                sql = "select * from hyt_mail where DOCID='" + this.txtdocid.Value + "' and hy_type ='收件' and hy_sccksj <> '' order by hy_sccksj asc";
                DataTable dt2 = db.GetDataTable(sql);
                if (dt2.Rows.Count > 0)
                {
                    for (var i = 0; i < dt2.Rows.Count; i++)
                    {
                        text = text + "<TR height='30'><TD width='20%' align='center' class='Tdcellright'>" + (i+1).ToString() + "</TD>";
                        text = text + "<TD width='40%' align='center' class='Tdcellright'>" + dt2.Rows[i]["hy_jsrname"].ToString() + "</TD>";
                        text = text + "<TD width='40%' align='center' class='Tdcellright'>" + dt2.Rows[i]["hy_sccksj"].ToString() + "</TD></TR>";
                    }
                }
                this.hzlb.Text = text;
            }
            //20120210 end
         }
    }
Example #12
0
    //保存
    protected void Button_Save_Click(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() == "")
            this.Response.Redirect("/login.aspx");

        string ls_tip = "发送成功!";

        HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();

        //发送
        if (this.txtwhichoperation.Value == "1")
        {
            string[] lv_jsrid = this.txthy_jsrid.Text.Split('+');
            string[] lv_jsrname = this.txthy_jsrname.Value.Split('+');
            for (var i = 0; i < lv_jsrid.Length; i++)
            {
                if (lv_jsrid[i] != "")
                {
                    Hyoa_mail.ID = Hyoa_global.GetRandom();
                    Hyoa_mail.DOCID = this.txtdocid.Value;
                    Hyoa_mail.hy_type = "收件";
                    Hyoa_mail.hy_foldername = "收件箱";
                    Hyoa_mail.hy_fsrid = this.lblhy_fsrid.Text;
                    Hyoa_mail.hy_fsrname = this.lblhy_fsrname.Text;
                    Hyoa_mail.hy_jsrid = lv_jsrid[i].ToString();
                    Hyoa_mail.hy_wbjsrid = "";
                    Hyoa_mail.hy_jsrname = lv_jsrname[i].ToString();
                    Hyoa_mail.hy_title = this.txthy_title.Text;
                    Hyoa_mail.hy_body = this.hy_content1.Value;
                    Hyoa_mail.hy_datetime = System.DateTime.Now.ToString();
                    Hyoa_mail.hy_ifsavetofjx = "";
                    Hyoa_mail.hy_yxj = "";
                    Hyoa_mail.hy_yjbg = "";
                    Hyoa_mail.hy_zycd = "";
                    Hyoa_mail.hy_hz = "";
                    Hyoa_mail.hy_wbjszh = "";
                    Hyoa_mail.Insert();
                }
                if (this.txthy_wbjsrid.Text != "")
                {
                    sendmail(this.txthy_wbjsrid.Text, this.txthy_title.Text, this.hy_content1.Value, this.txtdocid.Value);
                }

            }
            //如果要保存到发件箱,则保存一份
            if (this.ddlifsavetofjx.SelectedValue == "是")
            {
                Hyoa_mail.ID = Hyoa_global.GetRandom();
                Hyoa_mail.DOCID = this.txtdocid.Value;
                Hyoa_mail.hy_type = "发件";
                Hyoa_mail.hy_foldername = "发件箱";
                Hyoa_mail.hy_fsrid = this.lblhy_fsrid.Text;
                Hyoa_mail.hy_fsrname = this.lblhy_fsrname.Text;
                Hyoa_mail.hy_jsrid = this.txthy_jsrid.Text;
                Hyoa_mail.hy_wbjsrid = this.txthy_wbjsrid.Text;
                Hyoa_mail.hy_jsrname = this.txthy_jsrname.Value;
                Hyoa_mail.hy_title = this.txthy_title.Text;
                Hyoa_mail.hy_body = this.hy_content1.Value;
                Hyoa_mail.hy_datetime = System.DateTime.Now.ToString();
                Hyoa_mail.hy_ifsavetofjx = this.ddlifsavetofjx.SelectedValue;
                Hyoa_mail.hy_yxj = "";
                Hyoa_mail.hy_yjbg = "";
                Hyoa_mail.hy_zycd = "";
                Hyoa_mail.hy_hz = "";
                Hyoa_mail.hy_wbjszh = "";
                Hyoa_mail.Insert();
            }
        }

        //存草稿
        if (this.txtwhichoperation.Value == "2")
        {
            if (this.txtop.Value == "add")
            {
                string ls_id = this.txtdocid.Value;
                Hyoa_mail.ID = ls_id;
                this.txtid.Value = ls_id;
                Hyoa_mail.DOCID = this.txtdocid.Value;
                Hyoa_mail.hy_type = "发件";
                Hyoa_mail.hy_foldername = "草稿箱";
                Hyoa_mail.hy_fsrid = this.lblhy_fsrid.Text;
                Hyoa_mail.hy_fsrname = this.lblhy_fsrname.Text;
                Hyoa_mail.hy_jsrid = this.txthy_jsrid.Text;
                Hyoa_mail.hy_wbjsrid = this.txthy_wbjsrid.Text;
                Hyoa_mail.hy_jsrname = this.txthy_jsrname.Value;
                Hyoa_mail.hy_title = this.txthy_title.Text;
                Hyoa_mail.hy_body = this.hy_content1.Value;
                Hyoa_mail.hy_datetime = System.DateTime.Now.ToString();
                Hyoa_mail.hy_ifsavetofjx = this.ddlifsavetofjx.SelectedValue;
                Hyoa_mail.hy_yxj = "";
                Hyoa_mail.hy_yjbg = "";
                Hyoa_mail.hy_zycd = "";
                Hyoa_mail.hy_hz = "";
                Hyoa_mail.hy_wbjszh = "";
                Hyoa_mail.Insert();
                ls_tip = "存草稿成功!";
            }
            else
            {
                string ls_id = this.txtid.Value;
                Hyoa_mail.ID = ls_id;
                this.txtid.Value = ls_id;
                Hyoa_mail.DOCID = this.txtdocid.Value;
                Hyoa_mail.hy_type = "发件";
                Hyoa_mail.hy_foldername = "草稿箱";
                Hyoa_mail.hy_fsrid = this.lblhy_fsrid.Text;
                Hyoa_mail.hy_fsrname = this.lblhy_fsrname.Text;
                Hyoa_mail.hy_jsrid = this.txthy_jsrid.Text;
                Hyoa_mail.hy_wbjsrid = this.txthy_wbjsrid.Text;
                Hyoa_mail.hy_jsrname = this.txthy_jsrname.Value;
                Hyoa_mail.hy_title = this.txthy_title.Text;
                Hyoa_mail.hy_body = this.hy_content1.Value;
                Hyoa_mail.hy_datetime = System.DateTime.Now.ToString();
                Hyoa_mail.hy_ifsavetofjx = this.ddlifsavetofjx.SelectedValue;
                Hyoa_mail.hy_yxj = "";
                Hyoa_mail.hy_yjbg = "";
                Hyoa_mail.hy_zycd = "";
                Hyoa_mail.hy_hz = "";
                Hyoa_mail.hy_wbjszh = "";
                Hyoa_mail.Update();
                ls_tip = "存草稿成功!";
            }
        }
        //处理完成后的提示及跳转(增加刷新附件功能)
        if (this.txtifsxfj.Text == "1")
        {
            Response.Write("<script>window.location='main_mail.aspx?op=modify&mid=" + this.txtmudelid.Value + "&id=" + this.txtid.Value + "&url=" + this.txturl.Value + "'</script>");
        }
        else
        {
            Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
        }
    }
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //保存
    protected void Button_Save_Click(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() == "")
            this.Response.Redirect("../login.aspx");

        string ls_tip = "发送成功!";

        HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();

        //发送
        if (this.txtwhichoperation.Value == "1")
        {
            string[] lv_jsrid = this.txthy_jsrid.Value.Split('+');
            string[] lv_jsrname = this.txthy_jsrname.Value.Split('+');
            for (var i = 0; i < lv_jsrid.Length; i++)
            {
                if (lv_jsrid[i] != "")
                {
                    Hyoa_mail.ID = Hyoa_global.GetRandom();
                    if (Request.QueryString["zfid"] == null)
                    {
                        Hyoa_mail.DOCID = this.txtdocid.Value;
                    }
                    else
                    {
                        Hyoa_mail.DOCID = this.txtid.Value;
                    }
                    Hyoa_mail.hy_type = "收件";
                    Hyoa_mail.hy_foldername = "收件箱";
                    Hyoa_mail.hy_fsrid = Session["hyuid"].ToString();
                    Hyoa_mail.hy_fsrname = Session["hyuname"].ToString();
                    Hyoa_mail.hy_jsrid = lv_jsrid[i].ToString();
                    Hyoa_mail.hy_wbjsrid = "";
                    Hyoa_mail.hy_jsrname = lv_jsrname[i].ToString();
                    Hyoa_mail.hy_title = this.hy_title.Text;
                    Hyoa_mail.hy_body = this.hy_body.Text;
                    Hyoa_mail.hy_datetime = System.DateTime.Now.ToString();
                    Hyoa_mail.hy_ifsavetofjx = "";
                    Hyoa_mail.hy_yxj = "";
                    Hyoa_mail.hy_yjbg = "";
                    Hyoa_mail.hy_zycd = "";
                    Hyoa_mail.hy_hz = "";
                    Hyoa_mail.Insert();
                }
            }
            //如果要保存到发件箱,则保存一份
            if (this.ddlifsavetofjx.SelectedValue == "是")
            {
                Hyoa_mail.ID = Hyoa_global.GetRandom();
                Hyoa_mail.DOCID = this.txtdocid.Value;
                Hyoa_mail.hy_type = "发件";
                Hyoa_mail.hy_foldername = "发件箱";
                Hyoa_mail.hy_fsrid = Session["hyuid"].ToString();
                Hyoa_mail.hy_fsrname = Session["hyuname"].ToString();
                Hyoa_mail.hy_jsrid = this.txthy_jsrid.Value;
                Hyoa_mail.hy_wbjsrid = "";
                Hyoa_mail.hy_jsrname = this.txthy_jsrname.Value;
                Hyoa_mail.hy_title = this.hy_title.Text;
                Hyoa_mail.hy_body = this.hy_body.Text;
                Hyoa_mail.hy_datetime = System.DateTime.Now.ToString();
                Hyoa_mail.hy_ifsavetofjx = this.ddlifsavetofjx.SelectedValue;
                Hyoa_mail.hy_yxj = "";
                Hyoa_mail.hy_yjbg = "";
                Hyoa_mail.hy_zycd = "";
                Hyoa_mail.hy_hz = "";
                Hyoa_mail.Insert();
            }
        }

        Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
    }
    //加载主表单    Written by xf 20110515
    private void DataPlay()
    {
        txtsavefields.Text = "";
        txtsavefields_sx.Text = "";

        if (this.Request.QueryString["op"] != null)
        {
            this.txtop.Value = this.Request.QueryString["op"].ToString();           //新增还是修改
            HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();

            //新文档
            if (this.Request.QueryString["op"] == "add")
            {
                hy_fsrname.Text = Session["hyuname"].ToString();
                hy_datetime.Text = System.DateTime.Now.ToString();
                txtdocid.Value = Hyoa_global.GetRandom();
                //如果是回复
                if (this.Request.QueryString["fhid"] != null)
                {
                    HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();
                    DataTable dt = Hyoa_mail.Getmail(this.Request.QueryString["fhid"].ToString());
                    if (dt.Rows.Count > 0)
                    {
                        this.txthy_jsrid.Value = dt.Rows[0]["hy_fsrid"].ToString();
                        //this.txthy_wbjsrid.Text = dt.Rows[0]["hy_fsrid"].ToString();
                        this.txthy_jsrname.Value = dt.Rows[0]["hy_fsrname"].ToString();
                        this.hy_title.Text = "回复:" + dt.Rows[0]["hy_title"].ToString();
                    }
                }
                //如果是转发
                if (this.Request.QueryString["zfid"] != null)
                {
                    HyoaClass.Hyoa_mail Hyoa_mail = new HyoaClass.Hyoa_mail();
                    DataTable dt = Hyoa_mail.Getmail(this.Request.QueryString["zfid"].ToString());
                    if (dt.Rows.Count > 0)
                    {
                        this.hy_title.Text = "转发:" + dt.Rows[0]["hy_title"].ToString();
                        this.hy_body.Text = dt.Rows[0]["hy_body"].ToString();
                        this.txtid.Value = dt.Rows[0]["docid"].ToString();

                        //附件
                        HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt();
                        DataTable dt_fileatt = Hyoa_fileatt.GetfileattByFatherid(dt.Rows[0]["DOCID"].ToString());
                        if (dt_fileatt.Rows.Count > 0)
                        {
                            string ls_temp = "";
                            for (var i = 0; i < dt_fileatt.Rows.Count; i++)
                            {
                                ls_temp += (i + 1).ToString() + "、<a href='/" + dt_fileatt.Rows[i]["hy_filepath"].ToString() + "' target='_blank'>" + dt_fileatt.Rows[i]["hy_filename"].ToString() + "</a><br />";
                            }
                            this.lblfileatt.Text = ls_temp;

                        }
                    }
                    this.uploadfile1.Visible = false;
                }
            }
        }
    }