private void EditEntity() { TrendCorrection bh = FocusedEntity; if (bh == null || SWController == null || EntityStore == null) { return; } // Edit can now trendcorrection, can't edit last EndTime < Today if (CanEditEntity()) { using (FormTrendCorrection formEdit = new FormTrendCorrection()) { List <StoreToWorld> lst = SWController.GetListByStoreId(EntityStore.ID); formEdit.SetStoreWorlds(lst); formEdit.EntityStore = EntityStore; formEdit.SetReadOnly(); formEdit.Entity = bh; if (formEdit.ShowDialog() == DialogResult.OK) { TrendCorrectionList.ResetItemById(bh.ID); } } } }
private void LoadEntities() { if ((!EndDate.HasValue) || (StartDate <= EndDate) || EndDate == null) { gridControl.BeginUpdate(); try { TrendCorrectionList.Clear(); if (EntityStore != null) { List <TrendCorrection> cols = ClientEnvironment.StoreService.TrendCorrectionService.GetTrendCorrectionFiltered(EntityStore.ID, StartDate, EndDate); TrendCorrectionList.CopyList(cols); if (SWController != null) { foreach (TrendCorrection bh in TrendCorrectionList) { bh.WorldName = SWController.GetWorldNameById(bh.StoreWorldID); } } } if (gridControl.DataSource == null) { gridControl.DataSource = TrendCorrectionList; } } finally { gridControl.EndUpdate(); } UpdateButtonState(); } else { ErrorMessage(GetLocalized("ErrorDateRange")); } }
private void NewEntity() { if (SWController == null || EntityStore == null) { return; } using (FormTrendCorrection formEdit = new FormTrendCorrection()) { List <StoreToWorld> lst = SWController.GetListByStoreId(EntityStore.ID); formEdit.SetStoreWorlds(lst); formEdit.EntityStore = EntityStore; if (formEdit.ShowDialog() == DialogResult.OK) { if (IsIncludeDateRange(StartDate, EndDate, formEdit.EntityTrend.BeginTime, formEdit.EntityTrend.EndTime)) { TrendCorrectionList.Add(formEdit.EntityTrend); } UpdateButtonState(); } } }