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())); } }
/// <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)); } }