Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            string title   = context.Request["Title"];
            string content = context.Request["Context"];

            if (string.IsNullOrEmpty(title))
            {
                apiResp.msg = "标题不能为空";
                context.Response.Write(Common.JSONHelper.ObjectToJson(apiResp));
                return;
            }
            if (string.IsNullOrEmpty(content))
            {
                apiResp.msg = "内容不能为空";
                context.Response.Write(Common.JSONHelper.ObjectToJson(apiResp));
                return;
            }
            currentWebsteInfo = bllUser.GetWebsiteInfoModelFromDataBase();
            if (currentWebsteInfo.IsEnableUserReleaseReview == 0)
            {
                apiResp.msg = "暂不开放发布话题功能";
                context.Response.Write(Common.JSONHelper.ObjectToJson(apiResp));
                return;
            }
            ReviewInfo model = new ReviewInfo
            {
                ForeignkeyId   = bllUser.WebsiteOwner,
                ForeignkeyName = bllUser.WebsiteOwner,
                UserId         = CurrentUserInfo.UserID,
                UserName       = CurrentUserInfo.TrueName,
                ReviewPower    = 0,
                InsertDate     = DateTime.Now,
                ReviewTitle    = title,
                ReviewContent  = content,
                WebsiteOwner   = bllUser.WebsiteOwner,
                PraiseNum      = 0,
                StepNum        = 0,
                ReviewType     = "话题",
                CategoryType   = "",
                ReplyDateTiem  = DateTime.Now
            };

            if (bllReview.Add(model))
            {
                BLLRedis.ClearReviewList(bllUser.WebsiteOwner);
                apiResp.status = true;
            }
            else
            {
                apiResp.msg = "发布失败";
            }
            context.Response.Write(Common.JSONHelper.ObjectToJson(apiResp));
        }
Example #2
0
File: Add.ashx.cs Project: uvbs/mmp
        public void ProcessRequest(HttpContext context)
        {
            int             autoId      = int.Parse(context.Request["AutoID"]);
            string          content     = context.Request["Context"];
            ReviewInfo      reviewInfo  = bllReview.Get <ReviewInfo>(string.Format("AutoId={0}", autoId));
            ReplyReviewInfo replyReview = new ReplyReviewInfo()
            {
                ReviewID     = Convert.ToInt32(autoId),
                InsertDate   = DateTime.Now,
                ReplyContent = content,
                UserId       = CurrentUserInfo.UserID,
                UserName     = CurrentUserInfo.LoginName,
                PraentId     = 0,
                WebSiteOwner = bllReview.WebsiteOwner
            };
            bool isSuccess = bllReview.Add(replyReview);

            if (isSuccess)
            {
                reviewInfo.NumCount++;
                reviewInfo.ReplyDateTiem = DateTime.Now;
                if (bllReview.Update(reviewInfo))
                {
                    //给回复者加分
                    int replyCount = bllReview.GetCount <ReplyReviewInfo>(string.Format("ReviewID={0} And  UserId='{1}'", autoId, CurrentUserInfo.UserID));
                    if (replyCount <= 1)//第一次回答才得分
                    {
                        bllUser.AddUserScoreDetail(CurrentUserInfo.UserID, CommonPlatform.Helper.EnumStringHelper.ToString(ZentCloud.BLLJIMP.Enums.ScoreDefineType.AnswerQuestions), bllUser.WebsiteOwner, null, null);
                    }
                    apiResp.status = true;
                }
                else
                {
                }
            }
            else
            {
            }
            BLLRedis.ClearReviewList(bllReview.WebsiteOwner);
            context.Response.Write(Common.JSONHelper.ObjectToJson(apiResp));
        }