示例#1
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            if (_xAxisText.Count() == 0 || _yAxisText.Count() == 0)
            {
                MessageBox.Show("You need to fill Axis fields first");
                return;
            }
            try
            {
                Int32 xAxis, yAxis;
                Int32.TryParse(_xAxisText, out xAxis);
                Int32.TryParse(_yAxisText, out yAxis);

                RMA.Model.Region newRegion = new RMA.Model.Region {
                    ShortName = _shortName, Description = _description, XAxis = xAxis, YAxis = yAxis
                };
                newRegion.Insert();
                RMA.Model.Region.Store.SaveToDisk();
                this.Close();
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
            }
        }
示例#2
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");
        }
示例#3
0
文件: MainForm.cs 项目: ZhangHang/RMA
        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");
        }