SetoutGroupStore.cs 825 B

12345678910111213141516171819202122232425
  1. using Comal.Classes;
  2. using InABox.Core;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. namespace Comal.Stores;
  6. public class SetoutGroupStore : BaseStore<SetoutGroup>
  7. {
  8. protected override void AfterSave(SetoutGroup entity)
  9. {
  10. if(entity.OptimizationDocument.HasOriginalValue(x => x.ID))
  11. {
  12. var setoutStore = (FindSubStore<Setout>() as SetoutStore)!;
  13. var setouts = setoutStore.Query(
  14. new Filter<Setout>(x => x.Group.ID).IsEqualTo(entity.ID),
  15. Columns.None<Setout>().Add(x => x.ID).Add(x => x.Group.ID));
  16. foreach(var setout in setouts.ToObjects<Setout>())
  17. {
  18. setoutStore.UpdateOptimisationDocument(FindSubStore<SetoutDocument>, setout, entity.OptimizationDocument.ID);
  19. }
  20. }
  21. }
  22. }