SetoutGroupStore.cs 814 B

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