private bool IsProductMatch(UpgradeProduct product, UpgradeMatchEntity entity)
        {
            if (!IsAgentMatch(product, entity.AgentId))
            {
                return(false);
            }

            if (!product.MatchTripType(entity.TripType))
            {
                return(false);
            }

            if (!product.MatchValidatingCarrier(entity.ValidatingCarrier))
            {
                return(false);
            }

            if (!product.MatchFlightNo(entity.DepartMainFlightNo))
            {
                return(false);
            }

            if (product.DAreas.Count != 0 && !IsAreaMatch(product.DAreas, entity.Origin))
            {
                return(false);
            }

            if (product.AAreas.Count != 0 && !IsAreaMatch(product.AAreas, entity.FirstArrvialCity))
            {
                return(false);
            }

            if (!product.MatchToRanges(entity.DepartDate))
            {
                return(false);
            }

            if (entity.TripType == TripType.RT && !product.MatchBackRanges(entity.ArravialDate))
            {
                return(false);
            }

            if (!product.MatchSalesDate)
            {
                return(false);
            }

            if (!product.MatchSeatClass(entity.DepartMainSegment.SeatClass))
            {
                return(false);
            }

            if (!product.MatchSeatGrade(entity.DepartMainSegment.SeatGrade))
            {
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// 如果产品Id为0,匹配所有自有票台
        /// </summary>
        /// <param name="product"></param>
        /// <param name="agentId"></param>
        /// <returns></returns>
        private bool IsAgentMatch(UpgradeProduct product, int agentId)
        {
            if (product.AgencyId == 0)
            {
                return(AgentCache.IsOwnAgency(agentId));
            }

            return(product.AgencyId == agentId);
        }
        public bool TryGetUpgradeProductById(long id, out UpgradeProduct product)
        {
            product = UpgradeProductCache.GetUpgradeProductById(id);

            if (product == null)
            {
                return(false);
            }

            return(true);
        }