Пример #1
0
        public void FireNewEntity()
        {
            if (ReadOnly)
            {
                return;
            }
            if (Country == null)
            {
                return;
            }

            WorkingModel entity = new WorkingModel();

            entity.CountryID        = Country.ID;
            entity.WorkingModelType = WorkingModelType.LunchModel;
            FormLunchModel countryform = new FormLunchModel(entity);

            countryform.Text  = GetLocalized("NewLunch");
            countryform.isNew = true;
            if (FocusedEntity != null)
            {
                countryform.setReadOnlyTypeLunch(FocusedEntity.IsDurationTime);
            }
            if (countryform.ShowDialog() == DialogResult.OK)
            {
                _listEntities.Add((WorkingModel)countryform.Entity);
                UpdateBarButtonEnable();
            }
        }
Пример #2
0
        public void FireEditEntity(WorkingModel c)
        {
            if (ReadOnly)
            {
                return;
            }
            WorkingModel entity = c;

            if (entity == null)
            {
                entity = FocusedEntity;
            }
            if (entity != null)
            {
                FormLunchModel countryform = new FormLunchModel(entity);
                countryform.Text  = GetLocalized("editLunch");
                countryform.isNew = false;
                if (FocusedEntity != null && gridViewLunch.RowCount > 1)
                {
                    countryform.setReadOnlyTypeLunch(FocusedEntity.IsDurationTime);
                }
                if (countryform.ShowDialog() == DialogResult.OK)
                {
                    _listEntities.ResetItemById(entity.ID);
                }
            }
        }