Example #1
0
        // Create specification
        public int create(int weight, int height, int width, int length)
        {
            // Establish models
            SpecificationModel specModel = new SpecificationModel();

            // Holds the new specification
            Specification newSpec = new Specification();

            // Stored details for the specification
            newSpec.Weight = weight;
            newSpec.Height = height;
            newSpec.Width = width;
            newSpec.Length = length;

            // Adds the object to the database
            int specificationID = specModel.NewSpecification(newSpec);

            // Return the specificationID
            return specificationID;
        }
Example #2
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;
        }