Example #1
0
 public ActionResult DoSubmitMemberComment()
 {
     MemberModel member = this.getAuthMember();
     MemberCommentModel comment = new MemberCommentModel();
     comment = WebUtil.Eval<MemberCommentModel>(comment, "", "");
     comment.memberFk = member.id;
     DataBiz dataBiz = DataBiz.GetInstant();
     JsResultObject re = dataBiz.submitComment(comment);
     this.SetResult(re, true);
     IList<OrderModel> orders = BaseZdBiz.List<OrderModel>(Restrictions.Eq("memberFk", member.id));
     ViewData[typeof(OrderModel).Name] = orders;
     return View("Index");
 }
        public ActionResult DoSubmitMemberComment(string vCode)
        {
            JsResultObject re = WebUtil.DoValidateCode(vCode);
            if (re.code != JsResultObject.CODE_SUCCESS) {
                return JsonText(re, JsonRequestBehavior.AllowGet);
            }

            MemberModel model = this.getAuthMember();
            if (model == null) {
                re.msg = "请先使用会员帐号登陆,再进行评论";
                return JsonText(re, JsonRequestBehavior.AllowGet);
            }
            MemberCommentModel comment = new MemberCommentModel();
            comment = WebUtil.Eval<MemberCommentModel>(comment, "", "");
            comment.createDate = DateTime.Now;
            comment.setPk(comment.createPk());
            re = BaseZdBiz.Save(comment);
            return JsonText(re, JsonRequestBehavior.AllowGet);
        }
Example #3
0
        public JsResultObject submitComment(MemberCommentModel comment)
        {
            JsResultObject re = new JsResultObject();
            OrderModel order = BaseZdBiz.Load<OrderModel>(comment.orderFk);
            MemberRewardRuleModel rule = GetCurRewardRule();
            if (order.checkOutDate.AddDays(rule.comValidityDays).CompareTo(DateTime.Now) < 0) {
                re.code = JsResultObject.CODE_ERROR;
                re.msg =string.Format( "离店日期超出{0}日",rule.comValidityDays);
                return re;
            }

            comment.createDate = DateTime.Now;
            comment.setPk(comment.createPk());
            re=BaseZdBiz.Save(comment);
            order.orderStatus = OrderModel.ORDER_STATUS_COMMENTED;
            re = BaseZdBiz.Update(order,"");
            MemberModel member = BaseZdBiz.Load<MemberModel>(comment.memberFk);
            MemberAccountModel oldAccount = getCurrMemberAccount(member);
            MemberAccountModel newAccount = new MemberAccountModel(comment.memberFk);
            newAccount.method = MemberAccountModel.METHOD_COMMENT_REWARD;
            newAccount.createDate = DateTime.Now;
            newAccount.method = MemberAccountModel.METHOD_COMMENT_REWARD;
            newAccount.oldAmount = oldAccount.newAmount;
            newAccount.changeAmount=Convert.ToInt32(GetReward(order).amount);
            newAccount.newAmount = newAccount.oldAmount + newAccount.changeAmount;
            newAccount.setPk(newAccount.createPk());
            re = BaseZdBiz.Save(newAccount);

            return re;
        }