public MainMenuForm() { InitializeComponent(); addQuote = new AddQuote(this); searchAllQuotes = new SearchAllQuotes(this); viewAllQuotes = new ViewAllQuotes(this); this.mainMenuForm = this; }
public void calculatePrice(Desk desk, AddQuote addQuote) { int basePrice = 200; int deskSurface = desk.getDeskDepth() * desk.getDeskWidth(); int drawersPrice = desk.getDrawers() * 50; int rushDays = this.getRushDays(); int extraSurfacePrice = 0; int rushDaysPrice = 0; int materialPrice = 0; if (deskSurface > 1000) { extraSurfacePrice = deskSurface - 1000; } switch (addQuote.getMaterial()) { case "Oak": materialPrice = (int)Desk.Materials.Oak; break; case "Laminate": materialPrice = (int)Desk.Materials.Laminate; break; case "Pine": materialPrice = (int)Desk.Materials.Pine; break; case "Rossewood": materialPrice = (int)Desk.Materials.Rossewood; break; case "Veneer": materialPrice = (int)Desk.Materials.Veneer; break; default: materialPrice = 0; break; } if (deskSurface > 0 && deskSurface < 1000) { switch (rushDays) { case 3: rushDaysPrice = 60; break; case 5: rushDaysPrice = 40; break; case 7: rushDaysPrice = 30; break; default: rushDaysPrice = 0; break; } } else if (deskSurface >= 1000 && deskSurface <= 2000) { switch (rushDays) { case 3: rushDaysPrice = 70; break; case 5: rushDaysPrice = 50; break; case 7: rushDaysPrice = 35; break; default: rushDaysPrice = 0; break; } } else { switch (rushDays) { case 3: rushDaysPrice = 80; break; case 5: rushDaysPrice = 60; break; case 7: rushDaysPrice = 40; break; default: rushDaysPrice = 0; break; } } this.setPrice(basePrice + extraSurfacePrice + drawersPrice + rushDaysPrice + materialPrice); }