Beispiel #1
0
        private void SavePageInfo()
        {
            Model.PageInfoModel model = new Model.PageInfoModel();
            model.PageId   = ReStr("PageId", "");
            model.OrderNo  = ReInt("OrderNo", 0);
            model.PageMemo = ReStr("PageMemo", "");
            model.PageName = ReStr("PageName", "");
            model.BranchId = ReStr("BranchId", "");
            model.ZoneId   = ReStr("ZoneId", "0");

            if (model.ZoneId == "0")
            {
                throw new Exception("ZoneId不能为空!");
            }

            if (model.PageName == "")
            {
                throw new Exception("PageName不能为null");
            }

            model.PageLabel = Common.PinYin.GetFullCodstring(model.PageName);
            if (model.PageName == "")
            {
                throw new Exception("页面名称不能为空!");
            }
            model.MerId = ReDecimal("MerId", 0);
            BLL.CommBLL bll = new BLL.CommBLL();
            bll.SavePageInfo(model);
            ReTrue();
        }
Beispiel #2
0
        private void SendNotice()
        {
            string RongUserId = ReStr("RongUserId", "");

            if (RongUserId == "")
            {
                throw new Exception("RongUserId(发送方)不能为空!");
            }

            decimal MerId = ReDecimal("MerId", 0);

            if (MerId == 0)
            {
                throw new Exception("MerId不能为0!");
            }

            Model.NoticeModel model = new NoticeModel();
            model.CreateTime    = DateTime.Now;
            model.Extra         = ReStr("Extra", "{}");
            model.NoticeContent = ReStr("NoticeContent", "");
            model.NoticeTitle   = ReStr("NoticeTitle", "");

            model.NoticeType = ReStr("NoticeType", "system");
            model.RongUserId = RongUserId;
            BLL.CommBLL bll       = new BLL.CommBLL();
            string      TargetIds = ReStr("TargetIds", "");

            if (TargetIds.Trim() == "")
            {
                throw new Exception("TargetIds不能为空!  ");
            }
            List <Model.NoticeTargetModel> TargetModelList = new List <NoticeTargetModel>();

            string[] TargetArray = TargetIds.Split(',');
            foreach (string TargetId in TargetArray)
            {
                Model.NoticeTargetModel TargetModel = new NoticeTargetModel();
                TargetModel.NoticeId = 0;

                TargetModel.TargetId     = TargetId;
                TargetModel.NoticeStatus = 0; //未发送
                TargetModelList.Add(TargetModel);
            }

            bll.SendNotice(model, TargetModelList, MerId);

            ReTrue();
        }
Beispiel #3
0
        private void SaveLocation()
        {
            Model.LocationModel model = new Model.LocationModel();
            model.LocationId   = ReStr("LocationId", "");
            model.LocationName = ReStr("LocationName", "");
            if (model.LocationName == "")
            {
                throw new Exception("位置名称不能为空!");
            }
            model.Memo          = ReStr("Memo", "");
            model.OrderNo       = ReInt("OrderNo", 0);
            model.PageId        = ReStr("PageId");
            model.LocationLabel = Common.PinYin.GetFullCodstring(model.LocationName);

            BLL.CommBLL bll = new BLL.CommBLL();
            bll.SaveLocation(model);
            ReTrue();
        }
Beispiel #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();
        }