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); } }
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"); }