@@ -17,6 +17,9 @@ public static async Task<bool> ProcessShiftQueueItem(ShiftQueueItem sqi)
1717 var _shiftsService = Bootstrapper . GetKernel ( ) . Resolve < IShiftsService > ( ) ;
1818 var _communicationService = Bootstrapper . GetKernel ( ) . Resolve < ICommunicationService > ( ) ;
1919 var _userProfileService = Bootstrapper . GetKernel ( ) . Resolve < IUserProfileService > ( ) ;
20+ var _departmentService = Bootstrapper . GetKernel ( ) . Resolve < IDepartmentsService > ( ) ;
21+
22+ var department = await _departmentService . GetDepartmentByIdAsync ( sqi . DepartmentId , false ) ;
2023
2124 if ( sqi . Type == ( int ) ShiftQueueTypes . TradeRequested )
2225 {
@@ -28,7 +31,7 @@ public static async Task<bool> ProcessShiftQueueItem(ShiftQueueItem sqi)
2831 foreach ( var user in tradeRequest . Users )
2932 {
3033 UserProfile profile = userProfiles . FirstOrDefault ( x => x . UserId == user . UserId ) ;
31- await _communicationService . SendNotificationAsync ( user . UserId , tradeRequest . SourceShiftSignup . Shift . DepartmentId , text , sqi . DepartmentNumber ,
34+ await _communicationService . SendNotificationAsync ( user . UserId , tradeRequest . SourceShiftSignup . Shift . DepartmentId , text , sqi . DepartmentNumber , department ,
3235 tradeRequest . SourceShiftSignup . Shift . Name , profile ) ;
3336 }
3437 }
@@ -40,7 +43,7 @@ await _communicationService.SendNotificationAsync(user.UserId, tradeRequest.Sour
4043
4144 var text = _shiftsService . GenerateShiftTradeRejectionText ( targetUserProfile , tradeRequest ) ;
4245
43- await _communicationService . SendNotificationAsync ( sourceUserProfile . UserId , tradeRequest . SourceShiftSignup . Shift . DepartmentId , text , sqi . DepartmentNumber ,
46+ await _communicationService . SendNotificationAsync ( sourceUserProfile . UserId , tradeRequest . SourceShiftSignup . Shift . DepartmentId , text , sqi . DepartmentNumber , department ,
4447 tradeRequest . SourceShiftSignup . Shift . Name , sourceUserProfile ) ;
4548 }
4649 else if ( sqi . Type == ( int ) ShiftQueueTypes . TradeProposed && ! String . IsNullOrWhiteSpace ( sqi . SourceUserId ) )
@@ -51,7 +54,7 @@ await _communicationService.SendNotificationAsync(sourceUserProfile.UserId, trad
5154
5255 var text = _shiftsService . GenerateShiftTradeProposedText ( proposedUserProfile , tradeRequest ) ;
5356
54- await _communicationService . SendNotificationAsync ( sourceUserProfile . UserId , tradeRequest . SourceShiftSignup . Shift . DepartmentId , text , sqi . DepartmentNumber ,
57+ await _communicationService . SendNotificationAsync ( sourceUserProfile . UserId , tradeRequest . SourceShiftSignup . Shift . DepartmentId , text , sqi . DepartmentNumber , department ,
5558 tradeRequest . SourceShiftSignup . Shift . Name , sourceUserProfile ) ;
5659 }
5760 else if ( sqi . Type == ( int ) ShiftQueueTypes . TradeFilled && ! String . IsNullOrWhiteSpace ( sqi . SourceUserId ) )
@@ -62,7 +65,7 @@ await _communicationService.SendNotificationAsync(sourceUserProfile.UserId, trad
6265
6366 var text = _shiftsService . GenerateShiftTradeFilledText ( sourceUserProfile , tradeRequest ) ;
6467
65- await _communicationService . SendNotificationAsync ( proposedUserProfile . UserId , tradeRequest . SourceShiftSignup . Shift . DepartmentId , text , sqi . DepartmentNumber ,
68+ await _communicationService . SendNotificationAsync ( proposedUserProfile . UserId , tradeRequest . SourceShiftSignup . Shift . DepartmentId , text , sqi . DepartmentNumber , department ,
6669 tradeRequest . SourceShiftSignup . Shift . Name , proposedUserProfile ) ;
6770 }
6871 else if ( sqi . Type == ( int ) ShiftQueueTypes . ShiftCreated )
@@ -74,7 +77,7 @@ await _communicationService.SendNotificationAsync(proposedUserProfile.UserId, tr
7477
7578 foreach ( var profile in profiles . Select ( x => x . Value ) )
7679 {
77- await _communicationService . SendNotificationAsync ( profile . UserId , sqi . DepartmentId , text , sqi . DepartmentNumber , "New Shift" , profile ) ;
80+ await _communicationService . SendNotificationAsync ( profile . UserId , sqi . DepartmentId , text , sqi . DepartmentNumber , department , "New Shift" , profile ) ;
7881 }
7982 }
8083 else if ( sqi . Type == ( int ) ShiftQueueTypes . ShiftUpdated )
@@ -87,9 +90,9 @@ await _communicationService.SendNotificationAsync(proposedUserProfile.UserId, tr
8790 foreach ( var profile in shift . Personnel )
8891 {
8992 if ( profiles . ContainsKey ( profile . UserId ) )
90- await _communicationService . SendNotificationAsync ( profile . UserId , sqi . DepartmentId , text , sqi . DepartmentNumber , shift . Name , profiles [ profile . UserId ] ) ;
93+ await _communicationService . SendNotificationAsync ( profile . UserId , sqi . DepartmentId , text , sqi . DepartmentNumber , department , shift . Name , profiles [ profile . UserId ] ) ;
9194 else
92- await _communicationService . SendNotificationAsync ( profile . UserId , sqi . DepartmentId , text , sqi . DepartmentNumber , shift . Name ) ;
95+ await _communicationService . SendNotificationAsync ( profile . UserId , sqi . DepartmentId , text , sqi . DepartmentNumber , department , shift . Name ) ;
9396 }
9497 }
9598 else if ( sqi . Type == ( int ) ShiftQueueTypes . ShiftDaysAdded )
@@ -104,9 +107,9 @@ await _communicationService.SendNotificationAsync(proposedUserProfile.UserId, tr
104107 foreach ( var profile in shift . Personnel )
105108 {
106109 if ( profiles . ContainsKey ( profile . UserId ) )
107- await _communicationService . SendNotificationAsync ( profile . UserId , sqi . DepartmentId , text , sqi . DepartmentNumber , shift . Name , profiles [ profile . UserId ] ) ;
110+ await _communicationService . SendNotificationAsync ( profile . UserId , sqi . DepartmentId , text , sqi . DepartmentNumber , department , shift . Name , profiles [ profile . UserId ] ) ;
108111 else
109- await _communicationService . SendNotificationAsync ( profile . UserId , sqi . DepartmentId , text , sqi . DepartmentNumber , shift . Name ) ;
112+ await _communicationService . SendNotificationAsync ( profile . UserId , sqi . DepartmentId , text , sqi . DepartmentNumber , department , shift . Name ) ;
110113 }
111114 }
112115 }
0 commit comments