コード例 #1
0
#pragma warning restore 649

        public WishListItem(
            WishListItemType wishListItemType,
            decimal baseItemCost,
            string vendorName     = null,
            LocationType location = LocationType.Local,
            int approachNumber    = 0,
            DateTime?startDate    = null,
            DateTime?endDate      = null,
            SideCosts sideCosts   = null,
            IDictionary <string, decimal> vendorNamesWithDiscounts = null)
        {
            WishListItemType     = wishListItemType;
            BaseItemCost         = baseItemCost;
            VendorName           = vendorName;
            Location             = location;
            ApproachNumber       = approachNumber;
            StartDate            = startDate;
            EndDate              = endDate;
            SideCosts            = sideCosts ?? new SideCosts();
            VendorsWithDiscounts = vendorNamesWithDiscounts ?? new Dictionary <string, decimal>();
        }
コード例 #2
0
        internal static WishListItemCostCalculationStrategy CreateStrategy(WishListItemType itemType)
        {
            switch (itemType)
            {
            case WishListItemType.ELearningLicense:
                return(new ELearningLicenseCostCalculationStrategy());

            case WishListItemType.EducationMaterial:
                return(new EducationMaterialCostCalculationStrategy());

            case WishListItemType.Exam:
                return(new ExamCostCalculationStrategy());

            case WishListItemType.Conference:
                return(new ConferenceCostCalculationStrategy());

            case WishListItemType.Training:
                return(new TrainingCostCalculationStrategy());

            default:
                throw new ArgumentOutOfRangeException(nameof(itemType), itemType,
                                                      "Unrecognized wish list item type.");
            }
        }