public void EditEntity(CountryAdditionalHour amount) { CountryAdditionalHour am = amount; if (amount == null && FocusedEntity == null) return; if (am == null) am = FocusedEntity; if (am == null) return; using (FormUnavoidableAddHours form = new FormUnavoidableAddHours()) { form.Amount = am; if (form.ShowDialog() == DialogResult.OK) ListOfUnavAddHours.ResetItemById(am.ID); } }
private void DeleteEntity(CountryAdditionalHour entity) { CountryAdditionalHour am = entity; if (am == null && FocusedEntity == null) return; am = FocusedEntity; if (QuestionMessageYes(GetLocalized("QuestionRemoveCountryAdditionalHour"))) { try { ClientEnvironment.CountryAdditionalHourService.DeleteByID(am.ID); ClientEnvironment.StoreService.DeleteCalculatedCountryAdditionalHours(am.Year, am.CountryID, am.WeekDay); CountryAdditionalHour removing = ListOfUnavAddHours.GetItemByID(am.ID); if (removing != null) { ListOfUnavAddHours.Remove(removing); UpdateBarButtons(); } } catch (ValidationException) { ErrorMessage("CannotDeleteCountryAdditionalHour"); return; } catch (EntityException ex) { ProcessEntityException(ex); return; } } }