예제 #1
0
        // Calculates the base cost of the package based on dimensions / weight
        private int calcBaseCost(Package thisPackage)
        {
            // In pence
            int runningCost = 0;

            SpecificationModel specModel = new SpecificationModel();

            // Iterates through the packages in the list
            Specification thisSpec = specModel.SearchSpecification(thisPackage.SpecificationID);

            // Works out delivery band
            if (thisSpec.Length <= 42 && thisSpec.Width <= 34 && thisSpec.Height <= 27 && thisSpec.Weight <= 100)
            {
                runningCost += 1500;
            }
            else if (thisSpec.Length <= 50 && thisSpec.Width <= 45 && thisSpec.Height <= 34 && thisSpec.Weight <= 250)
            {
                runningCost += 2100;
            }
            else if (thisSpec.Length <= 60 && thisSpec.Width <= 54 && thisSpec.Height <= 41 && thisSpec.Weight <= 400)
            {
                runningCost += 3000;
            }
            else if (thisSpec.Length <= 96 && thisSpec.Width <= 15 && thisSpec.Height <= 15)
            {
                runningCost += 1750;
            }
            else // Catch
            {
                // Outwith package band fee
                runningCost += 3500;
            }

            // Returns the collective running cost
            return runningCost;
        }