예제 #1
0
 /// <summary>
 /// 订单生成使用券/充值修改账户余额
 /// </summary>
 /// <param name="recordEntity">订单记录</param>
 private void PaySuccessAfter(Bis_Record recordEntity)
 {
     try
     {
         if (recordEntity.Type == (int)Common.Order_Type.Consume)
         {
             // 消费成功,生成使用券
             CouponService CPSVC    = new CouponService();
             var           filter   = string.Format(@" RecordID='{0}' AND UserID='{1}'", recordEntity.RecordID, recordEntity.UserID);
             var           cpEntity = CPSVC.SelectByFilter(filter).FirstOrDefault();
             if (cpEntity == null)
             {
                 cpEntity = new Bis_Coupon
                 {
                     ID         = Utils.CreateGUID(),
                     Coupon     = Utils.GetCoupon(Convert.ToInt64(Utils.GetRandomNum())),
                     ExpireDate = DateTime.Now.AddMonths(1),
                     RecordID   = recordEntity.RecordID,
                     Status     = (int)Common.Coupon_Status.NotUse,
                     UserID     = recordEntity.UserID,
                 };
                 CPSVC.Insert(cpEntity);
             }
         }
         else
         {
             // 充值成功,充值到余额
             Service.System.UserAccountService UASVC = new UserAccountService();
             var filter   = string.Format(@" UserID='{0}'", recordEntity.UserID);
             var uaEntity = UASVC.SelectByFilter(filter).FirstOrDefault();
             if (uaEntity != null)
             {
                 uaEntity.Balance += recordEntity.Amount;
                 UASVC.Update(uaEntity);
             }
         }
     }
     catch (Exception ex)
     {
         Common.MYLog.Error("订单生成使用券/充值修改账户余额:" + Common.SessionTools.UserName, ("订单编号:" + recordEntity.OrderNo + " " + ex.ToString()));
     }
 }
예제 #2
0
 private void RefundSuccessAfter(Bis_Record recordEntity)
 {
     try
     {
         if (recordEntity.Type == (int)Common.Order_Type.Consume)
         {
             // 消费成功,生成使用券
             CouponService CPSVC    = new CouponService();
             var           filter   = string.Format(@" RecordID='{0}' AND UserID='{1}'", recordEntity.RecordID, recordEntity.UserID);
             var           cpEntity = CPSVC.SelectByFilter(filter).FirstOrDefault();
             if (cpEntity != null)
             {
                 cpEntity.Status = (int)Common.Coupon_Status.Used;
                 CPSVC.Update(cpEntity);
             }
         }
     }
     catch (Exception ex)
     {
         Common.MYLog.Error("修改使用券退款状态:" + Common.SessionTools.UserName, ("订单编号:" + recordEntity.OrderNo + " " + ex.ToString()));
     }
 }
예제 #3
0
        /// <summary>
        /// 提交射击分数
        /// </summary>
        /// <param name="OrderID"></param>
        /// <param name="Score"></param>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public object SubmitScore(string OrderID, string Score, string UserID)
        {
            try
            {
                var rsvc         = new RecordService();
                var cpsvc        = new CouponService();
                var recordEntity = rsvc.SelectByFilter(string.Format(@" RecordID='{0}' AND UserID='{1}' ", OrderID, UserID)).FirstOrDefault();
                var couponEntity = cpsvc.SelectByFilter(string.Format(@" RecordID='{0}' AND UserID='{1}' ", OrderID, UserID)).FirstOrDefault();

                // 判断订单是否存在,且订单状态是否为已支付
                if (recordEntity != null && recordEntity.Status == (int)Common.Order_Status.Payed)
                {
                    var rankEntity = new Bis_UserRank
                    {
                        ID         = Utils.CreateGUID(),
                        CreateTime = DateTime.Now,
                        Score      = Convert.ToDecimal(Score),
                        UserID     = UserID
                    };

                    if (base.Insert(rankEntity))
                    {
                        recordEntity.Status = (int)Common.Order_Status.End;
                        couponEntity.Status = (int)Common.Coupon_Status.Used;
                        if (rsvc.Update(recordEntity) && cpsvc.Update(couponEntity))
                        {
                            return(Common.MessageRes.OperateSuccess.SetResult("SUCCESS"));
                        }
                    }
                }
                return(Common.MessageRes.OperateFailed.SetResult(null));
            }
            catch (Exception ex)
            {
                Common.MYLog.Error("提交射击分数:" + Common.SessionTools.UserName, ex.ToString());
                return((Common.MessageRes.OperateException + ex.ToString()).SetResult(null));
            }
        }