/// <summary> /// Контрол редактирует данные о залитом масле для одного агрегата /// </summary> public PassengerControl(AircraftFlight flight) : this() { AttachedObject = new FlightPassengerRecord { FlightId = flight.ItemId }; }
private void ConditionControlDeleted(object sender, EventArgs e) { PassengerControl control = (PassengerControl)sender; FlightPassengerRecord cond = control.FlightPassengerRecord; if (cond.ItemId > 0 && MessageBox.Show("Do you really want to delete flight passenger record?", "Deleting confirmation", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { //если информация о состоянии сохранена в БД //и получен положительный ответ на ее удаление try { GlobalObjects.CasEnvironment.NewKeeper.Delete(cond); } catch (Exception ex) { Program.Provider.Logger.Log("Error while removing data", ex); } flowLayoutPanelMain.Controls.Remove(control); control.Deleted -= ConditionControlDeleted; control.PassengerCountChanged -= ControlPassengerCountChanged; control.PassengerCategoryChanged -= PassengerCategoryChanged; control.Dispose(); } else if (cond.ItemId <= 0) { flowLayoutPanelMain.Controls.Remove(control); control.Deleted -= ConditionControlDeleted; control.PassengerCountChanged -= ControlPassengerCountChanged; control.PassengerCategoryChanged -= PassengerCategoryChanged; control.Dispose(); } }
/// <summary> /// Контрол редактирует данные о залитом масле для одного агрегата /// </summary> public PassengerControl(FlightPassengerRecord runup) : this() { AttachedObject = runup; }