Пример #1
0
        /// <summary>
        /// 重写虚方法,此方法在Init事件执行
        /// </summary>
        protected override void InitPage()
        {
            base.InitPage();
            id             = DTRequest.GetQueryInt("id");
            message_status = DTRequest.GetQueryInt("status", 0);

            BLL.user_message bll = new BLL.user_message();
            if (!bll.Exists(id))
            {
                HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")));
                return;
            }
            model = bll.GetModel(id);
            if (model.accept_user_name != userModel.user_name || (model.type == 2 && model.post_user_name != userModel.user_name))
            {
                HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您所查看的并非自己的短消息!")));
                return;
            }
            //设为已阅读状态
            bll.UpdateField(id, "is_read=1,read_time='" + DateTime.Now + "'");
            //查找下一条
            var messageDt = new DataTable();

            if (message_status == 0)
            {
                messageDt = bll.GetList(10, string.Format("accept_user_name='{0}' and type=1 and Id<{1}", userModel.user_name, id), "id desc").Tables[0];
            }
            else if (message_status == 1)
            {
                messageDt = bll.GetList(10, string.Format("accept_user_name='{0}' and type=1 and is_read=1 and Id<{1}", userModel.user_name, id), "id desc").Tables[0];
            }
            else
            {
                messageDt = bll.GetList(10, string.Format("accept_user_name='{0}' and type=1 and is_read=0 and Id<{1}", userModel.user_name, id), "id desc").Tables[0];
            }
            next_id = messageDt != null && messageDt.Rows.Count > 0 ? (int)messageDt.Rows[0]["id"] : 0;
        }
Пример #2
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = DTRequest.GetQueryInt("page", 1);
            if (this.type_id > 0)
            {
                this.ddlType.SelectedValue = this.type_id.ToString();
            }
            this.txtKeywords.Text = this.keywords;
            BLL.user_message bll = new BLL.user_message();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("message_list.aspx", "type_id={0}&keywords={1}&page={2}",
                this.type_id.ToString(), this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Пример #3
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = DTRequest.GetQueryInt("page", 1);
            if (this.type_id > 0)
            {
                this.ddlType.SelectedValue = this.type_id.ToString();
            }
            this.txtKeywords.Text = this.keywords;
            BLL.user_message bll = new BLL.user_message();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("message_list_post.aspx", "type_id={0}&keywords={1}&page={2}",
                                              this.type_id.ToString(), this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }