Example #1
0
        public VM_PItem(HttpRequestBase Request, int cpage, int psize)
        {
            barMod = barBll.SelReturnModel(DataConvert.CLng(Request.QueryString["id"]));
            if (barMod == null)
            {
                function.WriteErrMsg("该贴子不存在!!");
            }
            cateMod = cateBll.SelReturnModel(barMod.CateID);
            mu      = tuBll.GetLogin();
            if (barMod.Status != (int)ZLEnum.ConStatus.Audited && cateMod.Status != 1)
            {
                function.WriteErrMsg("该贴子需要审核通过才能浏览!");
            }
            if (cateMod.IsBarOwner(mu.UserID))//吧主
            {
                auth_barowner = true;
                auth_edit     = true;
            }
            else
            {
                if (!authBll.AuthCheck(cateMod, mu))
                {
                    function.WriteErrMsg("你没有访问权限或未登录,请<a href='/User/Login?Returnurl=/PItem?id=" + barMod.ID + "&cpage=" + cpage + "'>登录</a>后查看");
                }
                if ((!authBll.AuthCheck(cateMod, mu, "send")))
                {
                    auth_send = false;
                }
            }
            if (barMod.CUser == mu.UserID)
            {
                auth_edit = true;
            }
            setting = barBll.SelByID(cpage, psize, barMod, Request.QueryString["Filter"]);
            barBll.AddHitCount(barMod.ID);
            barMod.HitCount++;
            string msgids = "";

            for (int i = 0; i < setting.dt.Rows.Count; i++)
            {
                msgids += setting.dt.Rows[i]["ID"].ToString() + ",";
            }
            likeDT  = likeBll.SelByMsgIDS(msgids.Trim(','), "bar");
            mediaDT = medalBll.SelByBarIDS(msgids.Trim(','));
            if (barMod.Status < 0 && barMod.Status == (int)ZLEnum.ConStatus.Recycle)
            {
                function.WriteErrMsg("该帖子已删除!!", "/PClass?id=" + barMod.CateID);
            }
            auth_like = !barMod.ColledIDS.Contains("," + mu.UserID + ",");
        }
Example #2
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;
        }
    }