daily pastebin goal
57%
SHARE
TWEET

Vendor Items

CryptoJones Jan 22nd, 2016 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.Configuration
  2. Imports System.Data.SqlClient
  3.  
  4. Public Class VenItems
  5.   Protected Overrides Sub OnLoad(e As EventArgs)
  6.     For Each C In Me.Controls
  7.       If (TypeOf C Is Label) Then
  8.         CommonFunctions.LocalizeLabel(C)
  9.       End If
  10.     Next
  11.     RestoreDefaults()
  12.   End Sub
  13.  
  14.   Public Shared Sub LoadVendor(vendor As Integer)
  15.  
  16.     Dim dbConnectSuccess As Boolean
  17.     Dim _
  18.       _povName,
  19.       _povMailingAddress1,
  20.       _povMailingAddress2,
  21.       _povMailingCity,
  22.       _povMailingState,
  23.       _povMailingCountry,
  24.       _povMailingZip,
  25.       _povBillingAddress1,
  26.       _povBillingAddress2,
  27.       _povBillingCity,
  28.       _povBillingState,
  29.       _povBillingCountry,
  30.       _povBillingZip,
  31.       _povPhone,
  32.       _povEMail As String
  33.  
  34.     Using conn As New SqlConnection()
  35.       conn.ConnectionString = ConfigurationManager.ConnectionStrings("poConnectionString").ConnectionString
  36.       Dim command =
  37.               New SqlCommand(
  38.                 "select povName, povMailingAddress1, povMailingCity, povMailingState, povMailingCountry, povMailingZip, povBillingAddress1, povBillingAddress2, povBillingCity, povBillingState, povBillingCountry, povBillingZip, povPhone, povEMail FROM PurchaseOrderVendor WHERE povId = '" &
  39.                 vendor & "'", conn)
  40.       ' gets vendor details
  41.      conn.Open()
  42.       Dim reader As SqlDataReader = command.ExecuteReader()
  43.       reader.Read()
  44.       If Not (reader.HasRows()) Then
  45.         dbConnectSuccess = False
  46.       Else
  47.         If (reader.IsDBNull(0)) Then
  48.           _povName = String.Empty
  49.         Else
  50.           _povName = reader.GetString(0)
  51.         End If
  52.  
  53.         If (reader.IsDBNull(1)) Then
  54.           _povMailingAddress1 = String.Empty
  55.         Else
  56.           _povMailingAddress1 = reader.GetString(1)
  57.         End If
  58.  
  59.         If (reader.IsDBNull(2)) Then
  60.           _povMailingCity = String.Empty
  61.         Else
  62.           _povMailingCity = reader.GetString(2)
  63.         End If
  64.  
  65.         If (reader.IsDBNull(3)) Then
  66.           _povMailingState = String.Empty
  67.         Else
  68.           _povMailingState = reader.GetString(3)
  69.         End If
  70.  
  71.         If (reader.IsDBNull(4)) Then
  72.           _povMailingCountry = String.Empty
  73.         Else
  74.           _povMailingCountry = reader.GetString(4)
  75.         End If
  76.  
  77.         If (reader.IsDBNull(5)) Then
  78.           _povMailingZip = String.Empty
  79.         Else
  80.           _povMailingZip = reader.GetString(5)
  81.         End If
  82.  
  83.         If (reader.IsDBNull(6)) Then
  84.           _povBillingAddress1 = String.Empty
  85.         Else
  86.           _povBillingAddress1 = reader.GetString(6)
  87.         End If
  88.  
  89.         If (reader.IsDBNull(7)) Then
  90.           _povBillingAddress2 = String.Empty
  91.         Else
  92.           _povBillingAddress2 = reader.GetString(7)
  93.         End If
  94.  
  95.         If (reader.IsDBNull(8)) Then
  96.           _povBillingCity = String.Empty
  97.         Else
  98.           _povBillingCity = reader.GetString(8)
  99.         End If
  100.  
  101.         If (reader.IsDBNull(9)) Then
  102.           _povBillingState = String.Empty
  103.         Else
  104.           _povBillingState = reader.GetString(9)
  105.         End If
  106.  
  107.         If (reader.IsDBNull(10)) Then
  108.           _povBillingCountry = String.Empty
  109.         Else
  110.           _povBillingCountry = reader.GetString(10)
  111.         End If
  112.  
  113.         If (reader.IsDBNull(11)) Then
  114.           _povBillingZip = String.Empty
  115.         Else
  116.           _povBillingZip = reader.GetString(11)
  117.         End If
  118.  
  119.         If (reader.IsDBNull(12)) Then
  120.           _povPhone = String.Empty
  121.         Else
  122.           _povPhone = reader.GetString(12)
  123.         End If
  124.  
  125.         If (reader.IsDBNull(13)) Then
  126.           _povEMail = String.Empty
  127.         Else
  128.           _povEMail = reader.GetString(13)
  129.         End If
  130.       End If
  131.       reader.Close()
  132.     End Using
  133.  
  134.     Dim myVen = New PurchaseOrderVendor(vendor, _povName, _povMailingAddress1,
  135.                                                              _povMailingAddress2, _povMailingCity,
  136.                                                              _povMailingState, _povMailingCountry, _povMailingZip,
  137.                                                              _povBillingAddress1, _povBillingAddress2,
  138.                                                              _povBillingCity, _povBillingState, _povBillingCountry,
  139.                                                              _povBillingZip, _povPhone, _povEMail)
  140.     UpdateFieldsWithVendorInfo(myVen)
  141.  
  142.   End Sub
  143.  
  144.   Public Sub UpdateFieldsWithVendorInfo(ByRef pov As PurchaseOrderVendor)
  145.  
  146.   End Sub
  147.  
  148.   Public Sub RestoreDefaults()
  149.     cbVenList.Enabled = False
  150.     cbVenList.Visible = False
  151.     tbVenAddress1.Text = String.Empty
  152.     tbVenAddress1.Enabled = False
  153.     tbVenAddress2.Text = String.Empty
  154.     tbVenAddress2.Enabled = False
  155.     tbVenCity.Text = String.Empty
  156.     tbVenCity.Enabled = False
  157.     tbVenState.Text = String.Empty
  158.     tbVenState.Enabled = False
  159.     tbVenZip.Text = String.Empty
  160.     tbVenZip.Enabled = False
  161.   End Sub
  162. End Class
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top