/// <summary> /// 更新用户经验积分并记录日志 /// </summary> /// <param name="customerSysNo">用户编号</param> /// <param name="point">调整经验积分数(正数:增加 负数:减少)</param> /// <param name="experiencePointLogModel">经验积分日志实体</param> /// <param name="availablePointLogModel">可用积分日志实体</param> /// <returns></returns> /// <remarks>2013-07-11 黄波 创建</remarks> public override void AdjustExperiencePoint(int customerSysNo, int point, CrExperiencePointLog experiencePointLogModel, CrAvailablePointLog availablePointLogModel) { using (var context = Context.UseSharedConnection(true)) { context.Insert <Model.CrAvailablePointLog>("CrAvailablePointLog", availablePointLogModel) .AutoMap(o => o.SysNo) .Execute(); context.Insert <Model.CrExperiencePointLog>("CrExperiencePointLog", experiencePointLogModel) .AutoMap(o => o.SysNo) .Execute(); context.Sql("update CrCustomer set ExperiencePoint=ExperiencePoint+@ExperiencePoint,AvailablePoint=AvailablePoint+@AvailablePoint where sysno=@sysno") .Parameter("ExperiencePoint", point) .Parameter("AvailablePoint", point) .Parameter("sysno", customerSysNo) .Execute(); } }
/// <summary> /// 调整经验积分 /// </summary> /// <param name="customer">会员信息</param> /// <param name="userSysNo">系统用户编号</param> /// <param name="changeType">经验积分变更类型</param> /// <param name="point">积分数量(正数:增加;负数:减少)</param> /// <param name="description">变更说明</param> /// <param name="transactionSysNo">事务编号</param> /// <returns>void</returns> /// <remarks>2013-07-10 黄波 创建</remarks> private void UpdateExperiencePoint(CrCustomer customer, int userSysNo, CustomerStatus.经验积分变更类型 changeType, int point, string description, string transactionSysNo) { var customerSysNo = customer.SysNo; var nowDate = DateTime.Now; var experiencePointCahngeType = (int)changeType; var availablePointChangeType = 0; if (experiencePointCahngeType == (int)CustomerStatus.经验积分变更类型.参与活动) { availablePointChangeType = (int)CustomerStatus.可用积分变更类型.参与活动; } else if (experiencePointCahngeType == (int)CustomerStatus.经验积分变更类型.过期调整) { availablePointChangeType = (int)CustomerStatus.可用积分变更类型.过期调整; } else if (experiencePointCahngeType == (int)CustomerStatus.经验积分变更类型.积分兑换) { availablePointChangeType = (int)CustomerStatus.可用积分变更类型.积分兑换; } else if (experiencePointCahngeType == (int)CustomerStatus.经验积分变更类型.交易变更) { availablePointChangeType = (int)CustomerStatus.可用积分变更类型.交易变更; } else if (experiencePointCahngeType == (int)CustomerStatus.经验积分变更类型.客服调整) { availablePointChangeType = (int)CustomerStatus.可用积分变更类型.客服调整; } else { availablePointChangeType = (int)CustomerStatus.可用积分变更类型.系统赠送; } var experiencePointLogmodel = new CrExperiencePointLog { TransactionSysNo = transactionSysNo, CustomerSysNo = customerSysNo, ChangeDate = nowDate, CreatedBy = userSysNo, CreatedDate = nowDate, Surplus = customer.ExperiencePoint + point, PointType = experiencePointCahngeType, PointDescription = description, Increased = point > 0 ? point : 0, Decreased = point > 0 ? 0 : point }; var availablePointLogModel = new CrAvailablePointLog { TransactionSysNo = transactionSysNo, CustomerSysNo = customerSysNo, ChangeDate = nowDate, CreatedBy = userSysNo, CreatedDate = nowDate, Surplus = customer.AvailablePoint + point, PointType = availablePointChangeType, PointDescription = description, Increased = point > 0 ? point : 0, Decreased = point > 0 ? 0 : point }; IPointDao.Instance.AdjustExperiencePoint(customerSysNo, point, experiencePointLogmodel, availablePointLogModel); }
/// <summary> /// 更新用户经验积分并记录日志 /// </summary> /// <param name="customerSysNo">用户编号</param> /// <param name="point">调整经验积分数(正数:增加 负数:减少)</param> /// <param name="experiencePointLogModel">经验积分日志实体</param> /// <param name="availablePointLogModel">可用积分日志实体</param> /// <returns>void</returns> /// <remarks>2013-07-11 黄波 创建</remarks> public abstract void AdjustExperiencePoint(int customerSysNo, int point, CrExperiencePointLog experiencePointLogModel, CrAvailablePointLog availablePointLogModel);
/// <summary> /// 插入经验积分日志 /// </summary> /// <param name="model">经验积分信息</param> /// <returns>创建结果</returns> /// <remarks>2013-07-10 黄波 添加</remarks> public abstract bool InsertCrExperiencePointLogItem(CrExperiencePointLog model);