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(); } }
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); } } } }
private void DeleteEntity() { if (FocusedEntity != null) { if (QuestionMessageYes(GetLocalized("QuestionDeleteBenchmark"))) { try { ClientEnvironment.BenchmarkService.DeleteByID(FocusedEntity.ID); BenchmarksList.Remove(FocusedEntity); } catch (EntityException ex) { ProcessEntityException(ex); } } } }
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); } } } }