private void buttonNewMode_Click(object sender, EventArgs e) { IAMode pipeBased = _dataHelper.CreateNewMode(3, "Example 4 pipeline", "For API test purposes"); bool success = _dataHelper.ModePipelineInsertOrUpdateEI(pipeBased, 4, "btu/mi/ton", 25); success &= _dataHelper.ModeAddEnergySource(pipeBased, 1, 23, 1, 341, 2, 230106, -1); IModeFuelShares fs = _dataHelper.ModeCreateNewFuelShare(pipeBased, "Second fuel share"); success &= _dataHelper.ModeInsertFuelShare(pipeBased, fs); success &= _dataHelper.ModeAddEnergySource(pipeBased, fs.Id, 59, 1, 121, 2, 7, -1); success &= _dataHelper.DataInsertOrUpdateMode(pipeBased); IAMode tankerBased = _dataHelper.CreateNewMode(1, "Example 4 tanker", "For API test purposes"); success &= _dataHelper.ModeTankerSetAvgSpd(tankerBased, "mi/hr", 20); success &= _dataHelper.ModeTankerSetLoadFactorTo(tankerBased, 0.75); success &= _dataHelper.ModeTankerSetLoadFactorFrom(tankerBased, 0.50); success &= _dataHelper.ModeTankerSetTypicalFuelConsumption(tankerBased, "kg/mmBtu", 43.961); success &= _dataHelper.ModeTankerSetTypicalHP(tankerBased, "W", 6670000.974); success &= _dataHelper.ModeTankerSetHPPayloadFactor(tankerBased, "W/kg", 0.000081886); success &= _dataHelper.ModeTankerInsertOrUpdatePayload(tankerBased, 23, "ton", 220000); success &= _dataHelper.ModeAddEnergySource(tankerBased, 1, 23, 1, 341, 2, 230106, -1); success &= _dataHelper.DataInsertOrUpdateMode(tankerBased); IAMode truckBased = _dataHelper.CreateNewMode(2, "Example 4 truck", "For API test purposes"); success &= _dataHelper.ModeTruckSetFuelConsumptionTo(truckBased, "gal/mi", 6); success &= _dataHelper.ModeTruckSetFuelConsumptionFrom(truckBased, "gal/mi", 6); success &= _dataHelper.ModeTruckInsertOrUpdatePayload(truckBased, 23, "ton", 22); success &= _dataHelper.ModeAddEnergySource(truckBased, 1, 23, 1, 341, 2, 230106, -1); success &= _dataHelper.DataInsertOrUpdateMode(truckBased); IAMode railBased = _dataHelper.CreateNewMode(4, "Example 4 rail", "For API test purposes"); success &= _dataHelper.ModeRailSetAvgSpd(railBased, "mi/hr", 20); success &= _dataHelper.ModeRailSetEI(railBased, 4, "btu/mi/ton", 25); success &= _dataHelper.DataInsertOrUpdateMode(railBased); IAMode magicBased = _dataHelper.CreateNewMode(5, "Example 4 magic", "For API test purposes"); success &= _dataHelper.DataInsertOrUpdateMode(magicBased); if (success) { MessageBox.Show("New modes of each types inserted in dataset"); } else { MessageBox.Show("Failure"); } }