Ejemplo n.º 1
0
        private void LoadEntities()
        {
            gridControlEntities.BeginUpdate();
            try
            {
                BenchmarksList.Clear();
                if (EntityStore != null)
                {
                    List <Benchmark> cols = ClientEnvironment.StoreService.BenchmarkService.GetBenchmarkFiltered(EntityStore.ID, StartYear, EndYear);
                    if (SWController != null)
                    {
                        SWController.FillBechmarks(cols);
                    }
                    BenchmarksList.CopyList(cols);
                }
                if (gridControlEntities.DataSource == null)
                {
                    gridControlEntities.DataSource = BenchmarksList;
                }

                UpdateButtonState();
            }
            finally
            {
                gridControlEntities.EndUpdate();
            }
        }
Ejemplo n.º 2
0
        private void EditEntity()
        {
            Benchmark bh = FocusedEntity;

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

            if (CanEditEntity())
            {
                using (FormBenchmark formEdit = new FormBenchmark())
                {
                    List <StoreToWorld> lst = SWController.GetListByStoreId(EntityStore.ID);

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

                    formEdit.SetReadOnly();
                    formEdit.EntityBenchmark = bh;

                    if (formEdit.ShowDialog() == DialogResult.OK)
                    {
                        BenchmarksList.ResetItemById(bh.ID);
                    }
                }
            }
        }
Ejemplo n.º 3
0
 private void DeleteEntity()
 {
     if (FocusedEntity != null)
     {
         if (QuestionMessageYes(GetLocalized("QuestionDeleteBenchmark")))
         {
             try
             {
                 ClientEnvironment.BenchmarkService.DeleteByID(FocusedEntity.ID);
                 BenchmarksList.Remove(FocusedEntity);
             }
             catch (EntityException ex)
             {
                 ProcessEntityException(ex);
             }
         }
     }
 }
Ejemplo n.º 4
0
        private void NewEntity()
        {
            if (SWController == null || EntityStore == null)
            {
                return;
            }

            using (FormBenchmark formEdit = new FormBenchmark())
            {
                List <StoreToWorld> lst = SWController.GetListByStoreId(EntityStore.ID);

                formEdit.SetStoreWorlds(lst);
                formEdit.EntityStore = EntityStore;
                if (formEdit.ShowDialog() == DialogResult.OK)
                {
                    short y = formEdit.EntityBenchmark.Year;
                    if (y >= StartYear && y <= EndYear)
                    {
                        BenchmarksList.Add(formEdit.EntityBenchmark);
                    }
                }
            }
        }