Untitled


SUBMITTED BY: Guest

DATE: Aug. 8, 2014, 9:56 a.m.

FORMAT: C#

SIZE: 4.2 kB

HITS: 24763

  1. 'Agency Type Literals
  2. Dim agencyTypesLiteral() As String = {"POLICE", "FIRE", "MEDICAL", "EMERGENCY"}
  3. 'Agency Types (Police, Fire, Medical, Emergency)
  4. Dim agencyType() As String = {"P", "F", "M", "9"}
  5. '
  6. vsql = "SELECT AGENCY_ID, AGENCY_NAME, AGENCY_CODE, AGENCY_TYPE FROM CLEAR_ENTITY_AGENCIES WHERE AGENCY_TYPE in " & _
  7. "('P', 'F', 'M', '9') AND ENTITY_ID = " & pEntity_Id & " order by AGENCY_TYPE, AGENCY_NAME"
  8. Dim notRows As New List(Of Notifications)
  9. Using dcNot As New OleDbCommand(vsql, vConn2)
  10. If vConn2.State <> ConnectionState.Open Then vConn2.Open()
  11. Using drNot As OleDbDataReader = dcNot.ExecuteReader
  12. While drNot.Read
  13. If Not IsDBNull(drNot.Item("AGENCY_ID")) Then
  14. 'Build list of all rows of this type to be added
  15. Dim notRow = New Notifications() With
  16. { _
  17. .NotificationId = CInt(Get_Seq("CAD_EVENT_NOTIFICATION_ID", "QuickCall.LoadNotifications")), _
  18. .MasterId = _masterid, _
  19. .EntityId = pEntity_Id, _
  20. .AgencyCode = drNot.Item("AGENCY_CODE").ToString(), _
  21. .AgencyType = agencyTypesLiteral(Array.IndexOf(agencyType, drNot.Item("AGENCY_TYPE").ToString())), _
  22. .AgencyId = drNot.Item("AGENCY_ID").ToString() _
  23. }
  24. 'Add Row to List
  25. notRows.Add(notRow)
  26. End If
  27. End While
  28. End Using
  29. End Using
  30. Dim policeRows = notRows.Where(Function(r) r.AgencyType = "POLICE").ToList()
  31. If policeRows.Count = 0 Then
  32. PageVisible(tabPolice, False)
  33. Else
  34. CreateRows(gridpolice, POLICENOTIFICATIONSBindingSource, policeRows)
  35. SetGridFocused(gridpolice, gridviewpolice, 0)
  36. End If
  37. Dim fireRows = notRows.Where(Function(r) r.AgencyType = "FIRE").ToList()
  38. If fireRows.Count = 0 Then
  39. PageVisible(tabFire, False)
  40. Else
  41. CreateRows(gridfire, FIRENOTIFICATIONSBindingSource, fireRows)
  42. SetGridFocused(gridfire, gridviewfire, 0)
  43. End If
  44. Dim medicalRows = notRows.Where(Function(r) r.AgencyType = "MEDICAL").ToList()
  45. If medicalRows.Count = 0 Then
  46. PageVisible(tabMedical, False)
  47. Else
  48. CreateRows(gridMedical, MEDICALNOTIFICATIONSBindingSource, medicalRows)
  49. SetGridFocused(gridMedical, gridviewmedical, 0)
  50. End If
  51. Dim emergencyRows = notRows.Where(Function(r) r.AgencyType = "EMERGENCY").ToList()
  52. If emergencyRows.Count = 0 Then
  53. PageVisible(tabEmergency, False)
  54. Else
  55. CreateRows(gridEmergency, EMERGENCYNOTIFICATIONSBindingSource, emergencyRows)
  56. SetGridFocused(gridEmergency, gridview911, 0)
  57. End If
  58. notRows.Clear()

comments powered by Disqus