Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. public void GdsPopulateNotificationQueue()
  2. {
  3.  
  4. Gds.GdsMessage Msg = new Gds.GdsMessage();
  5. Gds.GdsPatInfo PatInfo = null;
  6. Preferences Pref = null;
  7.  
  8. DataTable DtIds;
  9. DataTable DtMessages;
  10.  
  11. long IntLinkId = 0;
  12. string MessageToSend;
  13. int MessageId = 0;
  14. DateTime DateTosendNotification = DateTime.MinValue;
  15.  
  16. DtIds = Msg.GetListOfDiasendLinkIds();
  17.  
  18. if (DtIds!=null && DtIds.Rows.Count > 0)
  19. {
  20. foreach (DataRow RowId in DtIds.Rows)
  21. {
  22. if (!string.IsNullOrEmpty(RowId["LINK_ID"].ToString()))
  23. {
  24. IntLinkId = Convert.ToInt64(RowId["LINK_ID"].ToString());
  25. }
  26.  
  27. if (IntLinkId > 0)
  28. {
  29. DtMessages = Msg.GetMessageToSend(IntLinkId);
  30.  
  31. if (DtMessages != null && DtMessages.Rows.Count > 0)
  32. {
  33.  
  34. foreach (DataRow MsgRow in DtMessages.Rows)
  35. {
  36. MessageToSend = MsgRow["MessageToReturn"].ToString();
  37.  
  38.  
  39. if (!string.IsNullOrEmpty(MsgRow["MessageId"].ToString()))
  40. {
  41. MessageId = Convert.ToInt32(MsgRow["MessageId"].ToString());
  42. }
  43.  
  44. if (!string.IsNullOrEmpty(MsgRow["DateToSendNotification"].ToString()))
  45. {
  46. DateTosendNotification = Convert.ToDateTime(MsgRow["DateToSendNotification"].ToString());
  47. }
  48.  
  49. Pref = new Preferences(IntLinkId);
  50. Pref.Get();
  51.  
  52. PatInfo = new Gds.GdsPatInfo(IntLinkId);
  53.  
  54. if (Pref != null && PatInfo != null)
  55. {
  56. foreach (Preferences.NotificationTypes NotType in Pref.NotificationPreferenceList)
  57. {
  58. //check at least for message and message date to send
  59. if (!string.IsNullOrEmpty(MessageToSend) && !string.IsNullOrEmpty(DateTosendNotification.ToString()) && DateTosendNotification > DateTime.MinValue)
  60. GdsInsertNotificationQueue(MessageId, MessageToSend, IntLinkId, true, "", DateTosendNotification, NotType.NotificationTypeId, PatInfo.Email, PatInfo.MobileNumber);
  61. }
  62. }
  63. }//end for each message
  64. }//end check for message data table
  65. } //end if we have a row in the messages data table
  66. } //end outer for each
  67. } //end if we have rows in list of link ids data table
  68.  
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement