MiisApp: PendingExports.vb

Imports System.Data.SqlClient

Public Class PendingExports
Inherits System.Windows.Forms.Form

Public MA As String

Const DISABLES = “jobRunnerDISABLES”
Const DB_CONNECTION_STRING As String = “Database=MIISData;Data Source=MIISSERVER;Integrated Security=TRUE;;”
Const MIISDB_CONNECTION_STRING As String = “Database=MicrosoftIdentityIntegrationServer;Data Source=MIISSERVER;Integrated Security=TRUE;;”
Dim sqlQueryConnection As New SqlConnection(DB_CONNECTION_STRING)
Dim sqlMIISConnection As New SqlConnection(MIISDB_CONNECTION_STRING)

#Region ” Windows Form Designer generated code ”

Public Sub New()
  MyBase.New()

‘This call is required by the Windows Form Designer.
  InitializeComponent()

‘Add any initialization after the InitializeComponent() call

End Sub

‘Form overrides dispose to clean up the component list.
  Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  If disposing Then
  If Not (components Is Nothing) Then
  components.Dispose()
  End If
  End If
  MyBase.Dispose(disposing)
  End Sub

‘Required by the Windows Form Designer
  Private components As System.ComponentModel.IContainer

‘NOTE: The following procedure is required by the Windows Form Designer
  ‘It can be modified using the Windows Form Designer.
  ‘Do not modify it using the code editor.
  Friend WithEvents Txt_PendingExports As System.Windows.Forms.TextBox
  Private Sub InitializeComponent()
  Me.Txt_PendingExports = New System.Windows.Forms.TextBox
  Me.SuspendLayout()
  ‘
  ‘Txt_PendingExports
  ‘
  Me.Txt_PendingExports.Location = New System.Drawing.Point(0, 0)
  Me.Txt_PendingExports.Multiline = True
  Me.Txt_PendingExports.Name = “Txt_PendingExports”
  Me.Txt_PendingExports.ReadOnly = True
  Me.Txt_PendingExports.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
  Me.Txt_PendingExports.Size = New System.Drawing.Size(296, 272)
  Me.Txt_PendingExports.TabIndex = 0
  Me.Txt_PendingExports.Text = “”
  ‘
  ‘PendingExports
  ‘
  Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
  Me.ClientSize = New System.Drawing.Size(292, 273)
  Me.Controls.Add(Me.Txt_PendingExports)
  Me.Name = “PendingExports”
  Me.Text = “Pending Exports”
  Me.ResumeLayout(False)

End Sub

#End Region

Private Sub PendingExports_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DisplayPendingExports(MA)
End Sub

Public Sub DisplayPendingExports(ByVal MA As String)
Dim sqlqueryString As String
Dim rowReader As SqlDataReader
sqlMIISConnection.Open()

‘ADD
sqlqueryString = “select rdn from dbo.mms_connectorspace cs ” & _
“join dbo.mms_management_agent ma ” & _
“on cs.ma_id=ma.ma_id ” & _
“where ma.ma_name='” & MA & “‘ and cs.export_operation = 1”

Dim sqlAddQuery As New SqlCommand(sqlqueryString, sqlMIISConnection)
rowReader = sqlAddQuery.ExecuteReader
While rowReader.Read()
Me.Txt_PendingExports.AppendText(“add ” & rowReader.GetString(0) & vbCrLf)
End While
rowReader.Close()

‘UPDATE
sqlqueryString = “select rdn from dbo.mms_connectorspace cs ” & _
“join dbo.mms_management_agent ma ” & _
“on cs.ma_id=ma.ma_id ” & _
“where ma.ma_name='” & MA & “‘ and cs.export_operation = 2”

Dim sqlUpdateQuery As New SqlCommand(sqlqueryString, sqlMIISConnection)
rowReader = sqlUpdateQuery.ExecuteReader
While rowReader.Read()
Me.Txt_PendingExports.AppendText(“update ” & rowReader.GetString(0) & vbCrLf)
End While
rowReader.Close()

‘DELETE
sqlqueryString = “select rdn from dbo.mms_connectorspace cs ” & _
“join dbo.mms_management_agent ma ” & _
“on cs.ma_id=ma.ma_id ” & _
“where ma.ma_name='” & MA & “‘ and cs.export_operation = 4”

Dim sqlDeleteQuery As New SqlCommand(sqlqueryString, sqlMIISConnection)
rowReader = sqlDeleteQuery.ExecuteReader
While rowReader.Read()
Me.Txt_PendingExports.AppendText(“delete ” & rowReader.GetString(0) & vbCrLf)
End While
rowReader.Close()

sqlMIISConnection.Close()
End Sub

End Class