MYOBGlobalPosterSettingsGrid.cs 915 B

123456789101112131415161718192021222324252627282930
  1. using InABox.Core;
  2. using InABox.DynamicGrid;
  3. using InABox.Poster.MYOB;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace PRS.Shared.Posters.MYOB;
  10. public class MYOBGlobalPosterSettingsGrid : DynamicItemsListGrid<MYOBGlobalPosterSettings>
  11. {
  12. protected override void DoAfterSave(IDynamicEditorForm editor, MYOBGlobalPosterSettings[] items)
  13. {
  14. base.DoAfterSave(editor, items);
  15. if(items.Any(x => x.CompanyFile.HasOriginalValue(x => x.ID)
  16. || x.HasOriginalValue(x => x.CompanyFilePassword)
  17. || x.HasOriginalValue(x => x.CompanyFileUserID)))
  18. {
  19. var data = MYOBPosterEngine.GetConnectionDataOrNull();
  20. if(data is not null)
  21. {
  22. // Reset authentication if it's changed.
  23. data.CompanyFile = null;
  24. }
  25. }
  26. }
  27. }