Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Configuration
- Imports System.Data.SqlClient
- Public Class VenItems
- Protected Overrides Sub OnLoad(e As EventArgs)
- For Each C In Me.Controls
- If (TypeOf C Is Label) Then
- CommonFunctions.LocalizeLabel(C)
- End If
- Next
- RestoreDefaults()
- End Sub
- Public Shared Sub LoadVendor(vendor As Integer)
- Dim dbConnectSuccess As Boolean
- Dim _
- _povName,
- _povMailingAddress1,
- _povMailingAddress2,
- _povMailingCity,
- _povMailingState,
- _povMailingCountry,
- _povMailingZip,
- _povBillingAddress1,
- _povBillingAddress2,
- _povBillingCity,
- _povBillingState,
- _povBillingCountry,
- _povBillingZip,
- _povPhone,
- _povEMail As String
- Using conn As New SqlConnection()
- conn.ConnectionString = ConfigurationManager.ConnectionStrings("poConnectionString").ConnectionString
- Dim command =
- New SqlCommand(
- "select povName, povMailingAddress1, povMailingCity, povMailingState, povMailingCountry, povMailingZip, povBillingAddress1, povBillingAddress2, povBillingCity, povBillingState, povBillingCountry, povBillingZip, povPhone, povEMail FROM PurchaseOrderVendor WHERE povId = '" &
- vendor & "'", conn)
- ' gets vendor details
- conn.Open()
- Dim reader As SqlDataReader = command.ExecuteReader()
- reader.Read()
- If Not (reader.HasRows()) Then
- dbConnectSuccess = False
- Else
- If (reader.IsDBNull(0)) Then
- _povName = String.Empty
- Else
- _povName = reader.GetString(0)
- End If
- If (reader.IsDBNull(1)) Then
- _povMailingAddress1 = String.Empty
- Else
- _povMailingAddress1 = reader.GetString(1)
- End If
- If (reader.IsDBNull(2)) Then
- _povMailingCity = String.Empty
- Else
- _povMailingCity = reader.GetString(2)
- End If
- If (reader.IsDBNull(3)) Then
- _povMailingState = String.Empty
- Else
- _povMailingState = reader.GetString(3)
- End If
- If (reader.IsDBNull(4)) Then
- _povMailingCountry = String.Empty
- Else
- _povMailingCountry = reader.GetString(4)
- End If
- If (reader.IsDBNull(5)) Then
- _povMailingZip = String.Empty
- Else
- _povMailingZip = reader.GetString(5)
- End If
- If (reader.IsDBNull(6)) Then
- _povBillingAddress1 = String.Empty
- Else
- _povBillingAddress1 = reader.GetString(6)
- End If
- If (reader.IsDBNull(7)) Then
- _povBillingAddress2 = String.Empty
- Else
- _povBillingAddress2 = reader.GetString(7)
- End If
- If (reader.IsDBNull(8)) Then
- _povBillingCity = String.Empty
- Else
- _povBillingCity = reader.GetString(8)
- End If
- If (reader.IsDBNull(9)) Then
- _povBillingState = String.Empty
- Else
- _povBillingState = reader.GetString(9)
- End If
- If (reader.IsDBNull(10)) Then
- _povBillingCountry = String.Empty
- Else
- _povBillingCountry = reader.GetString(10)
- End If
- If (reader.IsDBNull(11)) Then
- _povBillingZip = String.Empty
- Else
- _povBillingZip = reader.GetString(11)
- End If
- If (reader.IsDBNull(12)) Then
- _povPhone = String.Empty
- Else
- _povPhone = reader.GetString(12)
- End If
- If (reader.IsDBNull(13)) Then
- _povEMail = String.Empty
- Else
- _povEMail = reader.GetString(13)
- End If
- End If
- reader.Close()
- End Using
- Dim myVen = New PurchaseOrderVendor(vendor, _povName, _povMailingAddress1,
- _povMailingAddress2, _povMailingCity,
- _povMailingState, _povMailingCountry, _povMailingZip,
- _povBillingAddress1, _povBillingAddress2,
- _povBillingCity, _povBillingState, _povBillingCountry,
- _povBillingZip, _povPhone, _povEMail)
- UpdateFieldsWithVendorInfo(myVen)
- End Sub
- Public Sub UpdateFieldsWithVendorInfo(ByRef pov As PurchaseOrderVendor)
- End Sub
- Public Sub RestoreDefaults()
- cbVenList.Enabled = False
- cbVenList.Visible = False
- tbVenAddress1.Text = String.Empty
- tbVenAddress1.Enabled = False
- tbVenAddress2.Text = String.Empty
- tbVenAddress2.Enabled = False
- tbVenCity.Text = String.Empty
- tbVenCity.Enabled = False
- tbVenState.Text = String.Empty
- tbVenState.Enabled = False
- tbVenZip.Text = String.Empty
- tbVenZip.Enabled = False
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement