private void RunUpControlDeleted(object sender, EventArgs e) { PowerUnitRunupControl control = (PowerUnitRunupControl)sender; RunUp cond = control.Runup; if (cond.ItemId > 0 && MessageBox.Show("Do you really want to delete run-up?", "Deleting confirmation", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { //если информация о состоянии сохранена в БД //и получен положительный ответ на ее удаление try { GlobalObjects.NewKeeper.Delete(cond); } catch (Exception ex) { Program.Provider.Logger.Log("Error while removing data", ex); } flowLayoutPanelMain.Controls.Remove(control); control.Deleted -= RunUpControlDeleted; control.WorkTimeChanged -= RunUpControlWorkTimeChanged; control.Dispose(); } else if (cond.ItemId <= 0) { flowLayoutPanelMain.Controls.Remove(control); control.Deleted -= RunUpControlDeleted; control.WorkTimeChanged -= RunUpControlWorkTimeChanged; control.Dispose(); } }
/// <summary> /// Контрол редактирует данные о залитом масле для одного агрегата /// </summary> public PowerUnitRunupControl(Aircraft aircraft, RunUp runup) : this() { _currentAircraft = aircraft; _componentType = runup.BaseComponent.BaseComponentType; AttachedObject = runup; }
public RunUpView(RunUp source) { if (source == null) { return; } Id = source.Id; BaseComponent = new BaseComponentView(source.BaseComponent); }
/// <summary> /// Контрол редактирует данные о залитом масле для одного агрегата /// </summary> public PowerUnitRunupControl(Aircraft aircraft, AircraftFlight flight, RunUp runup) : this() { _currentAircraft = aircraft; _componentType = runup.BaseComponent.BaseComponentType; _outTime = flight.FlightDate.Date.AddMinutes(flight.OutTime); _takeOffTime = flight.FlightDate.Date.AddMinutes(flight.TakeOffTime); _landingTime = flight.FlightDate.Date.AddMinutes(flight.LDGTime); _inTime = flight.FlightDate.Date.AddMinutes(flight.InTime); AttachedObject = runup; }
/// <summary> /// Существует ли информация по уровню масла для заданного агрегата /// </summary> /// <param name="con"></param> /// <returns></returns> private bool ConditionExists(RunUp con) { // if (Flight == null || Flight.RunupsCollection == null) { return(false); } // return(Flight.RunupsCollection.Any(t => t == con)); // }
/// <summary> /// Контрол редактирует данные о залитом масле для одного агрегата /// </summary> public PowerUnitRunupControl(Aircraft aircraft, BaseComponentType componentType) : this() { _currentAircraft = aircraft; _componentType = componentType; AttachedObject = new RunUp(); }