Friday 2 January 2015

View Record In DataGridView


Imports AppGlobals
Imports AppGlobals.AppGlobal
Imports System.Data.SqlClient
Imports System.Data
Public Class frmShowPRInformation
    '**************************************************************************************************
    '** Developed  By : Ramvinay Singh( Design And Coding)
    '** Created On : 01/08/2013
   '**************************************************************************************************

#Region "Declaration Section"

    'object Declaration
    Private Shared m_frmShowPRInformation As frmShowPRInformation
    Private m_intUser_Permission As AppEnums.enumUser_Permission
    Private mobjDBConnect As New DbConnectPAR()
    Private m_objDataSet As New Data.DataSet()
    Private m_objDataAdapter As SqlClient.SqlDataAdapter
    Private DSDeliveryID As New Data.DataSet()
    Private DSSourceType As New Data.DataSet()
    Private DSFeatureName As New Data.DataSet()
    Private SSpecDocItemNumbers As New Data.DataSet()
    Dim strSQL As String

#End Region

#Region "Properties"
    Public Shared Property m_GetfrmShowPRInformation() As frmShowPRInformation
        Get
            If m_frmShowPRInformation Is Nothing _
                OrElse m_frmShowPRInformation.IsDisposed Then
                m_frmShowPRInformation = New frmShowPRInformation()
            End If
            m_GetfrmShowPRInformation = frmShowPRInformation
        End Get
        Set(ByVal Value As frmShowPRInformation)
            m_frmShowPRInformation = Value
        End Set
    End Property


#End Region

#Region "Form Objects Procedures"
    '
    Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExit.Click
        Me.Close()
    End Sub
 


    Private Sub cmdPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPreview.Click
        Try
            Call fnMyAttendaceDetail()
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, g_strMessageCaption)
        End Try
    End Sub
    Public Function fnFillStaus() As String
        Cursor.Current = Cursors.WaitCursor
        Try
            Dim strSQL As String
            Dim DSStatus As New Data.DataSet()
            strSQL = "SELECT StutusID,Status  FROM dbo.mstStatus"
            DSStatus.Clear()
            Dim sqlCmd As SqlCommand
            m_objDataAdapter = New SqlClient.SqlDataAdapter()
            mobjDBConnect.OpenConnection()
            sqlCmd = New SqlCommand(strSQL, mobjDBConnect.GetConnection)
            m_objDataAdapter.SelectCommand = sqlCmd
            m_objDataAdapter.Fill(DSStatus, "Status")
            If DSStatus.Tables("Status").Rows.Count <> 0 Then
                cmbStatus.DataSource = DSStatus.Tables("Status")
                cmbStatus.ValueMember = "StutusID"
                cmbStatus.DisplayMember = "Status"
            End If
        Catch ex As Exception
            Cursor.Current = Cursors.Default
            MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, g_strMessageCaption)
        End Try

    End Function
    Private Function fnMyAttendaceDetail()
        Try
            m_FillRecordDatagrid()
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, g_strMessageCaption)
        End Try
    End Function
    Public Sub m_FillRecordDatagrid()
        Try
            Dim sqlCmd As New SqlCommand
            Dim dsRec As New Data.DataSet()
            Dim DA As New SqlDataAdapter
            dgvPRInformation.AllowUserToAddRows = False
            dgvPRInformation.AllowUserToDeleteRows = False
            m_objDataAdapter = New SqlClient.SqlDataAdapter()
            mobjDBConnect.OpenConnection()
            Dim sqlpp As New SqlParameter
            sqlCmd.Connection = mobjDBConnect.GetConnection
            sqlCmd.CommandType = CommandType.StoredProcedure
            sqlCmd.CommandText = "spPRInformation"
            sqlCmd.Parameters.AddWithValue("@Flag", 8)
            Dim Status As String = ""
            If (cmbStatus.SelectedValue = 1) Then
                Status = ""
            ElseIf (cmbStatus.SelectedValue = 2) Then
                Status = "A"
            ElseIf (cmbStatus.SelectedValue = 3) Then
                Status = "R"
            ElseIf (cmbStatus.SelectedValue = 4) Then
                Status = "All"

            End If
            sqlCmd.Parameters.AddWithValue("@Status", Status)
            m_objDataAdapter.SelectCommand = sqlCmd
            Dim SQLP As SqlParameter = sqlCmd.Parameters.Add("RETURN_VALUE", SqlDbType.BigInt)
            SQLP.Direction = ParameterDirection.ReturnValue
            Try
                DA = New SqlDataAdapter(sqlCmd)
                DA.Fill(dsRec)
                dgvPRInformation.Rows.Clear()
                If dsRec.Tables(0).Rows.Count <> 0 Then
                    Dim ictr As Integer
                    dgvPRInformation.Rows.Add(dsRec.Tables(0).Rows.Count)
                    For ictr = 0 To dsRec.Tables(0).Rows.Count - 1
                        dgvPRInformation.Rows(ictr).Cells(1).Value = dsRec.Tables(0).Rows(ictr).Item("PRInfoId")
                        dgvPRInformation.Rows(ictr).Cells(2).Value = dsRec.Tables(0).Rows(ictr).Item("DeliveryVersion")
                        dgvPRInformation.Rows(ictr).Cells(3).Value = dsRec.Tables(0).Rows(ictr).Item("DeliveryID")
                        dgvPRInformation.Rows(ictr).Cells(4).Value = dsRec.Tables(0).Rows(ictr).Item("SourceType")
                        dgvPRInformation.Rows(ictr).Cells(5).Value = dsRec.Tables(0).Rows(ictr).Item("GridID")
                        dgvPRInformation.Rows(ictr).Cells(6).Value = dsRec.Tables(0).Rows(ictr).Item("LinenPageNo")
                        dgvPRInformation.Rows(ictr).Cells(7).Value = dsRec.Tables(0).Rows(ictr).Item("LinenSourceImagePath")
                        dgvPRInformation.Rows(ictr).Cells(8).Value = dsRec.Tables(0).Rows(ictr).Item("ServiceCardImagePath")
                        dgvPRInformation.Rows(ictr).Cells(9).Value = dsRec.Tables(0).Rows(ictr).Item("SiteID")
                        dgvPRInformation.Rows(ictr).Cells(10).Value = dsRec.Tables(0).Rows(ictr).Item("PostedBy")
                        dgvPRInformation.Rows(ictr).Cells(11).Value = dsRec.Tables(0).Rows(ictr).Item("FeatureName")
                        dgvPRInformation.Rows(ictr).Cells(12).Value = dsRec.Tables(0).Rows(ictr).Item("GisID")
                        dgvPRInformation.Rows(ictr).Cells(13).Value = dsRec.Tables(0).Rows(ictr).Item("StreetName")
                        dgvPRInformation.Rows(ictr).Cells(14).Value = dsRec.Tables(0).Rows(ictr).Item("IssueDescription")
                        dgvPRInformation.Rows(ictr).Cells(15).Value = dsRec.Tables(0).Rows(ictr).Item("SpecDocItemNumbers")
                        dgvPRInformation.Rows(ictr).Cells(16).Value = dsRec.Tables(0).Rows(ictr).Item("Status")

                        dgvPRInformation.Rows(ictr).Cells(0).ReadOnly = False
                        dgvPRInformation.Rows(ictr).Cells(1).ReadOnly = True
                        dgvPRInformation.Rows(ictr).Cells(2).ReadOnly = True
                        dgvPRInformation.Rows(ictr).Cells(3).ReadOnly = True
                        dgvPRInformation.Rows(ictr).Cells(4).ReadOnly = True
                        dgvPRInformation.Rows(ictr).Cells(5).ReadOnly = True
                        dgvPRInformation.Rows(ictr).Cells(6).ReadOnly = True
                        dgvPRInformation.Rows(ictr).Cells(7).ReadOnly = True
                        dgvPRInformation.Rows(ictr).Cells(8).ReadOnly = True
                        dgvPRInformation.Rows(ictr).Cells(9).ReadOnly = True
                        dgvPRInformation.Rows(ictr).Cells(10).ReadOnly = True
                        dgvPRInformation.Rows(ictr).Cells(11).ReadOnly = True
                        dgvPRInformation.Rows(ictr).Cells(12).ReadOnly = True
                        dgvPRInformation.Rows(ictr).Cells(13).ReadOnly = True
                        dgvPRInformation.Rows(ictr).Cells(14).ReadOnly = True
                        dgvPRInformation.Rows(ictr).Cells(15).ReadOnly = True
                        dgvPRInformation.Rows(ictr).Cells(16).ReadOnly = True

                    Next
                End If

             
                Cursor.Current = Cursors.Default
            Catch ex As Exception
                Cursor.Current = Cursors.Default
                MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, g_strMessageCaption)
            End Try
        Catch ex As Exception
            Cursor.Current = Cursors.Default
            MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, g_strMessageCaption)
        End Try
    End Sub
 

#End Region

#Region "User Defined Function"
    Public Function fnInitialize_Form() As Boolean
        Try
            m_intUser_Permission = fnGet_User_Permission()
            fnFillStaus()
            fnMyAttendaceDetail()

            Call subEnable_Disable_Controls()
            Return True
        Catch ex As Exception
            MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, g_strMessageCaption)
            Return False
        End Try
    End Function
    Private Sub btnAprove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAprove.Click
        Try
            Dim isSelected As Boolean
            Dim IsRecord As Boolean = False
            If (dgvPRInformation.Rows.Count > 0) Then
                For Each row As DataGridViewRow In dgvPRInformation.Rows
                    isSelected = Convert.ToBoolean(row.Cells("checkBoxColumn").Value)
                    If isSelected = True Then
                        ApprovedRecords(row.Cells(1).Value)
                        IsRecord = True
                    End If
                Next
                If (IsRecord = True) Then
                    dgvPRInformation.Rows.Clear()
                    fnMyAttendaceDetail()
                End If
               
            End If
         
        Catch ex As Exception
        End Try

    End Sub

    Private Sub btnReject_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReject.Click
        Try
            Dim isSelected As Boolean
            Dim IsRecord As Boolean = False
            If (dgvPRInformation.Rows.Count > 0) Then
                For Each row As DataGridViewRow In dgvPRInformation.Rows
                    isSelected = Convert.ToBoolean(row.Cells("checkBoxColumn").Value)
                    If isSelected = True Then
                        RejectedRecords(row.Cells(1).Value)
                        IsRecord = True
                    End If
                Next
                If (IsRecord = True) Then
                    dgvPRInformation.Rows.Clear()
                    fnMyAttendaceDetail()
                End If
            End If
        Catch ex As Exception

        End Try
    End Sub

    Private Sub ApprovedRecords(ByVal PRInfoId As Integer)
        Dim CMD As New SqlCommand
        Dim RecIDCust As Long
        mobjDBConnect.OpenConnection()
        Dim sqlpp As New SqlParameter
        CMD.Connection = mobjDBConnect.GetConnection
        CMD.CommandType = CommandType.StoredProcedure
        CMD.CommandText = "spPRInformation"
        CMD.Parameters.AddWithValue("@PRInfoId", PRInfoId)
        CMD.Parameters.AddWithValue("@Status", "A")
        CMD.Parameters.AddWithValue("@ApprovedBy", mdlPMGlobal.glbstrUser_Name)
        CMD.Parameters.AddWithValue("@Flag", 6)
        RecIDCust = CMD.ExecuteNonQuery()
        If (RecIDCust > 0) Then
         
        End If


    End Sub
    Private Sub RejectedRecords(ByVal PRInfoId As Integer)
        Dim CMD As New SqlCommand
        Dim RecIDCust As Long
        mobjDBConnect.OpenConnection()
        Dim sqlpp As New SqlParameter
        CMD.Connection = mobjDBConnect.GetConnection
        CMD.CommandType = CommandType.StoredProcedure
        CMD.CommandText = "spPRInformation"
        CMD.Parameters.AddWithValue("@PRInfoId", PRInfoId)
        CMD.Parameters.AddWithValue("@Status", "R")
        CMD.Parameters.AddWithValue("@RejectedBy", mdlPMGlobal.glbstrUser_Name)
        CMD.Parameters.AddWithValue("@Flag", 7)
        RecIDCust = CMD.ExecuteNonQuery()
        If (RecIDCust > 0) Then
       
        End If


    End Sub
    Private Sub subEnable_Disable_Controls()
   
        If (m_intUser_Permission = AppEnums.enumUser_Permission.eView_Records) Or (m_intUser_Permission = AppEnums.enumUser_Permission.eAdd_Records) Or _
          (m_intUser_Permission = AppEnums.enumUser_Permission.eAdministrator) Then
            cmdPreview.Enabled = True
            grpHeader.Enabled = True
        End If
    End Sub

#End Region


    Private Sub frmAttn_FromTo_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        '869, 535
        If Me.Width < 869 Or Me.Height < 535 Then
            Me.Width = 869
            Me.Height = 535
            Exit Sub
        End If
        '855, 48
        grpHeader.Width = Me.Width - 15
        '855, 457
        grpbxMstList.Width = Me.Width - 15
        grpbxMstList.Height = Me.Height - 78
        '844, 439
        dgvPRInformation.Width = grpbxMstList.Width - 10
        dgvPRInformation.Height = grpbxMstList.Height - 18
        dgvPRInformation.Columns(0).Width = 40
        dgvPRInformation.Columns(1).Width = dgvPRInformation.Width / 12
        dgvPRInformation.Columns(2).Width = dgvPRInformation.Width / 12
        dgvPRInformation.Columns(3).Width = dgvPRInformation.Width / 12
        dgvPRInformation.Columns(4).Width = dgvPRInformation.Width / 12
        dgvPRInformation.Columns(5).Width = dgvPRInformation.Width / 12
        dgvPRInformation.Columns(6).Width = dgvPRInformation.Width / 12
        dgvPRInformation.Columns(7).Width = dgvPRInformation.Width / 12
        dgvPRInformation.Columns(8).Width = dgvPRInformation.Width / 12
        dgvPRInformation.Columns(9).Width = dgvPRInformation.Width / 12
        dgvPRInformation.Columns(10).Width = dgvPRInformation.Width / 12
        dgvPRInformation.Columns(11).Width = dgvPRInformation.Width / 12
        dgvPRInformation.Columns(12).Width = dgvPRInformation.Width / 12
        dgvPRInformation.Columns(13).Width = (dgvPRInformation.Width / 12) * 2
        dgvPRInformation.Columns(15).Width = (dgvPRInformation.Width / 12)
        dgvPRInformation.Columns(14).Width = (dgvPRInformation.Width / 12) * 4


    End Sub

 

    Private Sub cmdResetFilter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdResetFilter.Click
        Try
            cmbStatus.SelectedIndex = 0
            fnMyAttendaceDetail()
        Catch ex As Exception

        End Try
    End Sub

 
    Private Sub dgvPRInformation_CellDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvPRInformation.CellDoubleClick
        Dim PRInfoId As Int16 = 0
        Dim DsgetValue As New DataSet
        Try

            Dim strReturnDataString As String
            strReturnDataString = ""
            fnFillDeliveryID()
            fnFillSourceType()
            fnFillFeatureName()
            fnFillSpecDocItemNumbers()

            frmInformationPRApproveReject.m_GetfrmInformationPRAR.getARPRInfoID = strReturnDataString & dgvPRInformation.SelectedRows(0).Cells(1).Value.ToString
            PRInfoId = frmInformationPRApproveReject.m_GetfrmInformationPRAR.getARPRInfoID
            If (PRInfoId <> 0) Then
                Dim sqlCmd As New SqlCommand
                Dim DA As New SqlDataAdapter

                mobjDBConnect.OpenConnection()

                sqlCmd.Connection = mobjDBConnect.GetConnection
                sqlCmd.CommandType = CommandType.StoredProcedure
                sqlCmd.CommandText = "spPRInformation"
                sqlCmd.Parameters.AddWithValue("@PRInfoId", PRInfoId)
                sqlCmd.Parameters.AddWithValue("@Flag", 3)
                DA.SelectCommand = sqlCmd
                Dim SQLP As SqlParameter = sqlCmd.Parameters.Add("RETURN_VALUE", SqlDbType.BigInt)
                SQLP.Direction = ParameterDirection.ReturnValue
                '
                DA = New SqlDataAdapter(sqlCmd)
                DA.Fill(DsgetValue)
                If DsgetValue.Tables(0).Rows.Count <> 0 Then

                    frmInformationPRApproveReject.m_GetfrmInformationPRAR.txtDivisionVersion.Text = DsgetValue.Tables(0).Rows(0).Item("DeliveryVersion")
                    frmInformationPRApproveReject.m_GetfrmInformationPRAR.txtServicesCardImagepath.Text = DsgetValue.Tables(0).Rows(0).Item("ServiceCardImagePath")
                    frmInformationPRApproveReject.m_GetfrmInformationPRAR.txtLinenSourcePath.Text = DsgetValue.Tables(0).Rows(0).Item("LinenSourceImagePath")
                    frmInformationPRApproveReject.m_GetfrmInformationPRAR.txtLinenPageNo.Text = DsgetValue.Tables(0).Rows(0).Item("LinenPageNo")
                    frmInformationPRApproveReject.m_GetfrmInformationPRAR.txtGridId.Text = DsgetValue.Tables(0).Rows(0).Item("GridID")
                    frmInformationPRApproveReject.m_GetfrmInformationPRAR.txtSiteID.Text = DsgetValue.Tables(0).Rows(0).Item("SiteID")
                    frmInformationPRApproveReject.m_GetfrmInformationPRAR.txtPostedBy.Text = DsgetValue.Tables(0).Rows(0).Item("PostedBy")
                    frmInformationPRApproveReject.m_GetfrmInformationPRAR.txtGISID.Text = DsgetValue.Tables(0).Rows(0).Item("GisID")
                    frmInformationPRApproveReject.m_GetfrmInformationPRAR.txtStreatName.Text = DsgetValue.Tables(0).Rows(0).Item("StreetName")
                    frmInformationPRApproveReject.m_GetfrmInformationPRAR.txtIssuesDisc.Text = DsgetValue.Tables(0).Rows(0).Item("IssueDescription")

                    frmInformationPRApproveReject.m_GetfrmInformationPRAR.cmbDeliveryID.SelectedIndex = Convert.ToInt32(DsgetValue.Tables(0).Rows(0).Item("DeliveryNo"))
                    frmInformationPRApproveReject.m_GetfrmInformationPRAR.cmbSourceType.SelectedIndex = Convert.ToInt32(DsgetValue.Tables(0).Rows(0).Item("SourceTypeID"))
                    frmInformationPRApproveReject.m_GetfrmInformationPRAR.cmbFeatureName.SelectedIndex = Convert.ToInt32(DsgetValue.Tables(0).Rows(0).Item("FeatureNameID"))
                    frmInformationPRApproveReject.m_GetfrmInformationPRAR.cmbSpecDoc.SelectedIndex = Convert.ToInt32(DsgetValue.Tables(0).Rows(0).Item("SpecDocID"))

                    frmInformationPRApproveReject.m_GetfrmInformationPRAR.btnApprove.Visible = True
                    frmInformationPRApproveReject.m_GetfrmInformationPRAR.btnReject.Visible = True

                End If
            End If
            With frmInformationPRApproveReject.m_GetfrmInformationPRAR
                .ShowInTaskbar = False
                .StartPosition = FormStartPosition.CenterScreen
                .ShowDialog()
            End With
            fnMyAttendaceDetail()

        Catch ex As Exception
            MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, "Project Manager")
            Exit Try
        Finally
        End Try
    End Sub

 
    Public Function fnFillDeliveryID() As String
        Cursor.Current = Cursors.WaitCursor
        Try
            Dim strSQL As String
            strSQL = "SELECT DeliveryNo,DeliveryID  FROM dbo.mstDelivery  "
            DSDeliveryID.Clear()
            Dim sqlCmd As SqlCommand
            m_objDataAdapter = New SqlClient.SqlDataAdapter()
            mobjDBConnect.OpenConnection()
            sqlCmd = New SqlCommand(strSQL, mobjDBConnect.GetConnection)
            m_objDataAdapter.SelectCommand = sqlCmd
            m_objDataAdapter.Fill(DSDeliveryID, "Delivery")
            m_objDataAdapter.Fill(DSDeliveryID, "Delivery")
            Dim dr As DataRow = DSDeliveryID.Tables("Delivery").NewRow()
            dr(0) = "-1"
            dr(1) = "-- Select --"
            DSDeliveryID.Tables("Delivery").Rows.InsertAt(dr, 0)
            If DSDeliveryID.Tables("Delivery").Rows.Count <> 0 Then
                frmInformationPRApproveReject.m_GetfrmInformationPRAR.cmbDeliveryID.DataSource = DSDeliveryID.Tables("Delivery")
                frmInformationPRApproveReject.m_GetfrmInformationPRAR.cmbDeliveryID.ValueMember = "DeliveryNo"
                frmInformationPRApproveReject.m_GetfrmInformationPRAR.cmbDeliveryID.DisplayMember = "DeliveryID"
            End If
        Catch ex As Exception
            Cursor.Current = Cursors.Default
            MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, g_strMessageCaption)
        End Try

    End Function

 

    Public Function fnFillSourceType() As String
        Cursor.Current = Cursors.WaitCursor
        Try
            Dim strSQL As String
            Dim m_objDataSetSourceType As New Data.DataSet()
            strSQL = "SELECT SourceTypeID,SourceType  FROM dbo.mstSourceType"
            DSSourceType.Clear()
            Dim sqlCmd As SqlCommand
            m_objDataAdapter = New SqlClient.SqlDataAdapter()
            mobjDBConnect.OpenConnection()
            sqlCmd = New SqlCommand(strSQL, mobjDBConnect.GetConnection)
            m_objDataAdapter.SelectCommand = sqlCmd
            m_objDataAdapter.Fill(DSSourceType, "SourceType")
            Dim dr As DataRow = DSSourceType.Tables("SourceType").NewRow()
            dr(0) = "-1"
            dr(1) = "-- Select --"
            DSSourceType.Tables("SourceType").Rows.InsertAt(dr, 0)
            If DSSourceType.Tables("SourceType").Rows.Count <> 0 Then
                frmInformationPRApproveReject.m_GetfrmInformationPRAR.cmbSourceType.DataSource = DSSourceType.Tables("SourceType")
                frmInformationPRApproveReject.m_GetfrmInformationPRAR.cmbSourceType.ValueMember = "SourceTypeID"
                frmInformationPRApproveReject.m_GetfrmInformationPRAR.cmbSourceType.DisplayMember = "SourceType"
            End If
        Catch ex As Exception
            Cursor.Current = Cursors.Default
            MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, g_strMessageCaption)
        End Try

    End Function


    Public Function fnFillFeatureName() As String
        Cursor.Current = Cursors.WaitCursor
        Try
            Dim strSQLFeatureName As String
            Dim DSFeatureName As New Data.DataSet()
            strSQLFeatureName = "SELECT FeatureNameID,FeatureName  FROM dbo.mstFeatureName "
            DSFeatureName.Clear()
            Dim sqlCmd As SqlCommand
            m_objDataAdapter = New SqlClient.SqlDataAdapter()
            mobjDBConnect.OpenConnection()
            sqlCmd = New SqlCommand(strSQLFeatureName, mobjDBConnect.GetConnection)
            m_objDataAdapter.SelectCommand = sqlCmd
            m_objDataAdapter.Fill(DSFeatureName, "FeatureName")
            Dim dr As DataRow = DSFeatureName.Tables("FeatureName").NewRow()
            dr(0) = "-1"
            dr(1) = "-- Select --"
            DSFeatureName.Tables("FeatureName").Rows.InsertAt(dr, 0)
            If DSFeatureName.Tables("FeatureName").Rows.Count <> 0 Then
                frmInformationPRApproveReject.m_GetfrmInformationPRAR.cmbFeatureName.DataSource = DSFeatureName.Tables("FeatureName")
                frmInformationPRApproveReject.m_GetfrmInformationPRAR.cmbFeatureName.ValueMember = "FeatureNameID"
                frmInformationPRApproveReject.m_GetfrmInformationPRAR.cmbFeatureName.DisplayMember = "FeatureName"
            End If
        Catch ex As Exception
            Cursor.Current = Cursors.Default
            MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, g_strMessageCaption)
        End Try

    End Function

    Public Function fnFillSpecDocItemNumbers() As String
        Cursor.Current = Cursors.WaitCursor
        Try
            Dim strSQLSpecDocItemNumbers As String
            Dim DSSpecDocItemNumbers As New Data.DataSet()
            strSQLSpecDocItemNumbers = "SELECT SpecDocID,SpecDocItemNumbers  FROM dbo.mstSpecDocItemNumbers"
            DSSpecDocItemNumbers.Clear()
            Dim sqlCmd As SqlCommand
            m_objDataAdapter = New SqlClient.SqlDataAdapter()
            mobjDBConnect.OpenConnection()
            sqlCmd = New SqlCommand(strSQLSpecDocItemNumbers, mobjDBConnect.GetConnection)
            m_objDataAdapter.SelectCommand = sqlCmd
            m_objDataAdapter.Fill(DSSpecDocItemNumbers, "SpecDocItemNumbers")
            Dim dr As DataRow = DSSpecDocItemNumbers.Tables("SpecDocItemNumbers").NewRow()
            dr(0) = "-1"
            dr(1) = "-- Select --"
            DSSpecDocItemNumbers.Tables("SpecDocItemNumbers").Rows.InsertAt(dr, 0)
            If DSSpecDocItemNumbers.Tables("SpecDocItemNumbers").Rows.Count <> 0 Then
                frmInformationPRApproveReject.m_GetfrmInformationPRAR.cmbSpecDoc.DataSource = DSSpecDocItemNumbers.Tables("SpecDocItemNumbers")
                frmInformationPRApproveReject.m_GetfrmInformationPRAR.cmbSpecDoc.ValueMember = "SpecDocID"
                frmInformationPRApproveReject.m_GetfrmInformationPRAR.cmbSpecDoc.DisplayMember = "SpecDocItemNumbers"
            End If
        Catch ex As Exception
            Cursor.Current = Cursors.Default
            MsgBox(ex.Message.ToString, MsgBoxStyle.Critical, g_strMessageCaption)
        End Try

    End Function

    Private Sub btnExportToExcel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExportToExcel.Click
        With frmDeliveryDilogBox.m_GetfrmDeliveryDilogBox
            If .fnInitialize_Form() Then
                .ShowInTaskbar = False
                .StartPosition = FormStartPosition.CenterScreen
                .ShowDialog()
            End If
        End With
    End Sub

    Private Sub frmShowPRInformation_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        Try
            If e.KeyCode = Keys.Escape Then Me.Close()
        Catch ex As Exception

        End Try
    End Sub
End Class

No comments:

Post a Comment