Пример #1
0
        public void EditEntity(AvgWorkingDaysInWeek amount)
        {
            AvgWorkingDaysInWeek am = amount;
            if (amount == null && FocusedEntity == null) return;

            if (am == null) am = FocusedEntity;
            if (am == null) return;// paranoik check

            using (AvgWorkingDaysInWeekForm form = new AvgWorkingDaysInWeekForm())
            {
                form.Amount = am;

                if (form.ShowDialog() == DialogResult.OK)
                {
                    ListOfAvgWDInWeek.ResetItemById(am.ID);
                }
            }
        }
Пример #2
0
         void DeleteEntity(AvgWorkingDaysInWeek entity)
        {
            AvgWorkingDaysInWeek am = entity;
            if (am == null && FocusedEntity == null) return;
            am = FocusedEntity;

            if (QuestionMessageYes(GetLocalized("QuestionRemoveEverageDaysInweek") + String.Format(" ({0})", am.Year)))
            {
                try
                {
                    ClientEnvironment.AvgWorkingDaysInWeekService.DeleteByID(am.ID);
                    AvgWorkingDaysInWeek removing = ListOfAvgWDInWeek.GetItemByID(am.ID);
                    if (removing != null)
                    {
                        ListOfAvgWDInWeek.Remove(removing);
                        UpdateBarButtons();
                    }
                }
                catch (ValidationException)
                {
                    ErrorMessage("CannotDeleteAverageDaysInWeek");
                    return;
                }
                catch (EntityException ex)
                {
                    ProcessEntityException(ex);
                    return;
                }
            }
        }