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); }
public JsResultObject rebateReward(MemberModel member, int rebateAmount, string remark) { JsResultObject re = new JsResultObject(); MemberAccountModel account = getCurrMemberAccount(member); if (member.rebateInd != BaseModel.IND_Y) { re.code = JsResultObject.CODE_ERROR; re.msg = string.Format("当前用户尚未申请返还", account.newAmount, rebateAmount); return(re); } else if (account.newAmount < rebateAmount) { re.code = JsResultObject.CODE_ERROR; re.msg = string.Format("当前用户帐户奖励{0},小于{1},返还无效", account.newAmount, rebateAmount); return(re); } MemberAccountModel newAccount = new MemberAccountModel(); newAccount.createDate = DateTime.Now; newAccount.oldAmount = account.newAmount; newAccount.newAmount = account.newAmount - rebateAmount; newAccount.remark = remark; newAccount.memberFk = member.id; newAccount.method = MemberAccountModel.METHOD_REWARD_REBATE; newAccount.setPk(newAccount.createPk()); newAccount.remark = string.Format("成功为手机号码{0}充值{1}元", member.rebateMoblie, rebateAmount); re = BaseZdBiz.Save(newAccount); if (re.code == JsResultObject.CODE_SUCCESS) { MemberRewardLogModel rewardLog = new MemberRewardLogModel(); rewardLog.createDate = DateTime.Now; rewardLog.amount = rebateAmount; rewardLog.moblie = member.rebateMoblie; rewardLog.method = MemberAccountModel.METHOD_REWARD_REBATE; rewardLog.remark = string.Format("成功为手机号码{0}充值{1}元", member.rebateMoblie, rebateAmount); rewardLog.status = BaseModel.STATUS_ACTIVATE; rewardLog.memberFk = member.id; rewardLog.setPk(rewardLog.createPk()); re = BaseZdBiz.Save(rewardLog); } return(re); }
public JsResultObject submitMemberRegInfo(MemberModel member) { JsResultObject re = BaseZdBiz.Save(member); if (re.code == JsResultObject.CODE_SUCCESS) { MemberRewardRuleModel rule = GetCurRewardRule(); MemberAccountModel account = new MemberAccountModel(member.id); account.oldAmount = 0; account.newAmount = 10; account.changeAmount = 10; account.createDate = DateTime.Now; account.method = MemberAccountModel.METHOD_ACCOUNT_CREATE; account.remark = string.Format("帐号创建成功,获得奖励{0}元", 10); account.setPk(account.createPk()); re = BaseZdBiz.Save(account); } return(re); }
public JsResultObject submitMemberRegInfo(MemberModel member) { JsResultObject re = BaseZdBiz.Save(member); if (re.code == JsResultObject.CODE_SUCCESS) { MemberRewardRuleModel rule=GetCurRewardRule(); MemberAccountModel account = new MemberAccountModel(member.id); account.oldAmount = 0; account.newAmount = 10; account.changeAmount = 10; account.createDate = DateTime.Now; account.method = MemberAccountModel.METHOD_ACCOUNT_CREATE; account.remark=string.Format("帐号创建成功,获得奖励{0}元",10); account.setPk(account.createPk()); re = BaseZdBiz.Save(account); } return re; }
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; }
public JsResultObject rebateReward(MemberModel member, int rebateAmount, string remark) { JsResultObject re = new JsResultObject(); MemberAccountModel account = getCurrMemberAccount(member); if (member.rebateInd != BaseModel.IND_Y) { re.code = JsResultObject.CODE_ERROR; re.msg = string.Format("当前用户尚未申请返还", account.newAmount, rebateAmount); return re; } else if (account.newAmount < rebateAmount) { re.code = JsResultObject.CODE_ERROR; re.msg = string.Format("当前用户帐户奖励{0},小于{1},返还无效", account.newAmount, rebateAmount); return re; } MemberAccountModel newAccount = new MemberAccountModel(); newAccount.createDate = DateTime.Now; newAccount.oldAmount = account.newAmount; newAccount.newAmount = account.newAmount - rebateAmount; newAccount.remark = remark; newAccount.memberFk = member.id; newAccount.method = MemberAccountModel.METHOD_REWARD_REBATE; newAccount.setPk(newAccount.createPk()); newAccount.remark = string.Format("成功为手机号码{0}充值{1}元",member.rebateMoblie, rebateAmount); re = BaseZdBiz.Save(newAccount); if (re.code == JsResultObject.CODE_SUCCESS) { MemberRewardLogModel rewardLog = new MemberRewardLogModel(); rewardLog.createDate = DateTime.Now; rewardLog.amount = rebateAmount; rewardLog.moblie = member.rebateMoblie; rewardLog.method = MemberAccountModel.METHOD_REWARD_REBATE; rewardLog.remark = string.Format("成功为手机号码{0}充值{1}元", member.rebateMoblie, rebateAmount); rewardLog.status = BaseModel.STATUS_ACTIVATE; rewardLog.memberFk = member.id; rewardLog.setPk(rewardLog.createPk()); re = BaseZdBiz.Save(rewardLog); } return re; }