public ShowSuggestionsMade ComputePrices(PricingMatrix pricingMatrix) { var(firstCatWithPrice, secondCatWithPrice, thirdCatWithPrice, mixedCatWithPrice) = GetPricedSuggestions(pricingMatrix); return(new ShowSuggestionsMade(ShowId, PartyRequested, firstCatWithPrice, secondCatWithPrice, thirdCatWithPrice, mixedCatWithPrice)); }
public static PricingMatrix GeneratePricingMatrix(Setting objSetting, Double price) { Price[] pricelst = new Price[1]; Pricing[] Pricinglst = new Pricing[1]; PricingMatrix PricingMatrixobj = new PricingMatrix(); RecordRef Currency = new RecordRef(); Currency.internalId = objSetting.Currency_Netsuite_Id.ToString(); //Currency.typeSpecified = true; // Currency.type = RecordType.account; //for (int i = 0; i < 5; i++) //{ RecordRef PriceLevel = new RecordRef(); PriceLevel.internalId = "1";//objSetting.Price_Level_Netsuite_Id.ToString(); PriceLevel.typeSpecified = true; PriceLevel.type = RecordType.priceLevel; Price objprice = new Price(); objprice.value = price; objprice.quantity = 0;//0 for item,1 for assembly objprice.quantitySpecified = true; objprice.valueSpecified = true; pricelst[0] = objprice; Pricing objPricing = new Pricing(); objPricing.currency = Currency; objPricing.priceLevel = PriceLevel; objPricing.priceList = pricelst; objPricing.discount = double.NaN;//0; objPricing.discountSpecified = false; Pricinglst[0] = objPricing; //} //NewItemObject.taxSchedule = Tax_Schedule; //PricingMatrixobj.pricing = new Pricing(); PricingMatrixobj.pricing = Pricinglst; //PricingMatrixobj.replaceAll = false; return(PricingMatrixobj); }
public ShowSuggestion ComputePrice(PricingMatrix pricingMatrix) { var totalPrice = 0; foreach (var seat in _seats) { var seatPrice = ComputeUnitaryPrice(seat.PricingCategory, pricingMatrix); totalPrice += seatPrice; } return(new ShowSuggestion(ShowId, Party, PricingCategoryRequested, _seats, totalPrice)); }
private static int ComputeUnitaryPrice(PricingCategory pricingCategory, PricingMatrix pricingMatrix) { switch (pricingCategory) { case PricingCategory.First: return(pricingMatrix.Cat1Price); case PricingCategory.Second: return(pricingMatrix.Cat2Price); case PricingCategory.Third: return(pricingMatrix.Cat3Price); default: throw new ArgumentOutOfRangeException(nameof(pricingCategory), pricingCategory, null); } }
GetPricedSuggestions(PricingMatrix pricingMatrix) { var firstCatWithPrice = new List <ShowSuggestion>(); foreach (var showSuggestion in SuggestionsForFirstCategory) { var suggestionWithPrice = showSuggestion.ComputePrice(pricingMatrix); firstCatWithPrice.Add(suggestionWithPrice); } var secondCatWithPrice = new List <ShowSuggestion>(); foreach (var showSuggestion in SuggestionsForSecondCategory) { var suggestionWithPrice = showSuggestion.ComputePrice(pricingMatrix); secondCatWithPrice.Add(suggestionWithPrice); } var thirdCatWithPrice = new List <ShowSuggestion>(); foreach (var showSuggestion in SuggestionsForThirdCategory) { var suggestionWithPrice = showSuggestion.ComputePrice(pricingMatrix); thirdCatWithPrice.Add(suggestionWithPrice); } var mixedCatWithPrice = new List <ShowSuggestion>(); foreach (var showSuggestion in SuggestionsForMixedCategory) { var suggestionWithPrice = showSuggestion.ComputePrice(pricingMatrix); mixedCatWithPrice.Add(suggestionWithPrice); } return(firstCatWithPrice, secondCatWithPrice, thirdCatWithPrice, mixedCatWithPrice); }
private void setup_matrixes() { matrix_epost = matrix_epost == null ? matrix_epost = new PricingMatrix(EP, connection) : matrix_epost; matrix_apost = matrix_apost == null ? new PricingMatrix(AP, connection) : matrix_apost; matrix_hunter = matrix_hunter == null ? new PricingMatrix(HE, connection) : matrix_hunter; matrix_toll = matrix_toll == null ? new TOLLPricingMatrix(TL, connection) : matrix_toll; }