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 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()); }