Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Pid >= 0)
         {
             MyBind();
         }
         else
         {
             MsgTitle_T.Visible = true;
             Valid_S.Visible    = true;
             M_UserInfo mu = buser.GetLogin();
             cateMod    = guestBll.GetCate(Cid);
             Tip_T.Text = "发表贴子至" + "<a href='" + B_Guest_Bar.CreateUrl(1, Cid) + "' title='返回'>" + cateMod.CateName + "</a>";
             if (!authBll.AuthCheck(cateMod, mu, "needlog"))//验证发贴权限
             {
                 function.WriteErrMsg("您需要登录才能发贴!");
             }
             else if (!authBll.AuthCheck(cateMod, mu, "send"))
             {
                 function.WriteErrMsg("您没有权限在此发帖");
             }
         }
         ReturnBar_a.Text        = "<i class='fa fa-arrow-circle-left'></i>返回" + cateMod.CateName;
         ReturnBar_a.NavigateUrl = "/" + CreateUrl(1, cateMod.CateID);
     }
 }
Пример #2
0
    public void MyBind()
    {
        int        pageCount = 0;
        DataTable  dt        = new DataTable();
        M_UserInfo mu        = tpuser_Bll.GetLogin(); //barBll.GetUser();

        if (!string.IsNullOrEmpty(Request.QueryString["searchstr"]) || !string.IsNullOrEmpty(Request.QueryString["uid"]) || !string.IsNullOrEmpty(Request.QueryString["islike"]))
        {
            string skey    = Request.QueryString["searchstr"];
            int    uid     = DataConvert.CLng(Request.QueryString["uid"]);
            bool   sellike = DataConvert.CLng(Request.QueryString["islike"]) > 0 ? true : false;
            string skeyTlp = "\"<span style='color:#ff6a00;'>{0}</span>\"";

            if (!string.IsNullOrEmpty(skey))
            {
                BarName_L.Text = "相关" + string.Format(skeyTlp, skey) + "的贴子";
                Title_L.Text   = skey + "\"的贴子";
                dt             = barBll.SelByCateID(skey, 3);
            }
            else if (sellike)
            {
                BarName_L.Text = string.Format(skeyTlp, "我的收藏");
                Title_L.Text   = "我的收藏";
                dt             = barBll.SelByCateID(mu.UserID.ToString(), 4);
            }
            else
            {
                M_UserInfo smu = new M_UserInfo();
                if (uid < 1)//匿名用户不允许搜索
                {
                    smu.UserName = "******";
                }
                else
                {
                    smu = buser.GetUserByUserID(uid);
                    dt  = barBll.SelByCateID(uid.ToString(), 2);
                }
                BarName_L.Text = string.Format(skeyTlp, smu.HoneyName) + "的贴子";
                Title_L.Text   = smu.HoneyName + "的贴子";
            }
            Cid = cateMod.CateID;
            totalspan.InnerText = "共搜索到" + dt.Rows.Count + "个贴子";
            function.Script(this, "SetImg('/App_Themes/User/timg.jpg');");
            IsSearch             = true;
            MsgTitle_T.Enabled   = false;
            MsgContent_T.Enabled = false;
            SendDiv.Visible      = false;
        }
        else
        {
            Cid     = cateMod.CateID;
            dt      = barBll.SelByCateID(CateID.ToString(), 1, true);
            cateMod = guestBll.GetCate(CateID);

            #region 权限校验
            if (cateMod.IsBarOwner(mu.UserID))
            {
                barowner_div.Visible = true;
                IsBarOwner           = true;
                DPBind();
            }
            else//非吧主权限验证
            {
                switch (cateMod.PermiBit)
                {
                case "1":    //版面类别
                    emptydiv.Style.Add("display", "none");
                    send_div.Visible = false;
                    RPT.Visible      = false;
                    break;

                default:
                    if (!authBll.AuthCheck(cateMod, mu, "needlog"))    //访问权限
                    {
                        function.WriteErrMsg("你没有访问权限");
                    }
                    if (!authBll.AuthCheck(cateMod, mu, "send"))    //发贴权限
                    {
                        send_div.Visible   = false;
                        noauth_div.Visible = true;
                    }
                    break;
                }
            }
            #endregion
            BarInfo_L.Text = cateMod.Desc;
            function.Script(this, "SetImg('" + cateMod.BarImage + "');");
            if (cateMod.IsNull)
            {
                function.WriteErrMsg("该贴吧不存在!!");
            }
            Title_L.Text   = cateMod.CateName;
            BarName_L.Text = cateMod.CateName;
            DataTable chdt = B_GuestBook.GetCateList(CateID);
            if (chdt.Rows.Count > 0)
            {
                ChildRPT.DataSource = chdt;
                ChildRPT.DataBind();
            }
            else
            {
                childBar.Visible = false;
            }
        }
        RPT.DataSource = PageCommon.GetPageDT(pageSize, CPage, dt, out pageCount);
        RPT.DataBind();
        int tiecount = 0;
        int recout   = 0;
        barBll.GetCount(CateID, out tiecount, out recout);
        replycount.InnerText    = recout.ToString();
        dnum_span.InnerText     = dt.Rows.Count.ToString();
        dnum_span2.InnerText    = tiecount.ToString();
        pagenum_span1.InnerText = pageCount.ToString();
        MsgPage_L.Text          = PageCommon.CreatePageHtml(pageCount, CPage);
        if (dt.Rows.Count > 0)
        {
            contentdiv.Visible = true;
        }
        else
        {
            emptydiv.Visible = true;
        }
        Anony_Span.Visible = mu.UserID <= 0;
    }
Пример #3
0
    public void MyBind()
    {
        int       pageCount = 0;
        DataTable dt        = new DataTable();

        barMod = barBll.SelReturnModel(Pid);
        if (barMod == null)
        {
            function.WriteErrMsg("该贴子不存在!!");
        }
        M_GuestBookCate cateMod = bookBll.GetCate(barMod.CateID);
        M_UserInfo      mu      = tpuserBll.GetLogin();//barBll.GetUser();

        if (barMod.Status != (int)ZLEnum.ConStatus.Audited && cateMod.Status != 1)
        {
            function.WriteErrMsg("该贴子需要审核通过才能浏览!");
        }
        if (cateMod.IsBarOwner(mu.UserID))//吧主
        {
            barowner_div.Visible = true;
            IsBarOwner           = true;
        }
        else
        {
            if (!authBll.AuthCheck(cateMod, mu))
            {
                function.WriteErrMsg("你没有访问权限或未登录,请<a href='/User/Login.aspx?Returnurl=/" + B_Guest_Bar.CreateUrl(2, Pid, CPage) + "'>登录</a>后查看");
                //if (cateMod.NeedLog == 1 && mu.UserID == 0) function.WriteErrMsg("该栏目必须<a href='/User/Login.aspx?returnUrl=/Post" + Pid + "/Default_1.aspx'>登录</a>后才能访问");
            }
            if ((!authBll.AuthCheck(cateMod, mu, "send")))
            {
                send_div.Visible   = false;
                noauth_div.Visible = true;
            }
        }
        dt = barBll.SelByID(Pid);
        barBll.AddHitCount(Pid);
        hitcount_span.InnerText = (barMod.HitCount + 1).ToString();
        dt.Columns.Add("Layer", typeof(int));
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            dt.Rows[i]["Layer"] = (i + 1);
        }
        if (Filter.Contains("OnlyLayer"))
        {
            dt.DefaultView.RowFilter = "CUser = "******"该帖子已删除!!", "/" + B_Guest_Bar.CreateUrl(1, Cid));
        }
        function.Script(this, "SetImg('" + cateMod.BarImage + "');");
        ReturnBar_a.Text        = "<i class='fa fa-arrow-circle-left'></i>返回" + cateMod.CateName;
        ReturnBar_a.NavigateUrl = "/" + CreateUrl(1, Cid);
        int mcount = 0, rcount = 0;

        barBll.GetCount(Cid, out mcount, out rcount);
        if (!barMod.LikeIDS.Contains("," + mu.UserID + ","))
        {
            LikeBtn_Li.Text = string.Format("<input type='button' value='收藏' id='liketie' onclick='LikeTie(this,{0})'class='btn btn-xs btn-primary' />", Pid);
        }
        else
        {
            LikeBtn_Li.Text = "<input type='button' value='取消收藏' id='liketie' onclick='LikeTie(this," + Pid + ")'class='btn btn-xs btn-primary liked' />";
        }
        //判断是否显示编辑按钮
        if (UserID == barMod.CUser)
        {
            EditBtn_DIV.Visible = true;
        }
    }