protected void Page_Load(object sender, EventArgs e)
    {
        string recuserid="";
         if (this.Request.QueryString["recuserid"] != null)
         {
             recuserid = this.Request.QueryString["recuserid"].ToString();  //文档ID
         }
         //显示上面部分start
         HyoaClass.Hyoa_jstx_info Hyoa_jstx_info = new HyoaClass.Hyoa_jstx_info();

         DataTable dt_getinfo = Hyoa_jstx_info.GetDocBySenduserid_Receiveuserid_top6(this.Session["hyuid"].ToString(), recuserid);
         string lsinfo = "";
         string lscontent = "";
         if (dt_getinfo.Rows.Count > 0)
         {
             for (int i = dt_getinfo.Rows.Count - 1; i >= 0; i--)
             {
                 lsinfo += "<br>" + dt_getinfo.Rows[i]["hy_sendinfo_username"].ToString() + "&nbsp;&nbsp;" + dt_getinfo.Rows[i]["hy_sendinfo_date"].ToString();
                 lscontent = dt_getinfo.Rows[i]["hy_content"].ToString();
                 lscontent = lscontent.Replace("|#", "<img src='images_main/qq/");
                 lscontent = lscontent.Replace("gif#", "gif' />");
                 if (dt_getinfo.Rows[i]["hy_fileattpath"].ToString() != "")
                     lscontent = "<a href='/" + dt_getinfo.Rows[i]["hy_fileattpath"].ToString() + "' target='_blank'><font color=red>" + lscontent + "</font></a>";
                 lsinfo += "<br>" + lscontent;
             }

         }
         //this.hy_content_display.Text = lsinfo;
         this.Response.Write(lsinfo);
         //显示上面部分end
         Hyoa_jstx_info.Update_readlist(this.Session["hyuid"].ToString(), recuserid);//置当前用户为已读用户
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //string ls_mudelid = "";
        //string ls_tableid = "";
        string lsdocid = "";

        if (this.Request.QueryString["docid"] != null)
        {
            lsdocid = this.Request.QueryString["docid"].ToString();  //文档ID
        }
        HyoaClass.Hyoa_jstx_info Hyoa_jstx_info = new HyoaClass.Hyoa_jstx_info();
        //更新删除人员字段start
        Hyoa_jstx_info.ID = lsdocid;
        Hyoa_jstx_info.hy_delrylist = Session["hyuid"].ToString();
        Hyoa_jstx_info.Update_delrylist();
        //更新删除人员字段end
        DataTable dt = Hyoa_jstx_info.GetDocByID(lsdocid);
        string ls_sendflag = "1";
        string ls_recflag = "1";
        if (dt.Rows.Count > 0)
        {
            if (dt.Rows[0]["hy_delrylist"].ToString().IndexOf(dt.Rows[0]["hy_sendinfo_userid"].ToString()) >= 0)
                ls_sendflag = "1";
            else
                ls_sendflag = "0";

            string[] lv_recuserid;
            lv_recuserid = dt.Rows[0]["hy_receive_userid"].ToString().Split(',');
            for (int j = 0; j < lv_recuserid.Length; j++)
            {
                if (dt.Rows[0]["hy_delrylist"].ToString().IndexOf(lv_recuserid[j]) < 0)
                {
                    ls_recflag = "0";
                }

            }

            if (ls_sendflag == "1" && ls_recflag == "1")
            {
                Hyoa_jstx_info.ID = lsdocid;
                Hyoa_jstx_info.Delete();
            }
            this.Response.Write("1");
        }
        //return ;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() =="")
            this.Response.Redirect("../login.aspx?url="+this.Request.RawUrl);

        if (this.Request.QueryString["recuserid"] != null)
        {
            recuserid = this.Request.QueryString["recuserid"].ToString();   //得以接收人ID
        }

        if (!IsPostBack)
        {
            //显示上面部分start
            HyoaClass.Hyoa_jstx_info Hyoa_jstx_info = new HyoaClass.Hyoa_jstx_info();
            DataTable dt_getinfo = Hyoa_jstx_info.GetDocBySenduserid_Receiveuserid(this.Session["hyuid"].ToString(),recuserid);
            string lsinfo = "";
            string lscontent = "";
            if (dt_getinfo.Rows.Count > 0)
            {
                for (int i = dt_getinfo.Rows.Count - 1; i >= 0; i--)
                {
                    //if (dt_getinfo.Rows[i]["hy_sendinfo_userid"].ToString() == this.Session["hyuid"].ToString())
                    //{//如果发送人是当前用户则显示为发送人,否则显示为接收人
                    lsinfo += "<br>" + dt_getinfo.Rows[i]["hy_sendinfo_username"].ToString() + "&nbsp;&nbsp;" + dt_getinfo.Rows[i]["hy_sendinfo_date"].ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src=\"images_main/del.gif\" width=\"10\" height=\"10\" border=\"0\" onclick=\"deldoc('" + dt_getinfo.Rows[i]["ID"].ToString() + "');\" />";
                    lscontent = dt_getinfo.Rows[i]["hy_content"].ToString();
                    lscontent = lscontent.Replace("|#", "<img src='images_main/qq/");
                    lscontent = lscontent.Replace("gif#", "gif' />");
                    if (dt_getinfo.Rows[i]["hy_fileattpath"].ToString() != "")
                        lscontent = "<a href='/" + dt_getinfo.Rows[i]["hy_fileattpath"].ToString() + "' target='_blank'><font color=red>" + lscontent + "</font></a>";
                    lsinfo += "<br>" + lscontent;
                    //}
                    //else
                    //{
                    //    lsinfo += "<br>" + dt_getinfo.Rows[i]["hy_sendinfo_username"].ToString() + "&nbsp;&nbsp;" + dt_getinfo.Rows[i]["hy_sendinfo_date"].ToString();
                    //    lsinfo += "<br>" + dt_getinfo.Rows[i]["hy_content"].ToString();
                    //}

                }

            }
            this.hy_content_display.Text = lsinfo;
            //显示上面部分end
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //得到待办事宜数
        HyoaClass.Hyoa_dbsy Hyoa_dbsy = new HyoaClass.Hyoa_dbsy();
        DataTable dt = Hyoa_dbsy.Getdbsys_dbanddy(Session["hyuid"].ToString());
        this.Response.Write(dt.Rows.Count.ToString());

        this.Response.Write("|");

        //得到未读站内消息
        HyoaClass.Hyoa_jstx_info Hyoa_jstx_info = new HyoaClass.Hyoa_jstx_info();
        DataTable dt2 = Hyoa_jstx_info.GetDocByReceiveuserid_wd(Session["hyuid"].ToString());
        this.Response.Write(dt2.Rows.Count.ToString());

        this.Response.Write("|");

        //在线用户(得到人数前先更新一下数据)
        //更新当前用户的在线时间
        HyoaClass.Hyoa_jstx_zxry Hyoa_jstx_zxry = new HyoaClass.Hyoa_jstx_zxry();
        DataTable dt3 = Hyoa_jstx_zxry.GetDocByUserid(this.Session["hyuid"].ToString());
        if (dt3.Rows.Count > 0)
        {
            Hyoa_jstx_zxry.ID = dt3.Rows[0]["ID"].ToString();
            Hyoa_jstx_zxry.hy_userid = dt3.Rows[0]["hy_userid"].ToString();
            Hyoa_jstx_zxry.hy_username = dt3.Rows[0]["hy_username"].ToString();
            Hyoa_jstx_zxry.hy_datetime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            Hyoa_jstx_zxry.Update();
        }
        else
        {
            Hyoa_jstx_zxry.ID = System.Guid.NewGuid().ToString();
            Hyoa_jstx_zxry.hy_userid = this.Session["hyuid"].ToString();
            Hyoa_jstx_zxry.hy_username = this.Session["hyuname"].ToString();
            Hyoa_jstx_zxry.hy_datetime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            Hyoa_jstx_zxry.Insert();
        }
        //删除已经过期的在线用户数据(时间距离当前时间已有15分钟)
        Hyoa_jstx_zxry.Delete_offline(15);
        DataTable dt_zxry = Hyoa_jstx_zxry.GetDocs();
        this.Response.Write(dt_zxry.Rows.Count.ToString());

        //return ;
    }
    //发送
    protected void Button_SendInfo_Click(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() == "")
            this.Response.Redirect("../login.aspx");

        string ls_tip = "发送成功!";
        string ls_content = this.hy_content.Text;
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        HyoaClass.Hyoa_jstx_info Hyoa_jstx_info = new HyoaClass.Hyoa_jstx_info();
        Hyoa_jstx_info.ID = Hyoa_global.GetRandom();
        Hyoa_jstx_info.hy_sendinfo_userid = this.Session["hyuid"].ToString();
        Hyoa_jstx_info.hy_sendinfo_username = this.Session["hyuname"].ToString();
        Hyoa_jstx_info.hy_receive_userid = recuserid;
        Hyoa_jstx_info.hy_receive_username = recusername;
        ls_content = ls_content.Replace("|#", "<img src='images_main/qq/");
        ls_content = ls_content.Replace("gif#", "gif' />");
        Hyoa_jstx_info.hy_content = ls_content;
        Hyoa_jstx_info.hy_sendinfo_date = System.DateTime.Now.ToString();
        Hyoa_jstx_info.hy_fileattpath = "";
        Hyoa_jstx_info.hy_readlists = "";
        Hyoa_jstx_info.hy_delrylist = "";
        Hyoa_jstx_info.Insert();
        this.hy_content.Text = "";

        ///////////////////////////////////////////////////////////////////////////////////////
        //DataTable dt_getinfo = Hyoa_jstx_info.GetDocBySenduserid_Receiveuserid_top6(this.Session["hyuid"].ToString());
        //string lsinfo = "";
        //string lscontent = "";
        //if (dt_getinfo.Rows.Count > 0)
        //{
        //    for (int i = dt_getinfo.Rows.Count - 1; i >= 0; i--)
        //    {
        //        //if (dt_getinfo.Rows[i]["hy_sendinfo_userid"].ToString() == this.Session["hyuid"].ToString())
        //        //{//如果发送人是当前用户则显示为发送人,否则显示为接收人
        //        lsinfo += "<br>" + dt_getinfo.Rows[i]["hy_sendinfo_username"].ToString() + "&nbsp;&nbsp;" + dt_getinfo.Rows[i]["hy_sendinfo_date"].ToString();
        //        lscontent = dt_getinfo.Rows[i]["hy_content"].ToString();
        //        lscontent = lscontent.Replace("|#", "<img src='images_main/qq/");
        //        lscontent = lscontent.Replace("gif#", "gif' />");
        //        if (dt_getinfo.Rows[i]["hy_fileattpath"].ToString() != "")
        //            lscontent = "<a href='/" + dt_getinfo.Rows[i]["hy_fileattpath"].ToString() + "' target='_blank'><font color=red>" + lscontent + "</font></a>";
        //        lsinfo += "<br>" + lscontent;
        //        //}
        //        //else
        //        //{
        //        //    lsinfo += "<br>" + dt_getinfo.Rows[i]["hy_sendinfo_username"].ToString() + "&nbsp;&nbsp;" + dt_getinfo.Rows[i]["hy_sendinfo_date"].ToString();
        //        //    lsinfo += "<br>" + dt_getinfo.Rows[i]["hy_content"].ToString();
        //        //}

        //    }

        //}
        //this.hy_content_display.Text = lsinfo;
        //////////////////////////////////////////////////////////////////////////////////

        Response.Write("<script>window.location='hy_main_jstx.aspx?recuserid=" + this.txtrecuserid.Text + "&rnd='+Math.random();</script>");

        ////处理完成后的提示及跳转
        //if (this.txtifpop.Value == "")
        //{
        //    Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
        //}
        //else
        //{
        //    Response.Write("<script>alert('" + ls_tip + "');self.close();</script>");
        //}
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() =="")
            this.Response.Redirect("../login.aspx?url="+this.Request.RawUrl);

        if (this.Request.QueryString["recuserid"] != null)
        {
            recuserid = this.Request.QueryString["recuserid"].ToString();   //得到接收人ID
            this.txtrecuserid.Text = recuserid;
        }
        //if (this.Request.QueryString["recusername"] != null)
        //{
        //    recusername = this.Request.QueryString["recusername"].ToString();   //得到接收人姓名
        //    this.txtrecusername.Text = recusername;
        //}

        //得到中文名start
        string[] lv_recuserid;
        lv_recuserid = recuserid.Split(',');
        HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user();
        for (int j = 0; j < lv_recuserid.Length; j++)
        {
            DataTable dtuser = Hyoa_user.Getuserbyloginid(lv_recuserid[j]);
            for (int m = 0; m < dtuser.Rows.Count; m++)
            {
                if (recusername == "")
                {
                    recusername = dtuser.Rows[m]["hy_username"].ToString();
                }
                else
                {
                    recusername += "," + dtuser.Rows[m]["hy_username"].ToString();
                }

            }
        }
        this.txtrecusername.Text = recusername;
        //得到中文名end

        if (!IsPostBack)
        {
            this.lbljsrname.Text = recusername;  //显示接收人性名
            //显示上面部分start
            HyoaClass.Hyoa_jstx_info Hyoa_jstx_info = new HyoaClass.Hyoa_jstx_info();
            DataTable dt_getinfo = Hyoa_jstx_info.GetDocBySenduserid_Receiveuserid_top6(this.Session["hyuid"].ToString(),recuserid);
            string lsinfo = "";
            string lscontent = "";
            if (dt_getinfo.Rows.Count > 0)
            {
                for (int i = dt_getinfo.Rows.Count-1; i >=0; i--)
                {
                        lsinfo += "<br>" + dt_getinfo.Rows[i]["hy_sendinfo_username"].ToString() + "&nbsp;&nbsp;" + dt_getinfo.Rows[i]["hy_sendinfo_date"].ToString();
                        lscontent = dt_getinfo.Rows[i]["hy_content"].ToString();
                        //lscontent = lscontent.Replace("|#", "<img src='images_main/qq/");
                        //lscontent = lscontent.Replace("gif#", "gif' />");
                        if (dt_getinfo.Rows[i]["hy_fileattpath"].ToString() != "")
                            lscontent = "<a href='/" + dt_getinfo.Rows[i]["hy_fileattpath"].ToString() + "' target='_blank'><font color=red>" + lscontent + "</font></a>";
                        lsinfo += "<br>" + lscontent;
                }

            }
            this.hy_content_display.Text = lsinfo;
            //显示上面部分end
            Hyoa_jstx_info.Update_readlist(this.Session["hyuid"].ToString(), recuserid);//置当前用户为已读用户
        }
    }
    //保存
    protected void Button_Save_Click(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() == "")
            this.Response.Redirect("../login.aspx");

        string ls_tip = "保存成功!";
        string ls_attsize = "";
        string str_path = "";
        string lspath = "";
        string lsguid = "";
        string lsurl = "";
        string lsfilename = "";
        string lshy_fatherfield = "";

        lsfilename = FileUpload1.FileName;
        //HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt();
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        if (lsfilename != "")  //attsize
        {
            lshy_fatherfield = "";
            ls_attsize = System.Convert.ToString(System.Convert.ToDouble(System.Convert.ToInt32(System.Convert.ToDouble(FileUpload1.PostedFile.ContentLength.ToString()) / 1024 / 1024 * 1000)) / 1000);//附件的大小
            lsguid = Hyoa_global.GetRandom();
            System.Console.WriteLine(lsguid);
            //SaveCommon(ls_path, ls_attsize, lsguid);
            //将附件上传到服务器目录下
            lspath = Server.MapPath("~/");//虚拟目录的位置
            lsurl = "fileatt\\" + this.Session["hyuid"].ToString() + "\\" + lsguid; //存放的文件夹

            //Directory.CreateDirectory(lspath + "\\" + this.Session["hyuid"].ToString() );
            Directory.CreateDirectory(lspath  + "\\" + lsurl);
            str_path = lspath + "\\" + lsurl + "\\" + lsfilename;
            FileUpload1.SaveAs(str_path);

            HyoaClass.Hyoa_jstx_info Hyoa_jstx_info = new HyoaClass.Hyoa_jstx_info();
            Hyoa_jstx_info.ID = lsguid;
            Hyoa_jstx_info.hy_sendinfo_userid = this.Session["hyuid"].ToString();
            Hyoa_jstx_info.hy_sendinfo_username = this.Session["hyuname"].ToString();
            Hyoa_jstx_info.hy_receive_userid = recuserid;
            Hyoa_jstx_info.hy_receive_username = recusername;
            Hyoa_jstx_info.hy_content = lsfilename;
            Hyoa_jstx_info.hy_sendinfo_date = System.DateTime.Now.ToString();
            Hyoa_jstx_info.hy_fileattpath = lsurl + "\\" + lsfilename;
            Hyoa_jstx_info.hy_readlists = "";
            Hyoa_jstx_info.hy_delrylist = "";
            Hyoa_jstx_info.Insert();

            //Hyoa_fileatt.ID = lsguid;
            //Hyoa_fileatt.hy_fatherid = this.txtfatherid.Value;
            //if (this.txtfilename.Text == "")
            //{
            //    Hyoa_fileatt.hy_filename = lsfilename;
            //}
            //else
            //{
            //    Hyoa_fileatt.hy_filename = this.txtfilename.Text;
            //}
            //Hyoa_fileatt.hy_filepath = lsurl + "\\" + lsfilename;
            //Hyoa_fileatt.hy_filesize = ls_attsize;
            //Hyoa_fileatt.hy_userid = this.Session["hyuid"].ToString();
            //Hyoa_fileatt.hy_djsj = System.DateTime.Now.ToString();
            //if (this.Request.QueryString["fatherfield"] != null)
            //{
            //    lshy_fatherfield = this.Request.QueryString["fatherfield"].ToString();   ////父文档配置的域名
            //}
            //Hyoa_fileatt.hy_fatherfield = lshy_fatherfield;
            //Hyoa_fileatt.Insert();

        }
        else
        {
            this.Response.Write("<script>alert('请选择要上传的文件!');</script>");
        }

        Response.Write("<script>alert('发送成功!');window.opener.location.reload();</script>");
    }
 //得到未读站内消息
 protected string getwdxxs()
 {
     HyoaClass.Hyoa_jstx_info Hyoa_jstx_info = new HyoaClass.Hyoa_jstx_info();
     DataTable dt = Hyoa_jstx_info.GetDocByReceiveuserid_wd(Session["hyuid"].ToString());
     return dt.Rows.Count.ToString();
 }
    private void DataPlay(int PageNo)
    {
        //判断当前用户是否有新建删除权限
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();

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

        //DataTable dt = Hyoa_jstx_info.GetDocByReceiveuserid(Session["hyuid"].ToString());
        DataTable dt = Hyoa_jstx_info.GetDocByReceiveuserid_wd(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 = dt;
        this.rptlist.DataBind();
        dt.Clear();

        //所有记录置为已读(当前用户)
        Hyoa_jstx_info.Update_readlist_byreceiveuserid(Session["hyuid"].ToString());
    }