Beispiel #1
0
        private void LoadEntities()
        {
            gridControlEntities.BeginUpdate();
            try
            {
                BufferHoursList.Clear();
                if (EntityStore != null)
                {
                    List <BufferHours> cols = ClientEnvironment.StoreService.BufferHoursService.GetBufferHoursFiltered(EntityStore.ID, StartYear, EndYear);
                    if (SWController != null)
                    {
                        SWController.FillBufferHours(cols);
                    }

                    BufferHoursList.CopyList(cols);
                }
                if (gridControlEntities.DataSource == null)
                {
                    gridControlEntities.DataSource = BufferHoursList;
                }
            }
            finally
            {
                gridControlEntities.EndUpdate();
            }
            UpdateButtonState();
        }
Beispiel #2
0
        private void EditEntity()
        {
            BufferHours bh = FocusedEntity;

            if (bh == null || SWController == null || EntityStore == null)
            {
                return;
            }
            if (CanEditEntity())
            {
                FormSelectYear selectYear = new FormSelectYear();

                List <StoreToWorld> lst = SWController.GetListByStoreId(EntityStore.ID);

                selectYear.SetStoreWorlds(lst);
                selectYear.EntityStore = EntityStore;

                selectYear.SetReadOnly();
                selectYear.Entity = bh;

                if (selectYear.ShowDialog() == DialogResult.OK)
                {
                    BufferHoursList.ResetItemById(bh.ID);
                }
            }
        }
Beispiel #3
0
        private void NewEntity()
        {
            if (SWController == null || EntityStore == null)
            {
                return;
            }

            FormSelectYear selectYear = new FormSelectYear();

            List <StoreToWorld> lst = SWController.GetListByStoreId(EntityStore.ID);

            selectYear.SetStoreWorlds(lst);
            selectYear.EntityStore = EntityStore;
            if (selectYear.ShowDialog() == DialogResult.OK)
            {
                short y = selectYear.Entity.Year;
                if (y >= StartYear && y <= EndYear)
                {
                    BufferHoursList.Add(selectYear.Entity);
                }
            }
        }
Beispiel #4
0
        private void DeleteEntity()
        {
            BufferHours bh = FocusedEntity;

            if (bh == null || SWController == null || EntityStore == null || !CanDeleteEntity())
            {
                return;
            }

            if (QuestionMessageYes(GetLocalized("QuestionDeleteBufferHours")))
            {
                try
                {
                    ClientEnvironment.StoreService.BufferHoursService.DeleteByID(bh.ID);
                    BufferHoursList.RemoveEntityById(bh.ID);
                    UpdateButtonState();
                }
                catch (EntityException)
                {
                    ErrorMessage(GetLocalized("CantDeleteTrendCorrection"), GetLocalized("Attention"));
                    return;
                }
            }
        }