Esempio n. 1
0
 public StoreFront(Address locationAddress)
 {
     LocationAddress = locationAddress;
     routes = new List<Route>();
     packages = new List<Package>();
     //this.deliveryVehicles = new List<DeliveryVehicle>();
     //this.deliveryVehicles.AddRange(deliveryVehicles);
 }
Esempio n. 2
0
        public StoreFront(string id, Address locationAddress, DeliveryVehicle[] deliveryVehicles)
        {
            Id = id;
            LocationAddress = locationAddress;

            packages = new List<Package>();
            this.deliveryVehicles = new List<DeliveryVehicle>();
            this.deliveryVehicles.AddRange(deliveryVehicles);
        }
Esempio n. 3
0
 public Package(int weight, float[] size, int mailService, bool fragile, bool irregular, bool perishable, Address destination, Address source)
 {
     Weight = weight;
     Size = size;
     MaileService = mailService;
     Fragile = fragile;
     Irregular = irregular;
     Perishable = perishable;
     Destination = destination;
     Source = source;
 }
Esempio n. 4
0
        private void acceptButton_Click(object sender, EventArgs e)
        {
            float length = 0;
            float width = 0;
            float height = 0;
            float insuranceAmount = 0;
            int zip = 0;

            if (float.TryParse(lengthTextbox.Text, out length) && float.TryParse(widthTextBox.Text, out width) && float.TryParse(heightTextBox.Text, out height) &&
                ( insuranceCheckBox.Checked == float.TryParse(insuranceAmountTextBox.Text, out insuranceAmount)) && destinationZipTextBox.Text.Length == 5 && int.TryParse(destinationZipTextBox.Text, out zip) &&
                sourceZipTextBox.Text.Length == 5 && int.TryParse(sourceZipTextBox.Text, out zip) && (sourceStreetTextbox.Text != "") && (destinationAddresseeTextBox.Text != "") &&
                (sourceStreetTextbox.Text != "") && (destinationStreetTextBox.Text != ""))
            {
                //TODO: Add error checking: empty fields, non-numeric, etc...
                Address source = new Address(sourceAddresseeTextBox.Text, sourceStreetTextbox.Text, sourceZipTextBox.Text);
                Address destination = new Address(destinationAddresseeTextBox.Text, destinationStreetTextBox.Text, destinationZipTextBox.Text);
                float[] lhw = { length, width, height};
                Package p = shippingSystem.addPackage(weightClassComboBox.SelectedIndex, lhw, (serviceTypeComboBox.SelectedIndex == 0) ? Package.SERVICE_TYPE.Economy : Package.SERVICE_TYPE.Air, fragileCheckBox.Checked, irregularCheckBox.Checked, perishableCheckBox.Checked, source, destination);
                if (p != null)
                {
                    (parentForm as StoreFrontForm).updatePackageList();

                    PrintDialog pd = new PrintDialog();
                    PrinterSettings ps = new PrinterSettings();
                    pd.PrinterSettings = ps;
                    DialogResult dr = pd.ShowDialog();

                    if (dr == DialogResult.OK)
                    {
                        System.Drawing.Text.PrivateFontCollection privateFonts = new System.Drawing.Text.PrivateFontCollection();
                        privateFonts.AddFontFile("free3of9.ttf");
                        Font font = new Font(privateFonts.Families[0], 64);

                        PCPrint printer = new PCPrint(p.TrackingNumber);
                        printer.PrinterSettings.PrinterName = pd.PrinterSettings.PrinterName;
                        printer.PrinterFont = font;
                        printer.Print();
                    }

                    Close();
                }
                else
                {
                    MessageBox.Show("There was a problem creating this package. \r\nMaybe the destination zipcode is not in the system.");
                }
            }
            else
            {
                MessageBox.Show("Invalid input");
            }
        }
Esempio n. 5
0
        public Warehouse(Address a, int volumeCapacity)
        {
            VolumeCapacity = volumeCapacity;
            LocationAddress = a;
            //this.zipCodesServed = new List<int>();
            //this.transports = new List<Transport>();
            //this.deliveryVehicles = new List<DeliveryVehicle>();

            routes = new List<Route>();
            packages = new List<Package>();
            //this.zipCodesServed.AddRange(zipCodesServed);
            //this.transports.AddRange(transports);
            //this.deliveryVehicles.AddRange(deliveryVehicles);
        }
 public bool addWarehouse(string id, string streetAddress, string zipcode, int volumeCapacity)
 {
     Address a = new Address(id, streetAddress, zipcode);
     Warehouse sf = new Warehouse(a, volumeCapacity);
     if (locations.Contains(sf))
         return false;
     locations.Add(sf);
     return true;
 }
 public bool addStoreFront(string id, string streetAddress, string zipcode)
 {
     Address a = new Address(id, streetAddress, zipcode);
     StoreFront sf = new StoreFront(a);
     if (locations.Contains(sf))
         return false;
     locations.Add(sf);
     return true;
 }
        public Package addPackage(int weight, float[] size, Package.SERVICE_TYPE mailService, bool fragile, bool irregular, bool perishable, Address source, Address destination)
        {
            Location destinationLocation = determineAbroad(destination.Zip);
            if (destinationLocation == null)
                return null;

            StoreFront sf = (LoggedInEmployee as AcceptanceEmployee).CurrentStoreFront;
            int travelTime = (mailService == Package.SERVICE_TYPE.Economy) ? determineGroundTravelTime(sf, destinationLocation) : determineAirTravelTime(sf, destinationLocation);

            Package p = new Package(weight, size, mailService, fragile, irregular, perishable, source, destination, sf, destinationLocation, travelTime);
            sf.addPackage(p);
            packages.Add(p);
            p.takeSnapshot("Package Accepted", sf);
            return p;
        }
 public bool addAbroad(string id, string streetAddress, string zipcode, string[] zipcodesServed)
 {
     Address a = new Address(id, streetAddress, zipcode);
     Abroad sf = new Abroad(a, zipcodesServed);
     if (locations.Contains(sf))
         return false;
     locations.Add(sf);
     return true;
 }
Esempio n. 10
0
 public Abroad(Address locationAddress, string[] zipCodes)
 {
     LocationAddress = locationAddress;
     LocationAddress.StreetAddress = zipCodes[0];
     ZipCodes = zipCodes;
 }
Esempio n. 11
0
 private int generateTrackingNumber(Address sourceAddress, Address destination, DateTime acceptedDate)
 {
     //TODO:
     return 1;
 }