Пример #1
0
 def __deletenotificationids(self, requesttype, notificationids):
     if notificationids:
         if requesttype == "ministryrequest":
             FOIRequestNotificationUser.dismissbynotificationid(notificationids)
             FOIRequestNotification.dismissnotification(notificationids)
         else:
             FOIRawRequestNotificationUser.dismissbynotificationid(notificationids)
             FOIRawRequestNotification.dismissnotification(notificationids)            
Пример #2
0
 def dismissnotificationsbyid(self,requestid, requesttype):
     foirequest = self.__getrequest(requestid, requesttype)
     if requesttype == "ministryrequest":
         _ids = FOIRequestNotification.getnotificationidsbynumber(foirequest["filenumber"])
         if _ids:
             FOIRequestNotificationUser.dismissbynotificationid(_ids)
             FOIRequestNotification.dismissnotification(_ids)
     else:
         _ids = FOIRawRequestNotification.getnotificationidsbynumber('U-00' + str(foirequest['requestid']))
         if _ids:
             FOIRawRequestNotificationUser.dismissbynotificationid(_ids)
             FOIRawRequestNotification.dismissnotification(_ids)  
Пример #3
0
 def __preparenotificationuser(self, requesttype, notificationuser, userid):
     if requesttype == "ministryrequest":
         user = FOIRequestNotificationUser()
     else:
         user = FOIRawRequestNotificationUser()
     user.notificationusertypeid = notificationuser["usertype"]
     user.userid = notificationuser["userid"]
     user.createdby = userid
     user.created_at = datetime2.now()
     return user
Пример #4
0
 def __dismissnotificationbyuser(self, userid):
     requestnotificationids = self.__getdismissparentidsbyuser("ministryrequest", userid)
     requestnotification = FOIRequestNotificationUser.dismissnotificationbyuser(userid)
     rawnotificationids = self.__getdismissparentidsbyuser("rawrequest", userid)
     rawnotification = FOIRawRequestNotificationUser.dismissnotificationbyuser(userid)   
     prequestnotification = FOIRequestNotification.dismissnotification(requestnotificationids) 
     prawnotification = FOIRawRequestNotification.dismissnotification(rawnotificationids)
     if requestnotification.success == True and rawnotification.success == True and prequestnotification.success == True and prawnotification.success == True:
         return DefaultMethodResult(True,'Notifications deleted for user',userid) 
     else:
         return DefaultMethodResult(False,'Unable to delete the notifications',userid)
Пример #5
0
 def __dimissusernotificationbyid(self, requesttype, notificationuserid):
     notficationids = self.__getdismissparentids(requesttype, notificationuserid)
     if requesttype == "ministryrequest":         
         cresponse = FOIRequestNotificationUser.dismissnotification(notificationuserid)
         presponse = FOIRequestNotification.dismissnotification(notficationids)            
     else:
         cresponse = FOIRawRequestNotificationUser.dismissnotification(notificationuserid)
         presponse = FOIRawRequestNotification.dismissnotification(notficationids)
     if cresponse.success == True and presponse.success == True:
         return DefaultMethodResult(True,'Notifications deleted for id',notificationuserid) 
     else:
         return DefaultMethodResult(False,'Unable to delete the notifications for id',notificationuserid)    
Пример #6
0
 def __getdismissparentidsbyuserandtype(self, requesttype, userid, typeid):
     if requesttype == "ministryrequest":         
         _notficationids = FOIRequestNotificationUser.getnotificationsbyuserandtype(userid, typeid)
     else:
         _notficationids =  FOIRawRequestNotificationUser.getnotificationsbyuserandtype(userid, typeid)
     return self.__filterdismissparentids(_notficationids)