Public Shared Function DeleteVendor(ByVal oldVendor As Vendor, ByVal newVendor As Vendor) As Boolean Dim aServiceFactory As PayableAppServiceFactory = PayableAppServiceFactory.GetInstance() Dim aVendorService As VendorService = aServiceFactory.GetServiceInstance(PayableAppServiceFactory.SERVICE_NAME.Vendor) Return aVendorService.DeleteVendor(oldVendor, newVendor) End Function
Private Sub btnDeleteVendor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDeleteVendor.Click Dim message As String message = "Confirm deletion vendor " & txtVendorID.Text & " : " & NameTextBox.Text & "?" If MessageBox.Show(message, "DELETE VENDOR", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then Try If Not FormActionHandler.DeleteVendor(vendor) Then '---------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ MessageBox.Show("Vendor could not be deleted. Another user has updated or deleted that vendor.", _ "Database Error") Me.GetVendor(vendor.VendorID) Else MessageBox.Show("Vendor has been Deleted") VendorBindingSource.Clear() End If Catch ex As Exception MessageBox.Show(ex.Message, ex.GetType.ToString) End Try End If End Sub End Class
'-----^^^
Public Shared Function DeleteVendor(ByVal oldVendor As Vendor, ByVal newVendor As Vendor) As Boolean
DeleteVendor()
Return aVendorService.DeleteVendor(oldVendor, newVendor)
If Not FormActionHandler.DeleteVendor(vendor) Then
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)