/// <summary> /// 更新用户可用积分并记录日志 /// </summary> /// <param name="customerSysNo">用户编号</param> /// <param name="point">积分数</param> /// <param name="model">可用积分日志实体</param> /// <returns></returns> /// <remarks>2013-10-30 黄波 创建</remarks> public override void UpdateAvailablePoint(int customerSysNo, int point, CrAvailablePointLog model) { using (var context = Context.UseSharedConnection(true)) { context.Insert <Model.CrAvailablePointLog>("CrAvailablePointLog", model) .AutoMap(o => o.SysNo) .Execute(); context.Sql("update CrCustomer set AvailablePoint=AvailablePoint+@AvailablePoint where sysno=@sysNo") .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> /// <remarks>2013-10-31 黄波 创建</remarks> public void UpdateAvailablePoint(CrCustomer customer, int userSysNo, CustomerStatus.可用积分变更类型 changeType, int point, string description, string transactionSysNo) { if (string.IsNullOrEmpty(description)) { description = "积分兑换"; } var nowDate = DateTime.Now; var crAvailablePointLogmodel = new CrAvailablePointLog { TransactionSysNo = transactionSysNo, CustomerSysNo = customer.SysNo, ChangeDate = nowDate, CreatedBy = userSysNo, CreatedDate = nowDate, Surplus = customer.AvailablePoint + point, PointType = (int)changeType, PointDescription = description,//"积分兑换", Increased = point > 0 ? point : 0, Decreased = point > 0 ? 0 : point }; IPointDao.Instance.UpdateAvailablePoint(customer.SysNo, point, crAvailablePointLogmodel); }
/// <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="model">可用积分日志实体</param> /// <returns>void</returns> /// <remarks>2013-10-30 黄波 创建</remarks> public abstract void UpdateAvailablePoint(int customerSysNo, int point, CrAvailablePointLog model);
/// <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);