//绑定通知类别 //private void BindPushType() //{ // var typeList = new BLL.CCOM.Notice_type().GetModelList(""); // if(typeList!=null&&typeList.Count>0) // { // StringBuilder sb = new StringBuilder(); // var className = "btn btn-success"; // var className1 = "btn"; // string noticeTypeId = MyRequest.GetQueryString("notice_type_id"); // if(noticeTypeId==null||noticeTypeId.Length==0)//若为传值则默认为未分类 // { // sb.Append("<a href=\"Notice_list_manager.aspx?notice_type_id=" + DESEncrypt.Encrypt("0") + "¬ice_type=" + this.NoticeType + "&fun_id=" + DESEncrypt.Encrypt(this.fun_id) + "\" class='" + className + "'>"); // sb.Append("未分类</a> "); // for(int i=0;i<typeList.Count;i++) // { // sb.Append("<a href=\"Notice_list_manager.aspx?notice_type_id=" + DESEncrypt.Encrypt(typeList[i].Notice_type_id.ToString()) + "¬ice_type=" + this.NoticeType + "&fun_id=" + DESEncrypt.Encrypt(this.fun_id) + "\" class='" + className1 + "'>"); // sb.Append(typeList[i].Notice_type_name + "</a> "); // } // this.NoticeTypeDiv.InnerHtml = sb.ToString(); // } // else // { // try // { // long notice_type_id = long.Parse(DESEncrypt.Decrypt(noticeTypeId)); // if(notice_type_id==0) // { // sb.Append("<a href=\"Notice_list_manager.aspx?notice_type_id=" + DESEncrypt.Encrypt("0") + "¬ice_type=" + this.NoticeType + "&fun_id=" + DESEncrypt.Encrypt(this.fun_id) + "\" class='" + className + "'>"); // sb.Append("未分类</a> "); // for (int i = 0; i < typeList.Count; i++) // { // sb.Append("<a href=\"Notice_list_manager.aspx?notice_type_id=" + DESEncrypt.Encrypt(typeList[i].Notice_type_id.ToString()) + "¬ice_type=" + this.NoticeType + "&fun_id=" + DESEncrypt.Encrypt(this.fun_id) + "\" class='" + className1 + "'>"); // sb.Append(typeList[i].Notice_type_name + "</a> "); // } // } // else // { // sb.Append("<a href=\"Notice_list_manager.aspx?notice_type_id=" + DESEncrypt.Encrypt("0") + "¬ice_type=" + this.NoticeType + "&fun_id=" + DESEncrypt.Encrypt(this.fun_id) + "\" class='" + className1 + "'>"); // sb.Append("未分类</a> "); // for (int i = 0; i < typeList.Count; i++) // { // if(typeList[i].Notice_type_id==notice_type_id) // { // sb.Append("<a href=\"Notice_list_manager.aspx?notice_type_id=" + DESEncrypt.Encrypt(typeList[i].Notice_type_id.ToString())+"¬ice_type="+this.NoticeType + "&fun_id=" + DESEncrypt.Encrypt(this.fun_id) + "\" class='" + className + "'>"); // sb.Append(typeList[i].Notice_type_name + "</a> "); // } // else // { // sb.Append("<a href=\"Notice_list_manager.aspx?notice_type_id=" + DESEncrypt.Encrypt(typeList[i].Notice_type_id.ToString()) + "¬ice_type=" + this.NoticeType + "&fun_id=" + DESEncrypt.Encrypt(this.fun_id) + "\" class='" + className1 + "'>"); // sb.Append(typeList[i].Notice_type_name + "</a> "); // } // } // } // this.NoticeTypeDiv.InnerHtml = sb.ToString(); // } // catch // { // } // } // } //} #region 数据绑定================================= private void RptBind(string _strWhere, string _order) { int pageSize = GetPageSize(10); //每页数量 int page = MyRequest.GetQueryInt("page", 1); string keywords = MyRequest.GetQueryString("keywords"); int start_index = pageSize * (page - 1) + 1; int end_index = pageSize * page; this.txtKeywords.Text = keywords; var bll = new BLL.CCOM.Notice(); //计算数量 int totalCount = bll.GetRecordCount(_strWhere); //绑定当页 var ds = bll.GetListByPage(_strWhere, _order, start_index, end_index); this.rptList.DataSource = ds; this.rptList.DataBind(); //绑定页码 txtPageNum.Text = pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("Notice_list_manager.aspx", "fun_id={0}&keywords={1}&page={2}¬ice_type_id={3}", DESEncrypt.Encrypt(this.fun_id), this.keywords, "__id__", DESEncrypt.Encrypt(this.ptId.ToString())); this.PageContent.InnerHtml = Utils.OutPageList(pageSize, page, totalCount, pageUrl, 8, true); }
private void RptBind() { int pageSize = 10; //每页数量 int page = MyRequest.GetQueryInt("page", 1); string keywords = this.keywords; //MyRequest.GetQueryString("keywords"); int start_index = pageSize * (page - 1) + 1; int end_index = pageSize * page; this.txtKeywords.Value = keywords; StringBuilder ulSb = new StringBuilder(); //获取该用户的所有未读通知Id BLL.CCOM.User_notice bll = new BLL.CCOM.User_notice(); Model.CCOM.User_notice model = bll.GetModel(" User_id=" + GetAdminInfo_CCOM().User_id); if (model != null) { string all_news_id = string.Empty; if (type == 0) { all_news_id = model.Notice_id; this.no_read.Style.Value = "background-color:#a5d16c"; this.read.Style.Value = "background-color:lightgrey"; } else { all_news_id = model.Notice_read_id; this.read.Style.Value = "background-color:#a5d16c"; this.no_read.Style.Value = "background-color:lightgrey"; } if (all_news_id.Length > 0) { string[] ids = all_news_id.Split(','); string strWhere = string.Empty; if (keywords != null && keywords.Length > 0) { strWhere += " Notice_content like '%" + keywords + "%' "; } else { strWhere += " 1=1"; } if (ids.Length > 0) { for (int i = 0; i < ids.Length; i++) { if (i == 0) { strWhere += " and ( Notice_id=" + ids[i]; } else { strWhere += " or Notice_id=" + ids[i]; } } strWhere += " )"; //获取通知信息 BLL.CCOM.Notice bll_notice = new BLL.CCOM.Notice(); int totalCount = bll_notice.GetRecordCount(strWhere); //计算数量 DataTable dt = bll_notice.GetListByPage(strWhere, "Notice_date DESC", start_index, end_index).Tables[0]; //绑定当页 long userId = GetAdminInfo_CCOM().User_id; if (dt.Rows.Count > 0) { BLL.CCOM.User_information user_bll = new BLL.CCOM.User_information(); string realname = string.Empty; foreach (DataRow dr in dt.Rows) { var content = ""; content = "<a href=\"ViewNotice.aspx?id=" + DESEncrypt.Encrypt(dr["Notice_id"].ToString()) + "\" target=\"_blank\">"; content += dr["Notice_title"] + "</a>"; content += "<br />"; content += dr["Notice_content"]; try { realname = user_bll.GetModel(Convert.ToInt32(dr["Notice_sender_id"])).User_realname; } catch { realname = "---"; } ulSb.Append("<li>"); ulSb.Append("<div class=\"media\">"); ulSb.Append("<span class=\"label pull-left label-success\"><i class=\"icon-bell\"></i></span>"); ulSb.Append("<div class=\"media-body\">"); ulSb.Append("<div class=\"notice-collapse\" style=\"padding: 5px;\">"); ulSb.Append("<div class=\"text\" style=\"padding: 2px 4px; text-decoration: none;\">"); ulSb.Append(" <p style=\"font-weight:bold;\">" + content + "</p>"); ulSb.Append(" <p class=\"attribution\">" + realname + " " + ((DateTime)dr["Notice_date"]).ToString("yyyy-MM-dd HH:mm") + "</p>"); ulSb.Append("</div>"); ulSb.Append("</div>"); ulSb.Append("</div>"); ulSb.Append("</div>"); ulSb.Append("</li>"); } //this.page_size.Style.Add("display", ""); } else { //this.page_size.Style.Add("display", "none"); ulSb.Append("<li style=\"height:40px;font-size:18px;text-align:center;padding-top:21px;\">暂无通知消息!</li>"); } //绑定页码 string pageUrl = Utils.CombUrlTxt("Notice_list.aspx", "keywords={0}&page={1}&fun_id={2}&type={3}", this.keywords, "__id__", DESEncrypt.Encrypt(this.fun_id), DESEncrypt.Encrypt(this.type.ToString())); this.PageContent.InnerHtml = Utils.OutPageList(pageSize, page, totalCount, pageUrl, 8, true); } } else { ulSb.Append("<li style=\"height:40px;font-size:18px;text-align:center;padding-top:21px;\">暂无通知消息!</li>"); //this.page_size.Style.Add("display", "none"); } } else//为空则创建该用户 { Model.CCOM.User_notice user_notice_model = new Model.CCOM.User_notice(); user_notice_model.User_id = GetAdminInfo_CCOM().User_id; bll.Add(user_notice_model); } this.noticeList.InnerHtml = ulSb.ToString(); }