Beispiel #1
0
        public void FindOrdersToDeliver(string filePath)
        {
            if (filePath != null || filePath != string.Empty)
            {
                if (File.Exists(filePath))
                {
                    string[] input = File.ReadAllLines(filePath);

                    OrderCalc calc = new OrderCalc();
                    calc.Distance = Route.Distance((Routes)Enum.Parse(typeof(Routes), input[4]));
                    calc.Quantity = int.Parse(input[5]);
                    calc.producer = (ProductDealers)Enum.Parse(typeof(ProductDealers), input[2]);
                    calc.delivery = (Deliveries)Enum.Parse(typeof(Deliveries), deliveryMethod.Text);
                    if (calc.CapacityCheck())
                    {
                        if (calc.MaxDistance())
                        {
                            if (calc.ValidDestination((Routes)Enum.Parse(typeof(Routes), input[4])))
                            {
                                orderId.Items.Add(input[0]);
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private void fullName_TextChanged(object sender, EventArgs e)
        {
            orderId.Items.Clear();
            orderId.ResetText();

            OrderCalc calc = new OrderCalc();

            foreach (string path in Directory.GetFiles(@Environment.CurrentDirectory + "/Orders", "*.txt"))
            {
                FindOrdersToDeliver(path);
            }
        }
Beispiel #3
0
        public void ShowOrderStaticData(string filePath)
        {
            if (filePath != null || filePath != string.Empty)
            {
                if (File.Exists(filePath))
                {
                    string[] input = File.ReadAllLines(filePath);

                    OrderCalc calc = new OrderCalc();
                    storageProductName.Text = input[1];
                    producer.Text           = input[2];
                    typeOfDelivery.Text     = input[3];
                    destination.Text        = input[4];

                    calc.Distance = Route.Distance((Routes)Enum.Parse(typeof(Routes), input[4]));
                    calc.Quantity = int.Parse(input[5]);
                    cost.Text     = calc.Cost.ToString();
                }
            }
        }