NotificationStore.cs 838 B

1234567891011121314151617181920212223242526272829
  1. using Comal.Classes;
  2. using Comal.Stores;
  3. using InABox.Core;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. namespace PRSStores
  9. {
  10. public class NotificationStore : BaseStore<Notification>
  11. {
  12. protected override void AfterSave(Notification entity)
  13. {
  14. base.AfterSave(entity);
  15. if(entity.Closed == DateTime.MinValue)
  16. {
  17. var userID = Provider.Query(
  18. new Filter<Employee>(x => x.ID).IsEqualTo(entity.Employee.ID),
  19. new Columns<Employee>(x => x.UserLink.ID)).Rows.FirstOrDefault()?.Get<Employee, Guid>(x => x.UserLink.ID);
  20. if (userID.HasValue)
  21. {
  22. PushManager.PushUser(userID.Value, entity);
  23. }
  24. }
  25. }
  26. }
  27. }