Exemplo n.º 1
0
        private void InvalidTieZi()
        {
            BLL.BBSBLL bll = new BLL.BBSBLL();


            decimal TieZiId = ReDecimal("TieZiId");

            if (bll.HasTieZiPower(TieZiId))
            {
                bool Invalid = ReBool("Invalid", true);

                StringBuilder s = new StringBuilder();

                s.Append(" update BBS.dbo.TieZi  set Invalid ='" + Invalid + "' where TieZiId='" + TieZiId + "' ");

                DAL.DalComm.ExReInt(s.ToString());
            }
            else
            {
                throw new Exception("你好像木有权限这么做!");
            }



            ReTrue();
        }
Exemplo n.º 2
0
        private void ToYueMingZhong()
        {
            BLL.BBSBLL bll     = new BLL.BBSBLL();
            decimal    TieZiId = ReDecimal("TieZiId");

            if (bll.HasTieZiPower(TieZiId))
            {
                string        YueMingZhong = ReStr("YueMingZhong");
                StringBuilder s            = new StringBuilder();
                s.Append(" update  BBS.DBO.TIEZI set YueMingZhong='" + YueMingZhong + "' where TieZiId='" + TieZiId + "' ");

                DAL.DalComm.ExReInt(s.ToString());

                ReTrue();
            }
            else
            {
                throw new Exception("您好像没有权限执行这个操作!");
            }
        }
Exemplo n.º 3
0
        private void Recommend()
        {
            BLL.BBSBLL bll     = new BLL.BBSBLL();
            decimal    TieZiId = ReDecimal("TieZiId");

            if (bll.HasTieZiPower(TieZiId))
            {
                StringBuilder s           = new StringBuilder();
                int           RecommendLv = ReInt("RecommendLv");
                s.Append(" update BBS.dbo.TieZi  set RecommendLv='" + RecommendLv + "' where TieZiId='" + TieZiId + "'  ");



                DAL.DalComm.ExReInt(s.ToString());

                ReTrue();
            }
            else
            {
                throw new Exception("您好像没有权限!");
            }
        }
Exemplo n.º 4
0
        private void SaveTieZiInfo()
        {
            BLL.BBSBLL bbll = new BLL.BBSBLL();


            Model.TieZiModel model = new TieZiModel();
            model.TieZiId = ReDecimal("TieZiId", 0);

            if (bbll.HasTieZiPower(model.TieZiId))
            {
                //是否有操作权限
            }
            else
            {
                throw new Exception("您没有操作权限!");
            }

            if (model.TieZiId > 0)
            {//修改
                model            = bbll.GetTieZiModel(model.TieZiId);
                model.CreateTime = ReTime("CreateTime", DateTime.Now);
            }
            else
            {
                //新增
                model.Ip           = ReStr("Ip", HttpContext.Current.Request.UserHostAddress);
                model.CreateUser   = Common.CookieSings.GetCurrentUserId();
                model.Source       = ReStr("Source", "");
                model.HideUser     = ReBool("HideUser");
                model.WxOpenId     = ReStr("WxOpenId", "");
                model.YueMingZhong = "";
                model.RecommendLv  = ReInt("RecommendLv", 0);
            }


            model.TieZiTitle = ReStr("TieZiTitle", "");
            bool AddHot = ReBool("AddHot", false);

            model.TieZiContent = ReStrDeCode("TieZiContent");

            model.TieZiSummary = Common.StringPlus.GetLeftStr(Common.StringPlus.OutHtmlText(model.TieZiContent), 120, "");



            model.TieZiImgId = ReStr("TieZiImgId", "");
            model.MiniImgUrl = ReStr("MiniImgUrl", "");

            model.ForumId    = ReDecimal("ForumId");
            model.TieZiType  = ReStr("TieZiType", "");
            model.TieZiClass = ReStr("TieZiClass", "");


            model.ParentTieZiId = ReDecimal("ParentTieZiId", 0);


            model.RepLastUser = model.CreateUser;
            model.Invalid     = ReBool("Invalid", false);
            DataTable dtImg = ReTable("imgArray");

            #region 事务开启

            TransactionOptions transactionOption = new TransactionOptions();
            transactionOption.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.Required, transactionOption))
            {
                #endregion
                dtImg = BLL.BJ.ImgSetting.ImgArraySetting(dtImg, model.TieZiContent);
                if (dtImg != null)
                {
                    model.TieZiImgId = dtImg.Rows[0]["ImgId"].ToString();
                }


                bbll.SaveTieZi(model);
                bbll.DeleteTieZiVsImgByTieZiId(model.TieZiId);              //删除帖子下所有的图片,重新插入.
                if (dtImg != null)
                {
                    foreach (DataRow dr in dtImg.Rows)
                    {
                        Model.TieZiVsImgModel VsImgModel = new TieZiVsImgModel();
                        VsImgModel.TieZiId = model.TieZiId;
                        VsImgModel.ImgId   = dr["ImgId"].ToString();
                        VsImgModel.vsType  = "UserImg";
                        bbll.AddTieZiVsImg(VsImgModel);
                    }
                }
                ReDict2.Add("ForumId", model.ForumId.ToString());
                ReDict2.Add("TieZiId", model.TieZiId.ToString());

                if (model.ParentTieZiId > 0)
                {
                    int ParentRepCount = DAL.DalComm.ExInt(" select RepCount from BBS.DBO.TIEZI WHERE TieZiId='" + model.ParentTieZiId + "'  ");
                    ReDict2.Add("ParentRepCount", ParentRepCount.ToString());
                    #region 开始提醒
                    RemindModel remindmodel = new RemindModel();
                    remindmodel.CreateTime   = DateTime.Now;
                    remindmodel.MerLook      = false;
                    remindmodel.ReKey        = model.ParentTieZiId.ToString();
                    remindmodel.ReMerchantId = 0;
                    remindmodel.RemindTitle  = "您发布的帖子有了新的回应!";
                    remindmodel.RemindTypeId = model.TieZiType;
                    remindmodel.ReUserId     = ReStr("ReUserId", "");
                    remindmodel.Url          = "/t/?TieZiId=" + ReDecimal("ReTieZiId") + "";


                    remindmodel.UserLook = false;


                    BLL.CommBLL commBll = new BLL.CommBLL();

                    if (remindmodel.ReUserId.Trim() != "")
                    {
                        commBll.SaveReMind(remindmodel);
                    }



                    #endregion
                    #region 如果是回帖,更新主贴时间

                    if (model.TieZiType == "回帖")
                    {
                        //说明本帖是个回帖,更新回帖数目, 和最后发表人
                        int i = DAL.DalComm.ExReInt(" update bbs.dbo.TieZi set UpdateTime ='" + DateTime.Now.ToString() + "' , RepLastUser='******'  where TieZiId='" + model.ParentTieZiId + "'  ");
                        if (i <= 0)
                        {
                            throw new Exception("没有找到ID为" + model.ParentTieZiId + "的主贴!");
                        }
                    }
                    #endregion
                }
                #region 事务结束

                transactionScope.Complete();
            }
            #endregion
            ReTrue();
        }