Ejemplo n.º 1
0
        internal static ProductInfo GetProductInfo(PolicyMatch.MatchedPolicy policy)
        {
            ProductInfo productInfo = null;

            if (policy.PolicyType == PolicyType.NormalDefault || policy.PolicyType == PolicyType.BargainDefault || policy.PolicyType == PolicyType.OwnerDefault ||
                (policy.PolicyType == PolicyType.Normal && policy.OriginalPolicy == null && policy.OriginalExternalPolicy == null))
            {
                return(new CommonProductInfo {
                    OfficeNo = policy.OfficeNumber,
                    //NeedAuth = policy.NeedAUTH,
                    ProductType = policy.PolicyType == PolicyType.BargainDefault ? ProductType.Promotion : ProductType.General,
                    RequireChangePNR = false,
                    ETDZMode = ETDZMode.Manual,
                    TicketType = TicketType.BSP,
                    Id = policy.Id,
                    Remark = string.Empty,
                    Condition = string.Empty,
                    IsDefaultPolicy = policy.PolicyType == PolicyType.NormalDefault || policy.PolicyType == PolicyType.BargainDefault || policy.PolicyType == PolicyType.OwnerDefault,
                    RefundAndReschedulingProvision = new RefundAndReschedulingProvision()
                });
            }
            if (policy.PolicyType == PolicyType.Special)
            {
                var specialPolicy = policy.OriginalPolicy as SpecialPolicyInfo;
                productInfo = new SpeicalProductInfo {
                    RequireConfirm     = specialPolicy.ConfirmResource,
                    SpeicalProductType = specialPolicy.Type,
                    ProductType        = ProductType.Special,
                    OfficeNo           = specialPolicy.OfficeCode,
                    //NeedAuth = policy.NeedAUTH
                };
            }
            else if (policy.IsExternal)
            {
                productInfo = new CommonProductInfo {
                    ProductType      = GetProductType(policy),
                    RequireChangePNR = policy.OriginalExternalPolicy.RequireChangePNR,
                    ETDZMode         = ETDZMode.Manual
                };
            }
            else
            {
                var generalPolicy = policy.OriginalPolicy as IGeneralPolicy;
                productInfo = new CommonProductInfo {
                    ProductType      = GetProductType(policy),
                    RequireChangePNR = generalPolicy.ChangePNR,
                    ETDZMode         = generalPolicy.AutoPrint ? ETDZMode.Auto : ETDZMode.Manual
                };
            }
            if (policy.IsExternal)
            {
                productInfo.Id       = Guid.NewGuid();
                productInfo.OfficeNo = policy.OriginalExternalPolicy.OfficeNo;
                //productInfo.NeedAuth = policy.OriginalExternalPolicy.RequireAuth;
                productInfo.TicketType = policy.OriginalExternalPolicy.TicketType;
                productInfo.Remark     = policy.OriginalExternalPolicy.Remark;
                productInfo.Condition  = policy.OriginalExternalPolicy.Condition;
            }
            else
            {
                productInfo.Id       = policy.OriginalPolicy.Id;
                productInfo.OfficeNo = policy.OriginalPolicy.OfficeCode;
                //productInfo.NeedAuth = policy.OriginalPolicy.NeedAUTH;
                productInfo.TicketType = policy.OriginalPolicy.TicketType;
                productInfo.Remark     = policy.OriginalPolicy.Remark;
                productInfo.Condition  = policy.OriginalPolicy.Condition;
            }
            if (policy.OriginalPolicy is IHasRegulation)
            {
                var regulation = (IHasRegulation)policy.OriginalPolicy;
                productInfo.RefundAndReschedulingProvision = new RefundAndReschedulingProvision()
                {
                    Refund     = regulation.RefundRegulation,
                    Scrap      = regulation.InvalidRegulation,
                    Alteration = regulation.ChangeRegulation,
                    Transfer   = regulation.EndorseRegulation
                };
            }
            else
            {
                productInfo.RefundAndReschedulingProvision = new RefundAndReschedulingProvision();
            }
            return(productInfo);
        }