public decimal getDeskPrice(Desk desk, int desks, ShippingSpeed days) { // Make the desk structure DeskStruct = desk; // Get our prices shippingSpeedAssignment = initRushPrices(RushPricesPath); // Base price to add to decimal total = 200.0M; //Add large-size cost // Desktop Surface Area > 1000 in(2) $1 per in(2) int area = DeskStruct.DeskWidth * DeskStruct.DeskDepth; if (area > 1000) { total += area - 1000; } // Add cost of surface material total += getSurfacePrice(); // Add drawers cost total += DeskStruct.NumberOfDrawers * 50; // Add rush cost total += getRushPrice(desks, days); // Calculate for number of desks total *= desks; return(total); }
private int getRushPrice(int desks, ShippingSpeed rushDays) { switch (rushDays) { // 3 day rush case ShippingSpeed.Three_day: //Small number of desks if (desks < 1000) { return(shippingSpeedAssignment[0, 0]); } //Medium number of desks else if (desks < 2000) { return(shippingSpeedAssignment[0, 1]); } // High number of desks else { return(shippingSpeedAssignment[0, 2]); } // 5 day rush case ShippingSpeed.Five_day: if (desks < 1000) { return(shippingSpeedAssignment[1, 0]); } else if (desks < 2000) { return(shippingSpeedAssignment[1, 1]); } else { return(shippingSpeedAssignment[1, 2]); } // 7 day rush case ShippingSpeed.Seven_day: if (desks < 1000) { return(shippingSpeedAssignment[2, 0]); } else if (desks < 2000) { return(shippingSpeedAssignment[2, 1]); } else { return(shippingSpeedAssignment[2, 2]); } // No rush default: return(0); } }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } DeskQuote = await _context.DeskQuote.FirstOrDefaultAsync(m => m.ID == id); Desk = await _context.Desk.FirstOrDefaultAsync(m => m.ID == DeskQuote.Desk); Materials = await _context.Materials.FirstOrDefaultAsync(m => m.ID == Desk.Materials); ShippingSpeed = await _context.ShippingSpeed.FirstOrDefaultAsync(m => m.ID == DeskQuote.ShippingSpeed); if (DeskQuote == null) { return(NotFound()); } return(Page()); }