/// <summary> /// 申请退改签 /// </summary> internal BaseApplyform Apply(ApplyformView applyformView, Guid oemId) { var checker = ApplyChecker.GetChecker(this, applyformView); checker.Execute(); var applyform = BaseApplyform.NewApplyform(this, applyformView, oemId); this._applyformLoader.AppendData(applyform); return(applyform); }
private void setPNRPair(ApplyformView applyformView) { if (applyformView is BalanceRefundApplyView) { OriginalPNR = applyformView.PNR; return; } if (PNRPair.IsNullOrEmpty(applyformView.PNR)) { throw new CustomException("缺少编码信息 "); } var pnrInfo = this.Order.PNRInfos.FirstOrDefault(item => item.IsSamePNR(applyformView.PNR)); if (pnrInfo == null) { throw new NotFoundException("原订单中不存在编码信息。" + applyformView.PNR.ToString()); } this.OriginalPNR = pnrInfo.Code; }
internal static BaseApplyform NewApplyform(Order order, ApplyformView applyformView, Guid oemId) { if (applyformView is RefundOrScrapApplyformView) { return(RefundOrScrapApplyform.NewRefundOrScrapApplyform(order, applyformView as RefundOrScrapApplyformView, oemId)); } else if (applyformView is PostponeApplyformView) { return(new PostponeApplyform(order, applyformView as PostponeApplyformView)); } else if (applyformView is UpgradeApplyformView) { return(new UpgradeApplyform(applyformView as UpgradeApplyformView, order)); } else if (applyformView is BalanceRefundApplyView) { return(new BalanceRefundApplyform(order, applyformView as BalanceRefundApplyView)); } throw new ChinaPay.Core.CustomException("未知申请类型"); }
private void setPassengers(ApplyformView applyformView) { if (applyformView.Passengers != null) { var pnrInfo = this.Order.PNRInfos.First(item => item.IsSamePNR(applyformView.PNR)); foreach (var passenger in applyformView.Passengers) { var originalPassenger = pnrInfo.Passengers.FirstOrDefault(item => item.Id == passenger); if (originalPassenger == null) { throw new NotFoundException("原编码中不存在乘机人信息。"); } this.AddPassenger(originalPassenger); } if (!this.Passengers.Any()) { throw new CustomException("缺少乘机人信息"); } } }
protected BaseApplyform(Order order, ApplyformView applyformView) { this.OrderId = order.Id; this._passengers = new List <Passenger>(); initLazyLoaders(); this._orderLoader.SetData(order); this.Id = Sequence.SequenceService.GenerateTicketApplyformId(); setPNRPair(applyformView); setPassengers(applyformView); this.ProductType = order.Product.ProductType; this.PurchaserId = order.Purchaser.CompanyId; this.OEMID = order.OEMID; this.PurchaserName = order.Purchaser.Name; this.ProviderId = order.Provider.CompanyId; this.ProviderName = order.Provider.Name; this.ApplyRemark = applyformView.Reason; this.IsInterior = order.IsInterior; this.AppliedTime = DateTime.Now; }
public static ApplyChecker GetChecker(Order order, ApplyformView applyformView) { if (applyformView is RefundApplyformView) { return(new RefundApplyChecker(order, applyformView as RefundApplyformView)); } else if (applyformView is ScrapApplyformView) { return(new ScrapApplyChecker(order, applyformView as ScrapApplyformView)); } else if (applyformView is PostponeApplyformView) { return(new PostponeApplyChecker(order, applyformView as PostponeApplyformView)); } else if (applyformView is UpgradeApplyformView) { return(new UpgradeApplyChecker(order, applyformView as UpgradeApplyformView)); } else if (applyformView is BalanceRefundApplyView) { return(new BalanceRefundApplyChecker(order, applyformView as BalanceRefundApplyView)); } throw new NotSupportedException(); }
protected ApplyChecker(Order order, ApplyformView applyformView) { this.Order = order; this.Applyform = applyformView; }