Exemple #1
0
        public EditCarrierForm(string carrierSCAC)
        {
            InitializeComponent();
            _originalSCAC = carrierSCAC;
            _carrier = _carrierStore.Items.Where(x => x.SCAC == carrierSCAC).First();

            updateButton.Click += UpdateButton_Click;

            sCACTextBox.Text = _carrier.SCAC;
            nameTextBox.Text = _carrier.Name;
        }
Exemple #2
0
 private void SaveButton_Click(object sender, EventArgs e)
 {
     try
     {
         Carrier newCarrier = new Carrier { SCAC = _editedSCAC, Name = _editedName };
         newCarrier.Insert();
         _carrierStore.SaveToDisk();
         this.Close();
     }
     catch (Exception error)
     {
         MessageBox.Show(error.Message);
     }
 }
Exemple #3
0
        public EditRateForm(Carrier carrier, Rate rateToEdit)
        {
            InitializeComponent();
            _carrier = carrier;
            _rateToEdit = rateToEdit;

            _originalOriginRegionShortName = _rateToEdit.OriginRegionShortName;
            _originalOriginDestinationShortName = _rateToEdit.DestinationRegionShortName;

            costTextBox.KeyPress += Utility.TextBox_KeyPress_Filte_Positive_Number_Only;

            foreach (var item in RMA.Model.Region.Store.Items)
            {
                originComboBox.Items.Add(item.ShortName);
                destinationComboBox.Items.Add(item.ShortName);
            }

            originComboBox.SelectedItem = _rateToEdit.OriginRegionShortName;
            destinationComboBox.SelectedItem = _rateToEdit.DestinationRegionShortName;

            typeComboBox.Items.Add(RateType.Flat.ToString());
            typeComboBox.Items.Add(RateType.Increase.ToString());

            if (_rateToEdit is FlatRate)
            {
                typeComboBox.SelectedIndex = 0;
                costTextBox.Text = (_rateToEdit as FlatRate).Totalcost.ToString();
            }
            else if (_rateToEdit is IncreaseRate)
            {
                typeComboBox.SelectedIndex = 1;
                costTextBox.Text = (_rateToEdit as IncreaseRate).CostPerMile.ToString();
            }
            else
            {
                throw new Exception("fatal error");
            }
        }
Exemple #4
0
        public CreateRateForm(Carrier carrier)
        {
            InitializeComponent();
            _carrier = carrier;

            costTextBox.KeyPress += Utility.TextBox_KeyPress_Filte_Positive_Number_Only;

            foreach (var item in RMA.Model.Region.Store.Items)
            {
                originComboBox.Items.Add(item.ShortName);
                destinationComboBox.Items.Add(item.ShortName);
            }

            if (RMA.Model.Region.Store.Items.Count > 0)
            {
                originComboBox.SelectedIndex = 0;
                destinationComboBox.SelectedIndex = 0;
            }

            typeComboBox.Items.Add(RateType.Flat.ToString());
            typeComboBox.Items.Add(RateType.Increase.ToString());

            typeComboBox.SelectedIndex = 0;
        }
Exemple #5
0
        private void demoDataButton_Click(object sender, EventArgs e)
        {
            _regionStore.Erase();
            _carrierStore.Erase();

            Carrier MasterCarrier = new Carrier { SCAC = "MAST", Name = "Master Carrier" };
            Carrier SlaveCarrier = new Carrier { SCAC = "SLAV", Name = "Slave Carrier" };

            Region OriginCityRegion = new RMA.Model.Region { XAxis = 0, YAxis = 0, ShortName = "OC", Description = "Origin City" };
            Region DestinationCityRegion = new RMA.Model.Region { XAxis = 13, YAxis = 13, ShortName = "DC", Description = "Destination City" };
            Region ChaosLandRegion = new RMA.Model.Region { XAxis = 100, YAxis = 100, ShortName = "CL", Description = "Chaos Land" };
            Region VoidWorldRegion = new RMA.Model.Region { XAxis = -100, YAxis = -100, ShortName = "VW", Description = "Void World" };

            FlatRate flatRateForMasterCarrier = new FlatRate(OriginCityRegion, DestinationCityRegion, 1000);
            IncreaseRate increaseRateForMasterCarrier = new IncreaseRate(DestinationCityRegion, ChaosLandRegion, 10);

            FlatRate flatRateForSlaveCarrier = new FlatRate(OriginCityRegion, DestinationCityRegion, 800);
            IncreaseRate increaseRateForSlaveCarrier = new IncreaseRate(DestinationCityRegion, ChaosLandRegion, 9);

            MasterCarrier.AddRate(flatRateForMasterCarrier);
            MasterCarrier.AddRate(increaseRateForMasterCarrier);
            SlaveCarrier.AddRate(flatRateForSlaveCarrier);
            SlaveCarrier.AddRate(increaseRateForMasterCarrier);

            MasterCarrier.Insert();
            SlaveCarrier.Insert();

            OriginCityRegion.Insert();
            DestinationCityRegion.Insert();
            ChaosLandRegion.Insert();
            VoidWorldRegion.Insert();

            _carrierStore.SaveToDisk();
            _regionStore.SaveToDisk();

            MessageBox.Show("load demo data task complete");
        }