//Get the Shipping Price private decimal getShippingPrice() { /* * Shipping Price Array Visualization Default Price * |Shipping | Size of Desk (in^2) | |---------|-----------------------------------| | | 0-1000 | 1001-2000 | 2001-inf | |---------|-----------+-----------|-----------| | 3 Day | $ 60 | $ 70 | $ 80 | | 5 Day | $ 40 | $ 50 | $ 60 | | 7 Day | $ 30 | $ 35 | $ 40 | */ int[,] shippingPrices; //call the methodo to read the file var shippingFilename = @"rushFile.txt"; shippingPrices = ReadFileHelper.UpdateRushPrices(shippingFilename); int rushIndex = (int)Shipping; int sizeIndex = (int)Desk.SurfaceArea > 2000 ? 2 : ((int)(Desk.SurfaceArea - 1) / 1000); return(shippingPrices[rushIndex, sizeIndex]); }
/// <summary> /// Handle to save the quote data to the file /// </summary> private void AddQuoteToFile() { var quotesFile = @"quotes.json"; // Get list of existing quotes (if any) List <DeskQuote> deskQuotes = ReadFileHelper.GetQuotesFromFile(quotesFile); // Add new quote deskQuotes.Add(quote); // Save quotes to file saveQuotesToFile(quotesFile, deskQuotes); }