Beispiel #1
0
    /// <summary>
    /// 获取分类列表
    /// </summary>
    /// <param name="type">列表形式</param>
    public string CategoryList()
    {
        PostsBLL        BLL_Post = new PostsBLL();
        CategoryBLL     BLL_Cate = new CategoryBLL();
        StringBuilder   strb     = new StringBuilder();
        List <Category> Clist    = BLL_Cate.GetCategoryList().Where(c => c.satatus == 1).ToList();

        if (Clist.Count > 0)
        {
            int i = 0;

            strb.AppendFormat("<option selected=\"selected\" value=0>选择主题分类</option>");
            foreach (Category C in Clist)
            {
                if (postModel.CID != null && postModel.CID.Value == C.ID)
                {
                    strb.AppendFormat("<option value='{0}' selected='selected'>{1}</option>", C.ID, C.Name);
                }
                else
                {
                    strb.AppendFormat("<option value='{0}'>{1}</option>", C.ID, C.Name);
                }
            }

            //   CategoryListInfo = strb.ToString();
        }
        return(strb.ToString());
    }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserInfo.IsFeedback)
     {
         sn = "<input type=\"radio\" name=\"isAnonymity\" value=\"0\" checked=\"checked\" />实名";
     }
     else
     {
         sn = "<input type=\"radio\" name=\"isAnonymity\" value=\"1\" />匿名<input type=\"radio\" name=\"isAnonymity\" value=\"0\" checked=\"checked\" />实名";
     }
     if (UserInfo != null)
     {
         userName = UserInfo.LoginName;
         if (UserInfo.IsADUser)
         {
             intIsADUser = 1;
         }
         loginname = UserInfo.LoginName;
     }
     if (!IsPostBack)
     {
         listAllPost = pBll.GetPostsList();
         if (!string.IsNullOrEmpty(Request.QueryString["fatherID"]))
         {
             fatherID = Convert.ToInt32(Request.QueryString["fatherID"].ToString());
         }
         if (!string.IsNullOrEmpty(Request.QueryString["pageIndex"]))
         {
             pageIndex = int.Parse(Request.QueryString["pageIndex"]);
         }
         if (!string.IsNullOrEmpty(Request.QueryString["content"]))
         {
             content = Request.QueryString["content"].ToString().Trim().Replace("&nbsp;", "");
         }
         //增加浏览次数
         PostsBLL postBll = new PostsBLL();
         postModel            = postBll.GetPostsEntity(fatherID);
         postModel.LookCount += 1;
         postBll.UpdatePosts(postModel);
         cID = Convert.ToInt32(postModel.CID);
         //导航
         CategoryBLL     catBll  = new CategoryBLL();
         List <Category> listCat = catBll.GetCategoryList().Where(c => c.ID == cID).ToList();
         if (listCat.Count > 0)
         {
             Category catModel = listCat[0];
             catName = catModel.Name;
             catId   = catModel.ID.ToString();
         }
         title = "意见与反馈 - " + catName;
         //绑定回复数据
         if (content == "请输入搜索内容")
         {
             content = "";
         }
         repTo.Content  = content;
         repTo.FatherID = fatherID;
         string orderBy = " isReFeedback desc,ReDatetime asc";
         dtReposts = repBll.GetRePostsList(repTo, pageIndex, pageSize, orderBy, out rowCount);
         //分页
         string url = "detail.aspx?pageIndex={0}&fatherID=" + fatherID;
         strtt = DividePage.Pager(pageSize, rowCount, pageIndex, url);
         //获取当前页
         if (rowCount % pageSize == 0)
         {
             pageNum = rowCount / pageSize;
         }
         else
         {
             pageNum = (rowCount / pageSize) + 1;
         }
     }
 }