diff --git a/Readme.md b/Readme.md index 1790284..d5df066 100644 --- a/Readme.md +++ b/Readme.md @@ -1,5 +1,4 @@ -![](https://img.shields.io/endpoint?url=https://codecentral.devexpress.com/api/v1/VersionRange/128598055/12.2.8%2B) [![](https://img.shields.io/badge/Open_in_DevExpress_Support_Center-FF7200?style=flat-square&logo=DevExpress&logoColor=white)](https://supportcenter.devexpress.com/ticket/details/E4631) [![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183) diff --git a/VB/MinimalisticReportPreviewDemo/App.xaml b/VB/MinimalisticReportPreviewDemo/App.xaml new file mode 100644 index 0000000..1b9e6a0 --- /dev/null +++ b/VB/MinimalisticReportPreviewDemo/App.xaml @@ -0,0 +1,5 @@ + + + + + diff --git a/VB/MinimalisticReportPreviewDemo/App.xaml.vb b/VB/MinimalisticReportPreviewDemo/App.xaml.vb new file mode 100644 index 0000000..555cfb7 --- /dev/null +++ b/VB/MinimalisticReportPreviewDemo/App.xaml.vb @@ -0,0 +1,12 @@ +Imports System.Windows + +Namespace MinimalisticReportPreviewDemo + + ''' + ''' Interaction logic for App.xaml + ''' + Public Partial Class App + Inherits Application + + End Class +End Namespace diff --git a/VB/MinimalisticReportPreviewDemo/MainWindow.xaml b/VB/MinimalisticReportPreviewDemo/MainWindow.xaml index 71147ee..3122744 100644 --- a/VB/MinimalisticReportPreviewDemo/MainWindow.xaml +++ b/VB/MinimalisticReportPreviewDemo/MainWindow.xaml @@ -1,4 +1,4 @@ - diff --git a/VB/MinimalisticReportPreviewDemo/MainWindow.xaml.vb b/VB/MinimalisticReportPreviewDemo/MainWindow.xaml.vb index 387cd0a..d43fa0a 100644 --- a/VB/MinimalisticReportPreviewDemo/MainWindow.xaml.vb +++ b/VB/MinimalisticReportPreviewDemo/MainWindow.xaml.vb @@ -1,26 +1,27 @@ -Imports Microsoft.VisualBasic Imports System.Windows Imports DevExpress.Xpf.Core Imports DevExpress.Xpf.Printing -' ... +' ... Namespace MinimalisticReportPreviewDemo - ''' - ''' Interaction logic for MainWindow.xaml - ''' - Partial Public Class MainWindow - Inherits Window - Public Sub New() - ThemeManager.ApplicationThemeName = "Office2007Silver" - InitializeComponent() - End Sub - Private Sub ShowPreview(ByVal sender As Object, ByVal e As RoutedEventArgs) - Dim report As New Report() - Dim model As New MyXtraReportPreviewModel(report) - Dim window As New DocumentPreviewWindow() With {.Model = model} - report.CreateDocument(True) - window.ShowDialog() - End Sub - End Class + ''' + ''' Interaction logic for MainWindow.xaml + ''' + Public Partial Class MainWindow + Inherits System.Windows.Window + + Public Sub New() + ThemeManager.ApplicationThemeName = "Office2007Silver" + Me.InitializeComponent() + End Sub + + Private Sub ShowPreview(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) + Dim report As MinimalisticReportPreviewDemo.Report = New MinimalisticReportPreviewDemo.Report() + Dim model As MinimalisticReportPreviewDemo.MyXtraReportPreviewModel = New MinimalisticReportPreviewDemo.MyXtraReportPreviewModel(report) + Dim window As DocumentPreviewWindow = New DocumentPreviewWindow() With {.Model = model} + report.CreateDocument(True) + window.ShowDialog() + End Sub + End Class End Namespace diff --git a/VB/MinimalisticReportPreviewDemo/MinimalisticReportPreviewDemo.vbproj b/VB/MinimalisticReportPreviewDemo/MinimalisticReportPreviewDemo.vbproj index 96e7046..7fa44a3 100644 --- a/VB/MinimalisticReportPreviewDemo/MinimalisticReportPreviewDemo.vbproj +++ b/VB/MinimalisticReportPreviewDemo/MinimalisticReportPreviewDemo.vbproj @@ -1,22 +1,23 @@  + On Debug x86 8.0.30703 2.0 {03842F9F-5A5D-4B93-9165-A9B9D325709C} WinExe - + Properties + + MinimalisticReportPreviewDemo v4.0 - On - Binary - Off - On - + + 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F} + 4 x86 @@ -24,19 +25,19 @@ full false bin\Debug\ - true - true + DEBUG,TRACE prompt - true + 4 + false x86 pdbonly true bin\Release\ - false - true + TRACE prompt + 4 @@ -93,7 +94,7 @@ - + MSBuild:Compile Designer @@ -110,8 +111,8 @@ MSBuild:Compile Designer - - Application.xaml + + App.xaml Code @@ -120,22 +121,23 @@ - + Code - + True True Resources.resx - + True Settings.settings True - + ResXFileCodeGenerator Resources.Designer.vb + MinimalisticReportPreviewDemo.Properties Report.vb @@ -152,11 +154,11 @@ nwindDataSet.xsd - + SettingsSingleFileGenerator Settings.Designer.vb - + @@ -164,7 +166,7 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/VB/MinimalisticReportPreviewDemo/Properties/Settings.Designer.vb b/VB/MinimalisticReportPreviewDemo/Properties/Settings.Designer.vb new file mode 100644 index 0000000..122c2df --- /dev/null +++ b/VB/MinimalisticReportPreviewDemo/Properties/Settings.Designer.vb @@ -0,0 +1,35 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.1 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ +Namespace MinimalisticReportPreviewDemo.Properties + + + + Friend NotInheritable Partial Class Settings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MinimalisticReportPreviewDemo.Properties.Settings = CType((Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MinimalisticReportPreviewDemo.Properties.Settings())), MinimalisticReportPreviewDemo.Properties.Settings) + + Public Shared ReadOnly Property [Default] As Settings + Get + Return MinimalisticReportPreviewDemo.Properties.Settings.defaultInstance + End Get + End Property + + + + + + Public ReadOnly Property nwindConnectionString As String + Get + Return(CStr((Me("nwindConnectionString")))) + End Get + End Property + End Class +End Namespace diff --git a/VB/MinimalisticReportPreviewDemo/Properties/Settings.settings b/VB/MinimalisticReportPreviewDemo/Properties/Settings.settings new file mode 100644 index 0000000..d0e4e1b --- /dev/null +++ b/VB/MinimalisticReportPreviewDemo/Properties/Settings.settings @@ -0,0 +1,14 @@ + + + + + + <?xml version="1.0" encoding="utf-16"?> +<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <ConnectionString>Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\nwind.mdb;Persist Security Info=True</ConnectionString> + <ProviderName>System.Data.OleDb</ProviderName> +</SerializableConnectionString> + Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\nwind.mdb;Persist Security Info=True + + + \ No newline at end of file diff --git a/VB/MinimalisticReportPreviewDemo/Report.vb b/VB/MinimalisticReportPreviewDemo/Report.vb index d4ae7cc..8333d5e 100644 --- a/VB/MinimalisticReportPreviewDemo/Report.vb +++ b/VB/MinimalisticReportPreviewDemo/Report.vb @@ -1,107 +1,113 @@ -Imports Microsoft.VisualBasic Imports System Imports DevExpress.XtraReports.UI Namespace MinimalisticReportPreviewDemo - Public Class Report - Inherits DevExpress.XtraReports.UI.XtraReport - Private Detail As DevExpress.XtraReports.UI.DetailBand - Private topMarginBand1 As DevExpress.XtraReports.UI.TopMarginBand - Private nwindDataSet1 As nwindDataSet - Private productsTableAdapter As nwindDataSetTableAdapters.ProductsTableAdapter - Private xrLabel1 As DevExpress.XtraReports.UI.XRLabel - Private ReportHeader As DevExpress.XtraReports.UI.ReportHeaderBand - Private xrLabel2 As DevExpress.XtraReports.UI.XRLabel - Private bottomMarginBand1 As DevExpress.XtraReports.UI.BottomMarginBand - Public Sub New() - InitializeComponent() - End Sub + Public Class Report + Inherits DevExpress.XtraReports.UI.XtraReport - Private Sub InitializeComponent() - Me.Detail = New DevExpress.XtraReports.UI.DetailBand() - Me.xrLabel1 = New DevExpress.XtraReports.UI.XRLabel() - Me.xrLabel2 = New DevExpress.XtraReports.UI.XRLabel() - Me.topMarginBand1 = New DevExpress.XtraReports.UI.TopMarginBand() - Me.bottomMarginBand1 = New DevExpress.XtraReports.UI.BottomMarginBand() - Me.nwindDataSet1 = New nwindDataSet() - Me.productsTableAdapter = New nwindDataSetTableAdapters.ProductsTableAdapter() - Me.ReportHeader = New DevExpress.XtraReports.UI.ReportHeaderBand() - CType(Me.nwindDataSet1, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me, System.ComponentModel.ISupportInitialize).BeginInit() - ' - ' Detail - ' - Me.Detail.Controls.AddRange(New DevExpress.XtraReports.UI.XRControl() { Me.xrLabel1}) - Me.Detail.HeightF = 33.00001F - Me.Detail.Name = "Detail" - Me.Detail.Padding = New DevExpress.XtraPrinting.PaddingInfo(0, 0, 0, 0, 100F) - Me.Detail.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopLeft - ' - ' xrLabel1 - ' - Me.xrLabel1.BookmarkParent = Me.xrLabel2 - Me.xrLabel1.DataBindings.AddRange(New DevExpress.XtraReports.UI.XRBinding() { New DevExpress.XtraReports.UI.XRBinding("Text", Nothing, "Products.ProductName"), New DevExpress.XtraReports.UI.XRBinding("Bookmark", Nothing, "Products.ProductName")}) - Me.xrLabel1.Font = New System.Drawing.Font("Arial", 9.75F) - Me.xrLabel1.LocationFloat = New DevExpress.Utils.PointFloat(10.00001F, 10.00001F) - Me.xrLabel1.Name = "xrLabel1" - Me.xrLabel1.Padding = New DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F) - Me.xrLabel1.SizeF = New System.Drawing.SizeF(408.3333F, 23F) - Me.xrLabel1.StylePriority.UseFont = False - Me.xrLabel1.StylePriority.UseTextAlignment = False - Me.xrLabel1.Text = "xrLabel1" - Me.xrLabel1.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft - ' - ' xrLabel2 - ' - Me.xrLabel2.Bookmark = "Home" - Me.xrLabel2.Font = New System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Bold) - Me.xrLabel2.LocationFloat = New DevExpress.Utils.PointFloat(10.00001F, 10.00001F) - Me.xrLabel2.Name = "xrLabel2" - Me.xrLabel2.Padding = New DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F) - Me.xrLabel2.SizeF = New System.Drawing.SizeF(222.9167F, 23F) - Me.xrLabel2.StylePriority.UseFont = False - Me.xrLabel2.Text = "A sample report" - ' - ' topMarginBand1 - ' - Me.topMarginBand1.HeightF = 48F - Me.topMarginBand1.Name = "topMarginBand1" - ' - ' bottomMarginBand1 - ' - Me.bottomMarginBand1.HeightF = 48F - Me.bottomMarginBand1.Name = "bottomMarginBand1" - ' - ' nwindDataSet1 - ' - Me.nwindDataSet1.DataSetName = "nwindDataSet" - Me.nwindDataSet1.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema - ' - ' productsTableAdapter - ' - Me.productsTableAdapter.ClearBeforeFill = True - ' - ' ReportHeader - ' - Me.ReportHeader.Controls.AddRange(New DevExpress.XtraReports.UI.XRControl() { Me.xrLabel2}) - Me.ReportHeader.HeightF = 47F - Me.ReportHeader.Name = "ReportHeader" - ' - ' Report - ' - Me.Bands.AddRange(New DevExpress.XtraReports.UI.Band() { Me.Detail, Me.topMarginBand1, Me.bottomMarginBand1, Me.ReportHeader}) - Me.Bookmark = "Table of Contents" - Me.DataAdapter = Me.productsTableAdapter - Me.DataMember = "Products" - Me.DataSource = Me.nwindDataSet1 - Me.FilterString = "[CategoryID] < 4" - Me.Margins = New System.Drawing.Printing.Margins(49, 51, 48, 48) - Me.Version = "12.2" - CType(Me.nwindDataSet1, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me, System.ComponentModel.ISupportInitialize).EndInit() + Private Detail As DevExpress.XtraReports.UI.DetailBand - End Sub + Private topMarginBand1 As DevExpress.XtraReports.UI.TopMarginBand - End Class -End Namespace \ No newline at end of file + Private nwindDataSet1 As nwindDataSet + + Private productsTableAdapter As nwindDataSetTableAdapters.ProductsTableAdapter + + Private xrLabel1 As DevExpress.XtraReports.UI.XRLabel + + Private ReportHeader As DevExpress.XtraReports.UI.ReportHeaderBand + + Private xrLabel2 As DevExpress.XtraReports.UI.XRLabel + + Private bottomMarginBand1 As DevExpress.XtraReports.UI.BottomMarginBand + + Public Sub New() + InitializeComponent() + End Sub + + Private Sub InitializeComponent() + Detail = New DevExpress.XtraReports.UI.DetailBand() + xrLabel1 = New DevExpress.XtraReports.UI.XRLabel() + xrLabel2 = New DevExpress.XtraReports.UI.XRLabel() + topMarginBand1 = New DevExpress.XtraReports.UI.TopMarginBand() + bottomMarginBand1 = New DevExpress.XtraReports.UI.BottomMarginBand() + nwindDataSet1 = New nwindDataSet() + productsTableAdapter = New nwindDataSetTableAdapters.ProductsTableAdapter() + ReportHeader = New DevExpress.XtraReports.UI.ReportHeaderBand() + CType(nwindDataSet1, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me, System.ComponentModel.ISupportInitialize).BeginInit() + ' + ' Detail + ' + Detail.Controls.AddRange(New DevExpress.XtraReports.UI.XRControl() {xrLabel1}) + Detail.HeightF = 33.00001F + Detail.Name = "Detail" + Detail.Padding = New DevExpress.XtraPrinting.PaddingInfo(0, 0, 0, 0, 100F) + Detail.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopLeft + ' + ' xrLabel1 + ' + xrLabel1.BookmarkParent = xrLabel2 + xrLabel1.DataBindings.AddRange(New DevExpress.XtraReports.UI.XRBinding() {New DevExpress.XtraReports.UI.XRBinding("Text", Nothing, "Products.ProductName"), New DevExpress.XtraReports.UI.XRBinding("Bookmark", Nothing, "Products.ProductName")}) + xrLabel1.Font = New System.Drawing.Font("Arial", 9.75F) + xrLabel1.LocationFloat = New DevExpress.Utils.PointFloat(10.00001F, 10.00001F) + xrLabel1.Name = "xrLabel1" + xrLabel1.Padding = New DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F) + xrLabel1.SizeF = New System.Drawing.SizeF(408.3333F, 23F) + xrLabel1.StylePriority.UseFont = False + xrLabel1.StylePriority.UseTextAlignment = False + xrLabel1.Text = "xrLabel1" + xrLabel1.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft + ' + ' xrLabel2 + ' + xrLabel2.Bookmark = "Home" + xrLabel2.Font = New System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Bold) + xrLabel2.LocationFloat = New DevExpress.Utils.PointFloat(10.00001F, 10.00001F) + xrLabel2.Name = "xrLabel2" + xrLabel2.Padding = New DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F) + xrLabel2.SizeF = New System.Drawing.SizeF(222.9167F, 23F) + xrLabel2.StylePriority.UseFont = False + xrLabel2.Text = "A sample report" + ' + ' topMarginBand1 + ' + topMarginBand1.HeightF = 48F + topMarginBand1.Name = "topMarginBand1" + ' + ' bottomMarginBand1 + ' + bottomMarginBand1.HeightF = 48F + bottomMarginBand1.Name = "bottomMarginBand1" + ' + ' nwindDataSet1 + ' + nwindDataSet1.DataSetName = "nwindDataSet" + nwindDataSet1.SchemaSerializationMode = Data.SchemaSerializationMode.IncludeSchema + ' + ' productsTableAdapter + ' + productsTableAdapter.ClearBeforeFill = True + ' + ' ReportHeader + ' + ReportHeader.Controls.AddRange(New DevExpress.XtraReports.UI.XRControl() {xrLabel2}) + ReportHeader.HeightF = 47F + ReportHeader.Name = "ReportHeader" + ' + ' Report + ' + Me.Bands.AddRange(New DevExpress.XtraReports.UI.Band() {Detail, topMarginBand1, bottomMarginBand1, ReportHeader}) + Me.Bookmark = "Table of Contents" + Me.DataAdapter = productsTableAdapter + Me.DataMember = "Products" + Me.DataSource = nwindDataSet1 + Me.FilterString = "[CategoryID] < 4" + Me.Margins = New System.Drawing.Printing.Margins(49, 51, 48, 48) + Me.Version = "12.2" + CType(nwindDataSet1, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me, System.ComponentModel.ISupportInitialize).EndInit() + End Sub + End Class +End Namespace diff --git a/VB/MinimalisticReportPreviewDemo/nwindDataSet.Designer.vb b/VB/MinimalisticReportPreviewDemo/nwindDataSet.Designer.vb index 6b51b0d..680aa40 100644 --- a/VB/MinimalisticReportPreviewDemo/nwindDataSet.Designer.vb +++ b/VB/MinimalisticReportPreviewDemo/nwindDataSet.Designer.vb @@ -1,1135 +1,1145 @@ -'------------------------------------------------------------------------------ +'------------------------------------------------------------------------------ ' ' This code was generated by a tool. -' Runtime Version:4.0.30319.18034 +' Runtime Version:4.0.30319.1 ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' '------------------------------------------------------------------------------ +Imports System.Runtime.InteropServices -Option Strict Off -Option Explicit On - - - -''' -'''Represents a strongly typed in-memory cache of data. -''' - _ -Partial Public Class nwindDataSet - Inherits Global.System.Data.DataSet - - Private tableProducts As ProductsDataTable - - Private _schemaSerializationMode As Global.System.Data.SchemaSerializationMode = Global.System.Data.SchemaSerializationMode.IncludeSchema - - _ - Public Sub New() - MyBase.New() - Me.BeginInit() - Me.InitClass() - Dim schemaChangedHandler As Global.System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged - AddHandler MyBase.Tables.CollectionChanged, schemaChangedHandler - AddHandler MyBase.Relations.CollectionChanged, schemaChangedHandler - Me.EndInit() - End Sub - - _ - Protected Sub New(ByVal info As Global.System.Runtime.Serialization.SerializationInfo, ByVal context As Global.System.Runtime.Serialization.StreamingContext) - MyBase.New(info, context, False) - If (Me.IsBinarySerialized(info, context) = True) Then - Me.InitVars(False) - Dim schemaChangedHandler1 As Global.System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged - AddHandler Me.Tables.CollectionChanged, schemaChangedHandler1 - AddHandler Me.Relations.CollectionChanged, schemaChangedHandler1 - Return - End If - Dim strSchema As String = CType(info.GetValue("XmlSchema", GetType(String)), String) - If (Me.DetermineSchemaSerializationMode(info, context) = Global.System.Data.SchemaSerializationMode.IncludeSchema) Then - Dim ds As Global.System.Data.DataSet = New Global.System.Data.DataSet() - ds.ReadXmlSchema(New Global.System.Xml.XmlTextReader(New Global.System.IO.StringReader(strSchema))) - If (Not (ds.Tables("Products")) Is Nothing) Then - MyBase.Tables.Add(New ProductsDataTable(ds.Tables("Products"))) - End If - Me.DataSetName = ds.DataSetName - Me.Prefix = ds.Prefix - Me.Namespace = ds.Namespace - Me.Locale = ds.Locale - Me.CaseSensitive = ds.CaseSensitive - Me.EnforceConstraints = ds.EnforceConstraints - Me.Merge(ds, False, Global.System.Data.MissingSchemaAction.Add) - Me.InitVars() - Else - Me.ReadXmlSchema(New Global.System.Xml.XmlTextReader(New Global.System.IO.StringReader(strSchema))) - End If - Me.GetSerializationData(info, context) - Dim schemaChangedHandler As Global.System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged - AddHandler MyBase.Tables.CollectionChanged, schemaChangedHandler - AddHandler Me.Relations.CollectionChanged, schemaChangedHandler - End Sub - - _ - Public ReadOnly Property Products() As ProductsDataTable - Get - Return Me.tableProducts - End Get - End Property - - _ - Public Overrides Property SchemaSerializationMode() As Global.System.Data.SchemaSerializationMode - Get - Return Me._schemaSerializationMode - End Get - Set(value As Global.System.Data.SchemaSerializationMode) - Me._schemaSerializationMode = value - End Set - End Property - - _ - Public Shadows ReadOnly Property Tables() As Global.System.Data.DataTableCollection - Get - Return MyBase.Tables - End Get - End Property - - _ - Public Shadows ReadOnly Property Relations() As Global.System.Data.DataRelationCollection - Get - Return MyBase.Relations - End Get - End Property - - _ - Protected Overrides Sub InitializeDerivedDataSet() - Me.BeginInit() - Me.InitClass() - Me.EndInit() - End Sub - - _ - Public Overrides Function Clone() As Global.System.Data.DataSet - Dim cln As nwindDataSet = CType(MyBase.Clone, nwindDataSet) - cln.InitVars() - cln.SchemaSerializationMode = Me.SchemaSerializationMode - Return cln - End Function - - _ - Protected Overrides Function ShouldSerializeTables() As Boolean - Return False - End Function - - _ - Protected Overrides Function ShouldSerializeRelations() As Boolean - Return False - End Function - - _ - Protected Overrides Sub ReadXmlSerializable(ByVal reader As Global.System.Xml.XmlReader) - If (Me.DetermineSchemaSerializationMode(reader) = Global.System.Data.SchemaSerializationMode.IncludeSchema) Then - Me.Reset() - Dim ds As Global.System.Data.DataSet = New Global.System.Data.DataSet() - ds.ReadXml(reader) - If (Not (ds.Tables("Products")) Is Nothing) Then - MyBase.Tables.Add(New ProductsDataTable(ds.Tables("Products"))) - End If - Me.DataSetName = ds.DataSetName - Me.Prefix = ds.Prefix - Me.Namespace = ds.Namespace - Me.Locale = ds.Locale - Me.CaseSensitive = ds.CaseSensitive - Me.EnforceConstraints = ds.EnforceConstraints - Me.Merge(ds, False, Global.System.Data.MissingSchemaAction.Add) - Me.InitVars() - Else - Me.ReadXml(reader) - Me.InitVars() - End If - End Sub - - _ - Protected Overrides Function GetSchemaSerializable() As Global.System.Xml.Schema.XmlSchema - Dim stream As Global.System.IO.MemoryStream = New Global.System.IO.MemoryStream() - Me.WriteXmlSchema(New Global.System.Xml.XmlTextWriter(stream, Nothing)) - stream.Position = 0 - Return Global.System.Xml.Schema.XmlSchema.Read(New Global.System.Xml.XmlTextReader(stream), Nothing) - End Function - - _ - Friend Overloads Sub InitVars() - Me.InitVars(True) - End Sub - - _ - Friend Overloads Sub InitVars(ByVal initTable As Boolean) - Me.tableProducts = CType(MyBase.Tables("Products"), ProductsDataTable) - If (initTable = True) Then - If (Not (Me.tableProducts) Is Nothing) Then - Me.tableProducts.InitVars() - End If - End If - End Sub - - _ - Private Sub InitClass() - Me.DataSetName = "nwindDataSet" - Me.Prefix = "" - Me.Namespace = "http://tempuri.org/nwindDataSet.xsd" - Me.EnforceConstraints = True - Me.SchemaSerializationMode = Global.System.Data.SchemaSerializationMode.IncludeSchema - Me.tableProducts = New ProductsDataTable() - MyBase.Tables.Add(Me.tableProducts) - End Sub - - _ - Private Function ShouldSerializeProducts() As Boolean - Return False - End Function - - _ - Private Sub SchemaChanged(ByVal sender As Object, ByVal e As Global.System.ComponentModel.CollectionChangeEventArgs) - If (e.Action = Global.System.ComponentModel.CollectionChangeAction.Remove) Then - Me.InitVars() - End If - End Sub - - _ - Public Shared Function GetTypedDataSetSchema(ByVal xs As Global.System.Xml.Schema.XmlSchemaSet) As Global.System.Xml.Schema.XmlSchemaComplexType - Dim ds As nwindDataSet = New nwindDataSet() - Dim type As Global.System.Xml.Schema.XmlSchemaComplexType = New Global.System.Xml.Schema.XmlSchemaComplexType() - Dim sequence As Global.System.Xml.Schema.XmlSchemaSequence = New Global.System.Xml.Schema.XmlSchemaSequence() - Dim any As Global.System.Xml.Schema.XmlSchemaAny = New Global.System.Xml.Schema.XmlSchemaAny() - any.Namespace = ds.Namespace - sequence.Items.Add(any) - type.Particle = sequence - Dim dsSchema As Global.System.Xml.Schema.XmlSchema = ds.GetSchemaSerializable - If xs.Contains(dsSchema.TargetNamespace) Then - Dim s1 As Global.System.IO.MemoryStream = New Global.System.IO.MemoryStream() - Dim s2 As Global.System.IO.MemoryStream = New Global.System.IO.MemoryStream() - Try - Dim schema As Global.System.Xml.Schema.XmlSchema = Nothing - dsSchema.Write(s1) - Dim schemas As Global.System.Collections.IEnumerator = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator - Do While schemas.MoveNext - schema = CType(schemas.Current, Global.System.Xml.Schema.XmlSchema) - s2.SetLength(0) - schema.Write(s2) - If (s1.Length = s2.Length) Then - s1.Position = 0 - s2.Position = 0 - - Do While ((s1.Position <> s1.Length) _ - AndAlso (s1.ReadByte = s2.ReadByte)) - - - Loop - If (s1.Position = s1.Length) Then - Return type - End If - End If - - Loop - Finally - If (Not (s1) Is Nothing) Then - s1.Close() - End If - If (Not (s2) Is Nothing) Then - s2.Close() - End If - End Try - End If - xs.Add(dsSchema) - Return type - End Function - - _ - Public Delegate Sub ProductsRowChangeEventHandler(ByVal sender As Object, ByVal e As ProductsRowChangeEvent) - - ''' - '''Represents the strongly named DataTable class. - ''' - _ - Partial Public Class ProductsDataTable - Inherits Global.System.Data.TypedTableBase(Of ProductsRow) - - Private columnProductID As Global.System.Data.DataColumn - - Private columnProductName As Global.System.Data.DataColumn - - Private columnSupplierID As Global.System.Data.DataColumn - - Private columnCategoryID As Global.System.Data.DataColumn +Namespace MinimalisticReportPreviewDemo - Private columnQuantityPerUnit As Global.System.Data.DataColumn + ''' + ''' Represents a strongly typed in-memory cache of data. + ''' + + + + + + + Public Partial Class nwindDataSet + Inherits Global.System.Data.DataSet - Private columnUnitPrice As Global.System.Data.DataColumn + Private tableProducts As MinimalisticReportPreviewDemo.nwindDataSet.ProductsDataTable - Private columnUnitsInStock As Global.System.Data.DataColumn + Private _schemaSerializationMode As Global.System.Data.SchemaSerializationMode = Global.System.Data.SchemaSerializationMode.IncludeSchema - Private columnUnitsOnOrder As Global.System.Data.DataColumn - - Private columnReorderLevel As Global.System.Data.DataColumn - - Private columnDiscontinued As Global.System.Data.DataColumn - - Private columnEAN13 As Global.System.Data.DataColumn - - _ + + Public Sub New() - MyBase.New() - Me.TableName = "Products" Me.BeginInit() Me.InitClass() + Dim schemaChangedHandler As Global.System.ComponentModel.CollectionChangeEventHandler = New Global.System.ComponentModel.CollectionChangeEventHandler(AddressOf Me.SchemaChanged) + AddHandler MyBase.Tables.CollectionChanged, schemaChangedHandler + AddHandler MyBase.Relations.CollectionChanged, schemaChangedHandler Me.EndInit() End Sub - _ - Friend Sub New(ByVal table As Global.System.Data.DataTable) - MyBase.New() - Me.TableName = table.TableName - If (table.CaseSensitive <> table.DataSet.CaseSensitive) Then - Me.CaseSensitive = table.CaseSensitive - End If - If (table.Locale.ToString <> table.DataSet.Locale.ToString) Then - Me.Locale = table.Locale - End If - If (table.Namespace <> table.DataSet.Namespace) Then - Me.Namespace = table.Namespace - End If - Me.Prefix = table.Prefix - Me.MinimumCapacity = table.MinimumCapacity - End Sub - - _ + + Protected Sub New(ByVal info As Global.System.Runtime.Serialization.SerializationInfo, ByVal context As Global.System.Runtime.Serialization.StreamingContext) - MyBase.New(info, context) - Me.InitVars() - End Sub - - _ - Public ReadOnly Property ProductIDColumn() As Global.System.Data.DataColumn - Get - Return Me.columnProductID - End Get - End Property - - _ - Public ReadOnly Property ProductNameColumn() As Global.System.Data.DataColumn - Get - Return Me.columnProductName - End Get - End Property - - _ - Public ReadOnly Property SupplierIDColumn() As Global.System.Data.DataColumn - Get - Return Me.columnSupplierID - End Get - End Property - - _ - Public ReadOnly Property CategoryIDColumn() As Global.System.Data.DataColumn - Get - Return Me.columnCategoryID - End Get - End Property - - _ - Public ReadOnly Property QuantityPerUnitColumn() As Global.System.Data.DataColumn - Get - Return Me.columnQuantityPerUnit - End Get - End Property - - _ - Public ReadOnly Property UnitPriceColumn() As Global.System.Data.DataColumn - Get - Return Me.columnUnitPrice - End Get - End Property + MyBase.New(info, context, False) + If(Me.IsBinarySerialized(info, context) = True) Then + Me.InitVars(False) + Dim schemaChangedHandler1 As Global.System.ComponentModel.CollectionChangeEventHandler = New Global.System.ComponentModel.CollectionChangeEventHandler(AddressOf Me.SchemaChanged) + AddHandler Me.Tables.CollectionChanged, schemaChangedHandler1 + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler1 + Return + End If + + Dim strSchema As String =(CStr((info.GetValue("XmlSchema", GetType(String))))) + If(Me.DetermineSchemaSerializationMode(info, context) = Global.System.Data.SchemaSerializationMode.IncludeSchema) Then + Dim ds As Global.System.Data.DataSet = New Global.System.Data.DataSet() + ds.ReadXmlSchema(New Global.System.Xml.XmlTextReader(New Global.System.IO.StringReader(strSchema))) + If(ds.Tables("Products") IsNot Nothing) Then + MyBase.Tables.Add(New MinimalisticReportPreviewDemo.nwindDataSet.ProductsDataTable(ds.Tables("Products"))) + End If - _ - Public ReadOnly Property UnitsInStockColumn() As Global.System.Data.DataColumn - Get - Return Me.columnUnitsInStock - End Get - End Property + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.[Namespace] = ds.[Namespace] + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, False, Global.System.Data.MissingSchemaAction.Add) + Me.InitVars() + Else + Me.ReadXmlSchema(New Global.System.Xml.XmlTextReader(New Global.System.IO.StringReader(strSchema))) + End If - _ - Public ReadOnly Property UnitsOnOrderColumn() As Global.System.Data.DataColumn - Get - Return Me.columnUnitsOnOrder - End Get - End Property + Me.GetSerializationData(info, context) + Dim schemaChangedHandler As Global.System.ComponentModel.CollectionChangeEventHandler = New Global.System.ComponentModel.CollectionChangeEventHandler(AddressOf Me.SchemaChanged) + AddHandler MyBase.Tables.CollectionChanged, schemaChangedHandler + AddHandler Me.Relations.CollectionChanged, schemaChangedHandler + End Sub - _ - Public ReadOnly Property ReorderLevelColumn() As Global.System.Data.DataColumn + + + + + Public ReadOnly Property Products As ProductsDataTable Get - Return Me.columnReorderLevel + Return Me.tableProducts End Get End Property - _ - Public ReadOnly Property DiscontinuedColumn() As Global.System.Data.DataColumn + + + + + Public Overrides Property SchemaSerializationMode As Global.System.Data.SchemaSerializationMode Get - Return Me.columnDiscontinued + Return Me._schemaSerializationMode End Get - End Property - _ - Public ReadOnly Property EAN13Column() As Global.System.Data.DataColumn - Get - Return Me.columnEAN13 - End Get + Set(ByVal value As Global.System.Data.SchemaSerializationMode) + Me._schemaSerializationMode = value + End Set End Property - _ - Public ReadOnly Property Count() As Integer + + + + Public Overloads ReadOnly Property Tables As Global.System.Data.DataTableCollection Get - Return Me.Rows.Count + Return MyBase.Tables End Get End Property - _ - Default Public ReadOnly Property Item(ByVal index As Integer) As ProductsRow + + + + Public Overloads ReadOnly Property Relations As Global.System.Data.DataRelationCollection Get - Return CType(Me.Rows(index), ProductsRow) + Return MyBase.Relations End Get End Property - _ - Public Event ProductsRowChanging As ProductsRowChangeEventHandler - - _ - Public Event ProductsRowChanged As ProductsRowChangeEventHandler - - _ - Public Event ProductsRowDeleting As ProductsRowChangeEventHandler - - _ - Public Event ProductsRowDeleted As ProductsRowChangeEventHandler - - _ - Public Overloads Sub AddProductsRow(ByVal row As ProductsRow) - Me.Rows.Add(row) + + + Protected Overrides Sub InitializeDerivedDataSet() + Me.BeginInit() + Me.InitClass() + Me.EndInit() End Sub - _ - Public Overloads Function AddProductsRow(ByVal ProductName As String, ByVal SupplierID As Integer, ByVal CategoryID As Integer, ByVal QuantityPerUnit As String, ByVal UnitPrice As Decimal, ByVal UnitsInStock As Short, ByVal UnitsOnOrder As Short, ByVal ReorderLevel As Short, ByVal Discontinued As Boolean, ByVal EAN13 As String) As ProductsRow - Dim rowProductsRow As ProductsRow = CType(Me.NewRow, ProductsRow) - Dim columnValuesArray() As Object = New Object() {Nothing, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued, EAN13} - rowProductsRow.ItemArray = columnValuesArray - Me.Rows.Add(rowProductsRow) - Return rowProductsRow - End Function - - _ - Public Function FindByProductID(ByVal ProductID As Integer) As ProductsRow - Return CType(Me.Rows.Find(New Object() {ProductID}), ProductsRow) - End Function - - _ - Public Overrides Function Clone() As Global.System.Data.DataTable - Dim cln As ProductsDataTable = CType(MyBase.Clone, ProductsDataTable) + + + Public Overrides Function Clone() As Global.System.Data.DataSet + Dim cln As MinimalisticReportPreviewDemo.nwindDataSet = CType((MyBase.Clone()), MinimalisticReportPreviewDemo.nwindDataSet) cln.InitVars() + cln.SchemaSerializationMode = Me.SchemaSerializationMode Return cln End Function - _ - Protected Overrides Function CreateInstance() As Global.System.Data.DataTable - Return New ProductsDataTable() - End Function - - _ - Friend Sub InitVars() - Me.columnProductID = MyBase.Columns("ProductID") - Me.columnProductName = MyBase.Columns("ProductName") - Me.columnSupplierID = MyBase.Columns("SupplierID") - Me.columnCategoryID = MyBase.Columns("CategoryID") - Me.columnQuantityPerUnit = MyBase.Columns("QuantityPerUnit") - Me.columnUnitPrice = MyBase.Columns("UnitPrice") - Me.columnUnitsInStock = MyBase.Columns("UnitsInStock") - Me.columnUnitsOnOrder = MyBase.Columns("UnitsOnOrder") - Me.columnReorderLevel = MyBase.Columns("ReorderLevel") - Me.columnDiscontinued = MyBase.Columns("Discontinued") - Me.columnEAN13 = MyBase.Columns("EAN13") - End Sub - - _ - Private Sub InitClass() - Me.columnProductID = New Global.System.Data.DataColumn("ProductID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) - MyBase.Columns.Add(Me.columnProductID) - Me.columnProductName = New Global.System.Data.DataColumn("ProductName", GetType(String), Nothing, Global.System.Data.MappingType.Element) - MyBase.Columns.Add(Me.columnProductName) - Me.columnSupplierID = New Global.System.Data.DataColumn("SupplierID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) - MyBase.Columns.Add(Me.columnSupplierID) - Me.columnCategoryID = New Global.System.Data.DataColumn("CategoryID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) - MyBase.Columns.Add(Me.columnCategoryID) - Me.columnQuantityPerUnit = New Global.System.Data.DataColumn("QuantityPerUnit", GetType(String), Nothing, Global.System.Data.MappingType.Element) - MyBase.Columns.Add(Me.columnQuantityPerUnit) - Me.columnUnitPrice = New Global.System.Data.DataColumn("UnitPrice", GetType(Decimal), Nothing, Global.System.Data.MappingType.Element) - MyBase.Columns.Add(Me.columnUnitPrice) - Me.columnUnitsInStock = New Global.System.Data.DataColumn("UnitsInStock", GetType(Short), Nothing, Global.System.Data.MappingType.Element) - MyBase.Columns.Add(Me.columnUnitsInStock) - Me.columnUnitsOnOrder = New Global.System.Data.DataColumn("UnitsOnOrder", GetType(Short), Nothing, Global.System.Data.MappingType.Element) - MyBase.Columns.Add(Me.columnUnitsOnOrder) - Me.columnReorderLevel = New Global.System.Data.DataColumn("ReorderLevel", GetType(Short), Nothing, Global.System.Data.MappingType.Element) - MyBase.Columns.Add(Me.columnReorderLevel) - Me.columnDiscontinued = New Global.System.Data.DataColumn("Discontinued", GetType(Boolean), Nothing, Global.System.Data.MappingType.Element) - MyBase.Columns.Add(Me.columnDiscontinued) - Me.columnEAN13 = New Global.System.Data.DataColumn("EAN13", GetType(String), Nothing, Global.System.Data.MappingType.Element) - MyBase.Columns.Add(Me.columnEAN13) - Me.Constraints.Add(New Global.System.Data.UniqueConstraint("Constraint1", New Global.System.Data.DataColumn() {Me.columnProductID}, True)) - Me.columnProductID.AutoIncrement = True - Me.columnProductID.AutoIncrementSeed = -1 - Me.columnProductID.AutoIncrementStep = -1 - Me.columnProductID.AllowDBNull = False - Me.columnProductID.Unique = True - Me.columnProductName.MaxLength = 40 - Me.columnQuantityPerUnit.MaxLength = 20 - Me.columnEAN13.MaxLength = 12 - End Sub - - _ - Public Function NewProductsRow() As ProductsRow - Return CType(Me.NewRow, ProductsRow) + + + Protected Overrides Function ShouldSerializeTables() As Boolean + Return False End Function - _ - Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow - Return New ProductsRow(builder) + + + Protected Overrides Function ShouldSerializeRelations() As Boolean + Return False End Function - _ - Protected Overrides Function GetRowType() As Global.System.Type - Return GetType(ProductsRow) - End Function + + + Protected Overrides Sub ReadXmlSerializable(ByVal reader As Global.System.Xml.XmlReader) + If(Me.DetermineSchemaSerializationMode(reader) = Global.System.Data.SchemaSerializationMode.IncludeSchema) Then + Me.Reset() + Dim ds As Global.System.Data.DataSet = New Global.System.Data.DataSet() + ds.ReadXml(reader) + If(ds.Tables("Products") IsNot Nothing) Then + MyBase.Tables.Add(New MinimalisticReportPreviewDemo.nwindDataSet.ProductsDataTable(ds.Tables("Products"))) + End If - _ - Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) - MyBase.OnRowChanged(e) - If (Not (Me.ProductsRowChangedEvent) Is Nothing) Then - RaiseEvent ProductsRowChanged(Me, New ProductsRowChangeEvent(CType(e.Row, ProductsRow), e.Action)) + Me.DataSetName = ds.DataSetName + Me.Prefix = ds.Prefix + Me.[Namespace] = ds.[Namespace] + Me.Locale = ds.Locale + Me.CaseSensitive = ds.CaseSensitive + Me.EnforceConstraints = ds.EnforceConstraints + Me.Merge(ds, False, Global.System.Data.MissingSchemaAction.Add) + Me.InitVars() + Else + Me.ReadXml(reader) + Me.InitVars() End If End Sub - _ - Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) - MyBase.OnRowChanging(e) - If (Not (Me.ProductsRowChangingEvent) Is Nothing) Then - RaiseEvent ProductsRowChanging(Me, New ProductsRowChangeEvent(CType(e.Row, ProductsRow), e.Action)) - End If + + + Protected Overrides Function GetSchemaSerializable() As Global.System.Xml.Schema.XmlSchema + Dim stream As Global.System.IO.MemoryStream = New Global.System.IO.MemoryStream() + Me.WriteXmlSchema(New Global.System.Xml.XmlTextWriter(stream, Nothing)) + stream.Position = 0 + Return Global.System.Xml.Schema.XmlSchema.Read(New Global.System.Xml.XmlTextReader(stream), Nothing) + End Function + + + + Friend Sub InitVars() + Me.InitVars(True) End Sub - _ - Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) - MyBase.OnRowDeleted(e) - If (Not (Me.ProductsRowDeletedEvent) Is Nothing) Then - RaiseEvent ProductsRowDeleted(Me, New ProductsRowChangeEvent(CType(e.Row, ProductsRow), e.Action)) + + + Friend Sub InitVars(ByVal initTable As Boolean) + Me.tableProducts = CType((MyBase.Tables("Products")), MinimalisticReportPreviewDemo.nwindDataSet.ProductsDataTable) + If(initTable = True) Then + If(Me.tableProducts IsNot Nothing) Then + Me.tableProducts.InitVars() + End If End If End Sub - _ - Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) - MyBase.OnRowDeleting(e) - If (Not (Me.ProductsRowDeletingEvent) Is Nothing) Then - RaiseEvent ProductsRowDeleting(Me, New ProductsRowChangeEvent(CType(e.Row, ProductsRow), e.Action)) - End If + + + Private Sub InitClass() + Me.DataSetName = "nwindDataSet" + Me.Prefix = "" + Me.[Namespace] = "http://tempuri.org/nwindDataSet.xsd" + Me.EnforceConstraints = True + Me.SchemaSerializationMode = Global.System.Data.SchemaSerializationMode.IncludeSchema + Me.tableProducts = New MinimalisticReportPreviewDemo.nwindDataSet.ProductsDataTable() + MyBase.Tables.Add(Me.tableProducts) End Sub - _ - Public Sub RemoveProductsRow(ByVal row As ProductsRow) - Me.Rows.Remove(row) + + + Private Function ShouldSerializeProducts() As Boolean + Return False + End Function + + + + Private Sub SchemaChanged(ByVal sender As Object, ByVal e As Global.System.ComponentModel.CollectionChangeEventArgs) + If(e.Action = Global.System.ComponentModel.CollectionChangeAction.Remove) Then + Me.InitVars() + End If End Sub - _ - Public Shared Function GetTypedTableSchema(ByVal xs As Global.System.Xml.Schema.XmlSchemaSet) As Global.System.Xml.Schema.XmlSchemaComplexType + + + Public Shared Function GetTypedDataSetSchema(ByVal xs As Global.System.Xml.Schema.XmlSchemaSet) As Global.System.Xml.Schema.XmlSchemaComplexType + Dim ds As MinimalisticReportPreviewDemo.nwindDataSet = New MinimalisticReportPreviewDemo.nwindDataSet() Dim type As Global.System.Xml.Schema.XmlSchemaComplexType = New Global.System.Xml.Schema.XmlSchemaComplexType() Dim sequence As Global.System.Xml.Schema.XmlSchemaSequence = New Global.System.Xml.Schema.XmlSchemaSequence() - Dim ds As nwindDataSet = New nwindDataSet() - Dim any1 As Global.System.Xml.Schema.XmlSchemaAny = New Global.System.Xml.Schema.XmlSchemaAny() - any1.Namespace = "http://www.w3.org/2001/XMLSchema" - any1.MinOccurs = New Decimal(0) - any1.MaxOccurs = Decimal.MaxValue - any1.ProcessContents = Global.System.Xml.Schema.XmlSchemaContentProcessing.Lax - sequence.Items.Add(any1) - Dim any2 As Global.System.Xml.Schema.XmlSchemaAny = New Global.System.Xml.Schema.XmlSchemaAny() - any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1" - any2.MinOccurs = New Decimal(1) - any2.ProcessContents = Global.System.Xml.Schema.XmlSchemaContentProcessing.Lax - sequence.Items.Add(any2) - Dim attribute1 As Global.System.Xml.Schema.XmlSchemaAttribute = New Global.System.Xml.Schema.XmlSchemaAttribute() - attribute1.Name = "namespace" - attribute1.FixedValue = ds.Namespace - type.Attributes.Add(attribute1) - Dim attribute2 As Global.System.Xml.Schema.XmlSchemaAttribute = New Global.System.Xml.Schema.XmlSchemaAttribute() - attribute2.Name = "tableTypeName" - attribute2.FixedValue = "ProductsDataTable" - type.Attributes.Add(attribute2) + Dim any As Global.System.Xml.Schema.XmlSchemaAny = New Global.System.Xml.Schema.XmlSchemaAny() + any.[Namespace] = ds.[Namespace] + sequence.Items.Add(any) type.Particle = sequence - Dim dsSchema As Global.System.Xml.Schema.XmlSchema = ds.GetSchemaSerializable + Dim dsSchema As Global.System.Xml.Schema.XmlSchema = ds.GetSchemaSerializable() If xs.Contains(dsSchema.TargetNamespace) Then Dim s1 As Global.System.IO.MemoryStream = New Global.System.IO.MemoryStream() Dim s2 As Global.System.IO.MemoryStream = New Global.System.IO.MemoryStream() Try Dim schema As Global.System.Xml.Schema.XmlSchema = Nothing dsSchema.Write(s1) - Dim schemas As Global.System.Collections.IEnumerator = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator - Do While schemas.MoveNext - schema = CType(schemas.Current, Global.System.Xml.Schema.XmlSchema) + Dim schemas As Global.System.Collections.IEnumerator = xs.Schemas(CStr((dsSchema.TargetNamespace))).GetEnumerator() + While schemas.MoveNext() + schema = CType((schemas.Current), Global.System.Xml.Schema.XmlSchema) s2.SetLength(0) schema.Write(s2) - If (s1.Length = s2.Length) Then + If(s1.Length = s2.Length) Then s1.Position = 0 s2.Position = 0 + While((s1.Position <> s1.Length) AndAlso (s1.ReadByte() = s2.ReadByte())) + End While - Do While ((s1.Position <> s1.Length) _ - AndAlso (s1.ReadByte = s2.ReadByte)) - - - Loop - If (s1.Position = s1.Length) Then + If(s1.Position = s1.Length) Then Return type End If End If - - Loop + End While Finally - If (Not (s1) Is Nothing) Then + If(s1 IsNot Nothing) Then s1.Close() End If - If (Not (s2) Is Nothing) Then + + If(s2 IsNot Nothing) Then s2.Close() End If End Try End If + xs.Add(dsSchema) Return type End Function - End Class - ''' - '''Represents strongly named DataRow class. - ''' - Partial Public Class ProductsRow - Inherits Global.System.Data.DataRow + + Public Delegate Sub ProductsRowChangeEventHandler(ByVal sender As Object, ByVal e As MinimalisticReportPreviewDemo.nwindDataSet.ProductsRowChangeEvent) - Private tableProducts As ProductsDataTable + ''' + ''' Represents the strongly named DataTable class. + ''' + + + Public Partial Class ProductsDataTable + Inherits Global.System.Data.TypedTableBase(Of MinimalisticReportPreviewDemo.nwindDataSet.ProductsRow) - _ - Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) - MyBase.New(rb) - Me.tableProducts = CType(Me.Table, ProductsDataTable) - End Sub + Private columnProductID As Global.System.Data.DataColumn - _ - Public Property ProductID() As Integer - Get - Return CType(Me(Me.tableProducts.ProductIDColumn), Integer) - End Get - Set(value As Integer) - Me(Me.tableProducts.ProductIDColumn) = value - End Set - End Property + Private columnProductName As Global.System.Data.DataColumn - _ - Public Property ProductName() As String - Get - Try - Return CType(Me(Me.tableProducts.ProductNameColumn), String) - Catch e As Global.System.InvalidCastException - Throw New Global.System.Data.StrongTypingException("The value for column 'ProductName' in table 'Products' is DBNull.", e) - End Try - End Get - Set(value As String) - Me(Me.tableProducts.ProductNameColumn) = value - End Set - End Property + Private columnSupplierID As Global.System.Data.DataColumn - _ - Public Property SupplierID() As Integer - Get - Try - Return CType(Me(Me.tableProducts.SupplierIDColumn), Integer) - Catch e As Global.System.InvalidCastException - Throw New Global.System.Data.StrongTypingException("The value for column 'SupplierID' in table 'Products' is DBNull.", e) - End Try - End Get - Set(value As Integer) - Me(Me.tableProducts.SupplierIDColumn) = value - End Set - End Property + Private columnCategoryID As Global.System.Data.DataColumn - _ - Public Property CategoryID() As Integer - Get - Try - Return CType(Me(Me.tableProducts.CategoryIDColumn), Integer) - Catch e As Global.System.InvalidCastException - Throw New Global.System.Data.StrongTypingException("The value for column 'CategoryID' in table 'Products' is DBNull.", e) - End Try - End Get - Set(value As Integer) - Me(Me.tableProducts.CategoryIDColumn) = value - End Set - End Property + Private columnQuantityPerUnit As Global.System.Data.DataColumn - _ - Public Property QuantityPerUnit() As String - Get - Try - Return CType(Me(Me.tableProducts.QuantityPerUnitColumn), String) - Catch e As Global.System.InvalidCastException - Throw New Global.System.Data.StrongTypingException("The value for column 'QuantityPerUnit' in table 'Products' is DBNull.", e) - End Try - End Get - Set(value As String) - Me(Me.tableProducts.QuantityPerUnitColumn) = value - End Set - End Property + Private columnUnitPrice As Global.System.Data.DataColumn - _ - Public Property UnitPrice() As Decimal - Get - Try - Return CType(Me(Me.tableProducts.UnitPriceColumn), Decimal) - Catch e As Global.System.InvalidCastException - Throw New Global.System.Data.StrongTypingException("The value for column 'UnitPrice' in table 'Products' is DBNull.", e) - End Try - End Get - Set(value As Decimal) - Me(Me.tableProducts.UnitPriceColumn) = value - End Set - End Property + Private columnUnitsInStock As Global.System.Data.DataColumn - _ - Public Property UnitsInStock() As Short - Get - Try - Return CType(Me(Me.tableProducts.UnitsInStockColumn), Short) - Catch e As Global.System.InvalidCastException - Throw New Global.System.Data.StrongTypingException("The value for column 'UnitsInStock' in table 'Products' is DBNull.", e) - End Try - End Get - Set(value As Short) - Me(Me.tableProducts.UnitsInStockColumn) = value - End Set - End Property + Private columnUnitsOnOrder As Global.System.Data.DataColumn - _ - Public Property UnitsOnOrder() As Short - Get - Try - Return CType(Me(Me.tableProducts.UnitsOnOrderColumn), Short) - Catch e As Global.System.InvalidCastException - Throw New Global.System.Data.StrongTypingException("The value for column 'UnitsOnOrder' in table 'Products' is DBNull.", e) - End Try - End Get - Set(value As Short) - Me(Me.tableProducts.UnitsOnOrderColumn) = value - End Set - End Property + Private columnReorderLevel As Global.System.Data.DataColumn - _ - Public Property ReorderLevel() As Short - Get - Try - Return CType(Me(Me.tableProducts.ReorderLevelColumn), Short) - Catch e As Global.System.InvalidCastException - Throw New Global.System.Data.StrongTypingException("The value for column 'ReorderLevel' in table 'Products' is DBNull.", e) - End Try - End Get - Set(value As Short) - Me(Me.tableProducts.ReorderLevelColumn) = value - End Set - End Property + Private columnDiscontinued As Global.System.Data.DataColumn - _ - Public Property Discontinued() As Boolean - Get - Try - Return CType(Me(Me.tableProducts.DiscontinuedColumn), Boolean) - Catch e As Global.System.InvalidCastException - Throw New Global.System.Data.StrongTypingException("The value for column 'Discontinued' in table 'Products' is DBNull.", e) - End Try - End Get - Set(value As Boolean) - Me(Me.tableProducts.DiscontinuedColumn) = value - End Set - End Property + Private columnEAN13 As Global.System.Data.DataColumn - _ - Public Property EAN13() As String - Get - Try - Return CType(Me(Me.tableProducts.EAN13Column), String) - Catch e As Global.System.InvalidCastException - Throw New Global.System.Data.StrongTypingException("The value for column 'EAN13' in table 'Products' is DBNull.", e) - End Try - End Get - Set(value As String) - Me(Me.tableProducts.EAN13Column) = value - End Set - End Property + + + Public Sub New() + Me.TableName = "Products" + Me.BeginInit() + Me.InitClass() + Me.EndInit() + End Sub - _ - Public Function IsProductNameNull() As Boolean - Return Me.IsNull(Me.tableProducts.ProductNameColumn) - End Function + + + Friend Sub New(ByVal table As Global.System.Data.DataTable) + Me.TableName = table.TableName + If(table.CaseSensitive <> table.DataSet.CaseSensitive) Then + Me.CaseSensitive = table.CaseSensitive + End If - _ - Public Sub SetProductNameNull() - Me(Me.tableProducts.ProductNameColumn) = Global.System.Convert.DBNull - End Sub + If(Not Equals(table.Locale.ToString(), table.DataSet.Locale.ToString())) Then + Me.Locale = table.Locale + End If - _ - Public Function IsSupplierIDNull() As Boolean - Return Me.IsNull(Me.tableProducts.SupplierIDColumn) - End Function + If(Not Equals(table.[Namespace], table.DataSet.[Namespace])) Then + Me.[Namespace] = table.[Namespace] + End If - _ - Public Sub SetSupplierIDNull() - Me(Me.tableProducts.SupplierIDColumn) = Global.System.Convert.DBNull - End Sub + Me.Prefix = table.Prefix + Me.MinimumCapacity = table.MinimumCapacity + End Sub - _ - Public Function IsCategoryIDNull() As Boolean - Return Me.IsNull(Me.tableProducts.CategoryIDColumn) - End Function + + + Protected Sub New(ByVal info As Global.System.Runtime.Serialization.SerializationInfo, ByVal context As Global.System.Runtime.Serialization.StreamingContext) + MyBase.New(info, context) + Me.InitVars() + End Sub - _ - Public Sub SetCategoryIDNull() - Me(Me.tableProducts.CategoryIDColumn) = Global.System.Convert.DBNull - End Sub + + + Public ReadOnly Property ProductIDColumn As Global.System.Data.DataColumn + Get + Return Me.columnProductID + End Get + End Property + + + + Public ReadOnly Property ProductNameColumn As Global.System.Data.DataColumn + Get + Return Me.columnProductName + End Get + End Property + + + + Public ReadOnly Property SupplierIDColumn As Global.System.Data.DataColumn + Get + Return Me.columnSupplierID + End Get + End Property + + + + Public ReadOnly Property CategoryIDColumn As Global.System.Data.DataColumn + Get + Return Me.columnCategoryID + End Get + End Property + + + + Public ReadOnly Property QuantityPerUnitColumn As Global.System.Data.DataColumn + Get + Return Me.columnQuantityPerUnit + End Get + End Property + + + + Public ReadOnly Property UnitPriceColumn As Global.System.Data.DataColumn + Get + Return Me.columnUnitPrice + End Get + End Property + + + + Public ReadOnly Property UnitsInStockColumn As Global.System.Data.DataColumn + Get + Return Me.columnUnitsInStock + End Get + End Property + + + + Public ReadOnly Property UnitsOnOrderColumn As Global.System.Data.DataColumn + Get + Return Me.columnUnitsOnOrder + End Get + End Property + + + + Public ReadOnly Property ReorderLevelColumn As Global.System.Data.DataColumn + Get + Return Me.columnReorderLevel + End Get + End Property + + + + Public ReadOnly Property DiscontinuedColumn As Global.System.Data.DataColumn + Get + Return Me.columnDiscontinued + End Get + End Property + + + + Public ReadOnly Property EAN13Column As Global.System.Data.DataColumn + Get + Return Me.columnEAN13 + End Get + End Property + + + + + Public ReadOnly Property Count As Integer + Get + Return Me.Rows.Count + End Get + End Property + + + + Default Public ReadOnly Property Item(ByVal index As Integer) As ProductsRow + Get + Return CType((Me.Rows(index)), MinimalisticReportPreviewDemo.nwindDataSet.ProductsRow) + End Get + End Property + + + Public Event ProductsRowChanging As MinimalisticReportPreviewDemo.nwindDataSet.ProductsRowChangeEventHandler + + + Public Event ProductsRowChanged As MinimalisticReportPreviewDemo.nwindDataSet.ProductsRowChangeEventHandler + + + Public Event ProductsRowDeleting As MinimalisticReportPreviewDemo.nwindDataSet.ProductsRowChangeEventHandler + + + Public Event ProductsRowDeleted As MinimalisticReportPreviewDemo.nwindDataSet.ProductsRowChangeEventHandler + + + + Public Sub AddProductsRow(ByVal row As MinimalisticReportPreviewDemo.nwindDataSet.ProductsRow) + Me.Rows.Add(row) + End Sub - _ - Public Function IsQuantityPerUnitNull() As Boolean - Return Me.IsNull(Me.tableProducts.QuantityPerUnitColumn) - End Function + + + Public Function AddProductsRow(ByVal ProductName As String, ByVal SupplierID As Integer, ByVal CategoryID As Integer, ByVal QuantityPerUnit As String, ByVal UnitPrice As Decimal, ByVal UnitsInStock As Short, ByVal UnitsOnOrder As Short, ByVal ReorderLevel As Short, ByVal Discontinued As Boolean, ByVal EAN13 As String) As ProductsRow + Dim rowProductsRow As MinimalisticReportPreviewDemo.nwindDataSet.ProductsRow = CType((Me.NewRow()), MinimalisticReportPreviewDemo.nwindDataSet.ProductsRow) + Dim columnValuesArray As Object() = New Object() {Nothing, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued, EAN13} + rowProductsRow.ItemArray = columnValuesArray + Me.Rows.Add(rowProductsRow) + Return rowProductsRow + End Function - _ - Public Sub SetQuantityPerUnitNull() - Me(Me.tableProducts.QuantityPerUnitColumn) = Global.System.Convert.DBNull - End Sub + + + Public Function FindByProductID(ByVal ProductID As Integer) As ProductsRow + Return CType((Me.Rows.Find(New Object() {ProductID})), MinimalisticReportPreviewDemo.nwindDataSet.ProductsRow) + End Function - _ - Public Function IsUnitPriceNull() As Boolean - Return Me.IsNull(Me.tableProducts.UnitPriceColumn) - End Function + + + Public Overrides Function Clone() As Global.System.Data.DataTable + Dim cln As MinimalisticReportPreviewDemo.nwindDataSet.ProductsDataTable = CType((MyBase.Clone()), MinimalisticReportPreviewDemo.nwindDataSet.ProductsDataTable) + cln.InitVars() + Return cln + End Function - _ - Public Sub SetUnitPriceNull() - Me(Me.tableProducts.UnitPriceColumn) = Global.System.Convert.DBNull - End Sub + + + Protected Overrides Function CreateInstance() As Global.System.Data.DataTable + Return New MinimalisticReportPreviewDemo.nwindDataSet.ProductsDataTable() + End Function - _ - Public Function IsUnitsInStockNull() As Boolean - Return Me.IsNull(Me.tableProducts.UnitsInStockColumn) - End Function + + + Friend Sub InitVars() + Me.columnProductID = MyBase.Columns("ProductID") + Me.columnProductName = MyBase.Columns("ProductName") + Me.columnSupplierID = MyBase.Columns("SupplierID") + Me.columnCategoryID = MyBase.Columns("CategoryID") + Me.columnQuantityPerUnit = MyBase.Columns("QuantityPerUnit") + Me.columnUnitPrice = MyBase.Columns("UnitPrice") + Me.columnUnitsInStock = MyBase.Columns("UnitsInStock") + Me.columnUnitsOnOrder = MyBase.Columns("UnitsOnOrder") + Me.columnReorderLevel = MyBase.Columns("ReorderLevel") + Me.columnDiscontinued = MyBase.Columns("Discontinued") + Me.columnEAN13 = MyBase.Columns("EAN13") + End Sub - _ - Public Sub SetUnitsInStockNull() - Me(Me.tableProducts.UnitsInStockColumn) = Global.System.Convert.DBNull - End Sub + + + Private Sub InitClass() + Me.columnProductID = New Global.System.Data.DataColumn("ProductID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) + MyBase.Columns.Add(Me.columnProductID) + Me.columnProductName = New Global.System.Data.DataColumn("ProductName", GetType(String), Nothing, Global.System.Data.MappingType.Element) + MyBase.Columns.Add(Me.columnProductName) + Me.columnSupplierID = New Global.System.Data.DataColumn("SupplierID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) + MyBase.Columns.Add(Me.columnSupplierID) + Me.columnCategoryID = New Global.System.Data.DataColumn("CategoryID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) + MyBase.Columns.Add(Me.columnCategoryID) + Me.columnQuantityPerUnit = New Global.System.Data.DataColumn("QuantityPerUnit", GetType(String), Nothing, Global.System.Data.MappingType.Element) + MyBase.Columns.Add(Me.columnQuantityPerUnit) + Me.columnUnitPrice = New Global.System.Data.DataColumn("UnitPrice", GetType(Decimal), Nothing, Global.System.Data.MappingType.Element) + MyBase.Columns.Add(Me.columnUnitPrice) + Me.columnUnitsInStock = New Global.System.Data.DataColumn("UnitsInStock", GetType(Short), Nothing, Global.System.Data.MappingType.Element) + MyBase.Columns.Add(Me.columnUnitsInStock) + Me.columnUnitsOnOrder = New Global.System.Data.DataColumn("UnitsOnOrder", GetType(Short), Nothing, Global.System.Data.MappingType.Element) + MyBase.Columns.Add(Me.columnUnitsOnOrder) + Me.columnReorderLevel = New Global.System.Data.DataColumn("ReorderLevel", GetType(Short), Nothing, Global.System.Data.MappingType.Element) + MyBase.Columns.Add(Me.columnReorderLevel) + Me.columnDiscontinued = New Global.System.Data.DataColumn("Discontinued", GetType(Boolean), Nothing, Global.System.Data.MappingType.Element) + MyBase.Columns.Add(Me.columnDiscontinued) + Me.columnEAN13 = New Global.System.Data.DataColumn("EAN13", GetType(String), Nothing, Global.System.Data.MappingType.Element) + MyBase.Columns.Add(Me.columnEAN13) + Me.Constraints.Add(New Global.System.Data.UniqueConstraint("Constraint1", New Global.System.Data.DataColumn() {Me.columnProductID}, True)) + Me.columnProductID.AutoIncrement = True + Me.columnProductID.AutoIncrementSeed = -1 + Me.columnProductID.AutoIncrementStep = -1 + Me.columnProductID.AllowDBNull = False + Me.columnProductID.Unique = True + Me.columnProductName.MaxLength = 40 + Me.columnQuantityPerUnit.MaxLength = 20 + Me.columnEAN13.MaxLength = 12 + End Sub - _ - Public Function IsUnitsOnOrderNull() As Boolean - Return Me.IsNull(Me.tableProducts.UnitsOnOrderColumn) - End Function + + + Public Function NewProductsRow() As ProductsRow + Return CType((Me.NewRow()), MinimalisticReportPreviewDemo.nwindDataSet.ProductsRow) + End Function - _ - Public Sub SetUnitsOnOrderNull() - Me(Me.tableProducts.UnitsOnOrderColumn) = Global.System.Convert.DBNull - End Sub + + + Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow + Return New MinimalisticReportPreviewDemo.nwindDataSet.ProductsRow(builder) + End Function - _ - Public Function IsReorderLevelNull() As Boolean - Return Me.IsNull(Me.tableProducts.ReorderLevelColumn) - End Function + + + Protected Overrides Function GetRowType() As Global.System.Type + Return GetType(MinimalisticReportPreviewDemo.nwindDataSet.ProductsRow) + End Function - _ - Public Sub SetReorderLevelNull() - Me(Me.tableProducts.ReorderLevelColumn) = Global.System.Convert.DBNull - End Sub + + + Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) + MyBase.OnRowChanged(e) + RaiseEvent ProductsRowChanged(Me, New MinimalisticReportPreviewDemo.nwindDataSet.ProductsRowChangeEvent(CType((e.Row), MinimalisticReportPreviewDemo.nwindDataSet.ProductsRow), e.Action)) + End Sub - _ - Public Function IsDiscontinuedNull() As Boolean - Return Me.IsNull(Me.tableProducts.DiscontinuedColumn) - End Function + + + Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) + MyBase.OnRowChanging(e) + RaiseEvent ProductsRowChanging(Me, New MinimalisticReportPreviewDemo.nwindDataSet.ProductsRowChangeEvent(CType((e.Row), MinimalisticReportPreviewDemo.nwindDataSet.ProductsRow), e.Action)) + End Sub - _ - Public Sub SetDiscontinuedNull() - Me(Me.tableProducts.DiscontinuedColumn) = Global.System.Convert.DBNull - End Sub + + + Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) + MyBase.OnRowDeleted(e) + RaiseEvent ProductsRowDeleted(Me, New MinimalisticReportPreviewDemo.nwindDataSet.ProductsRowChangeEvent(CType((e.Row), MinimalisticReportPreviewDemo.nwindDataSet.ProductsRow), e.Action)) + End Sub - _ - Public Function IsEAN13Null() As Boolean - Return Me.IsNull(Me.tableProducts.EAN13Column) - End Function + + + Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) + MyBase.OnRowDeleting(e) + RaiseEvent ProductsRowDeleting(Me, New MinimalisticReportPreviewDemo.nwindDataSet.ProductsRowChangeEvent(CType((e.Row), MinimalisticReportPreviewDemo.nwindDataSet.ProductsRow), e.Action)) + End Sub - _ - Public Sub SetEAN13Null() - Me(Me.tableProducts.EAN13Column) = Global.System.Convert.DBNull - End Sub - End Class + + + Public Sub RemoveProductsRow(ByVal row As MinimalisticReportPreviewDemo.nwindDataSet.ProductsRow) + Me.Rows.Remove(row) + End Sub - ''' - '''Row event argument class - ''' - _ - Public Class ProductsRowChangeEvent - Inherits Global.System.EventArgs + + + Public Shared Function GetTypedTableSchema(ByVal xs As Global.System.Xml.Schema.XmlSchemaSet) As Global.System.Xml.Schema.XmlSchemaComplexType + Dim type As Global.System.Xml.Schema.XmlSchemaComplexType = New Global.System.Xml.Schema.XmlSchemaComplexType() + Dim sequence As Global.System.Xml.Schema.XmlSchemaSequence = New Global.System.Xml.Schema.XmlSchemaSequence() + Dim ds As MinimalisticReportPreviewDemo.nwindDataSet = New MinimalisticReportPreviewDemo.nwindDataSet() + Dim any1 As Global.System.Xml.Schema.XmlSchemaAny = New Global.System.Xml.Schema.XmlSchemaAny() + any1.[Namespace] = "http://www.w3.org/2001/XMLSchema" + any1.MinOccurs = New Decimal(0) + any1.MaxOccurs = Decimal.MaxValue + any1.ProcessContents = Global.System.Xml.Schema.XmlSchemaContentProcessing.Lax + sequence.Items.Add(any1) + Dim any2 As Global.System.Xml.Schema.XmlSchemaAny = New Global.System.Xml.Schema.XmlSchemaAny() + any2.[Namespace] = "urn:schemas-microsoft-com:xml-diffgram-v1" + any2.MinOccurs = New Decimal(1) + any2.ProcessContents = Global.System.Xml.Schema.XmlSchemaContentProcessing.Lax + sequence.Items.Add(any2) + Dim attribute1 As Global.System.Xml.Schema.XmlSchemaAttribute = New Global.System.Xml.Schema.XmlSchemaAttribute() + attribute1.Name = "namespace" + attribute1.FixedValue = ds.[Namespace] + type.Attributes.Add(attribute1) + Dim attribute2 As Global.System.Xml.Schema.XmlSchemaAttribute = New Global.System.Xml.Schema.XmlSchemaAttribute() + attribute2.Name = "tableTypeName" + attribute2.FixedValue = "ProductsDataTable" + type.Attributes.Add(attribute2) + type.Particle = sequence + Dim dsSchema As Global.System.Xml.Schema.XmlSchema = ds.GetSchemaSerializable() + If xs.Contains(dsSchema.TargetNamespace) Then + Dim s1 As Global.System.IO.MemoryStream = New Global.System.IO.MemoryStream() + Dim s2 As Global.System.IO.MemoryStream = New Global.System.IO.MemoryStream() + Try + Dim schema As Global.System.Xml.Schema.XmlSchema = Nothing + dsSchema.Write(s1) + Dim schemas As Global.System.Collections.IEnumerator = xs.Schemas(CStr((dsSchema.TargetNamespace))).GetEnumerator() + While schemas.MoveNext() + schema = CType((schemas.Current), Global.System.Xml.Schema.XmlSchema) + s2.SetLength(0) + schema.Write(s2) + If(s1.Length = s2.Length) Then + s1.Position = 0 + s2.Position = 0 + While((s1.Position <> s1.Length) AndAlso (s1.ReadByte() = s2.ReadByte())) + End While + + If(s1.Position = s1.Length) Then + Return type + End If + End If + End While + Finally + If(s1 IsNot Nothing) Then + s1.Close() + End If - Private eventRow As ProductsRow + If(s2 IsNot Nothing) Then + s2.Close() + End If + End Try + End If - Private eventAction As Global.System.Data.DataRowAction + xs.Add(dsSchema) + Return type + End Function + End Class - _ - Public Sub New(ByVal row As ProductsRow, ByVal action As Global.System.Data.DataRowAction) - MyBase.New() - Me.eventRow = row - Me.eventAction = action - End Sub + ''' + ''' Represents strongly named DataRow class. + ''' + Public Partial Class ProductsRow + Inherits Global.System.Data.DataRow - _ - Public ReadOnly Property Row() As ProductsRow - Get - Return Me.eventRow - End Get - End Property + Private tableProducts As MinimalisticReportPreviewDemo.nwindDataSet.ProductsDataTable - _ - Public ReadOnly Property Action() As Global.System.Data.DataRowAction - Get - Return Me.eventAction - End Get - End Property + + + Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) + MyBase.New(rb) + Me.tableProducts = CType((Me.Table), MinimalisticReportPreviewDemo.nwindDataSet.ProductsDataTable) + End Sub + + + + Public Property ProductID As Integer + Get + Return(CInt((Me(Me.tableProducts.ProductIDColumn)))) + End Get + + Set(ByVal value As Integer) + Me(Me.tableProducts.ProductIDColumn) = value + End Set + End Property + + + + Public Property ProductName As String + Get + Try + Return(CStr((Me(Me.tableProducts.ProductNameColumn)))) + Catch e As Global.System.InvalidCastException + Throw New Global.System.Data.StrongTypingException("The value for column 'ProductName' in table 'Products' is DBNull.", e) + End Try + End Get + + Set(ByVal value As String) + Me(Me.tableProducts.ProductNameColumn) = value + End Set + End Property + + + + Public Property SupplierID As Integer + Get + Try + Return(CInt((Me(Me.tableProducts.SupplierIDColumn)))) + Catch e As Global.System.InvalidCastException + Throw New Global.System.Data.StrongTypingException("The value for column 'SupplierID' in table 'Products' is DBNull.", e) + End Try + End Get + + Set(ByVal value As Integer) + Me(Me.tableProducts.SupplierIDColumn) = value + End Set + End Property + + + + Public Property CategoryID As Integer + Get + Try + Return(CInt((Me(Me.tableProducts.CategoryIDColumn)))) + Catch e As Global.System.InvalidCastException + Throw New Global.System.Data.StrongTypingException("The value for column 'CategoryID' in table 'Products' is DBNull.", e) + End Try + End Get + + Set(ByVal value As Integer) + Me(Me.tableProducts.CategoryIDColumn) = value + End Set + End Property + + + + Public Property QuantityPerUnit As String + Get + Try + Return(CStr((Me(Me.tableProducts.QuantityPerUnitColumn)))) + Catch e As Global.System.InvalidCastException + Throw New Global.System.Data.StrongTypingException("The value for column 'QuantityPerUnit' in table 'Products' is DBNull.", e) + End Try + End Get + + Set(ByVal value As String) + Me(Me.tableProducts.QuantityPerUnitColumn) = value + End Set + End Property + + + + Public Property UnitPrice As Decimal + Get + Try + Return(CDec((Me(Me.tableProducts.UnitPriceColumn)))) + Catch e As Global.System.InvalidCastException + Throw New Global.System.Data.StrongTypingException("The value for column 'UnitPrice' in table 'Products' is DBNull.", e) + End Try + End Get + + Set(ByVal value As Decimal) + Me(Me.tableProducts.UnitPriceColumn) = value + End Set + End Property + + + + Public Property UnitsInStock As Short + Get + Try + Return(CShort((Me(Me.tableProducts.UnitsInStockColumn)))) + Catch e As Global.System.InvalidCastException + Throw New Global.System.Data.StrongTypingException("The value for column 'UnitsInStock' in table 'Products' is DBNull.", e) + End Try + End Get + + Set(ByVal value As Short) + Me(Me.tableProducts.UnitsInStockColumn) = value + End Set + End Property + + + + Public Property UnitsOnOrder As Short + Get + Try + Return(CShort((Me(Me.tableProducts.UnitsOnOrderColumn)))) + Catch e As Global.System.InvalidCastException + Throw New Global.System.Data.StrongTypingException("The value for column 'UnitsOnOrder' in table 'Products' is DBNull.", e) + End Try + End Get + + Set(ByVal value As Short) + Me(Me.tableProducts.UnitsOnOrderColumn) = value + End Set + End Property + + + + Public Property ReorderLevel As Short + Get + Try + Return(CShort((Me(Me.tableProducts.ReorderLevelColumn)))) + Catch e As Global.System.InvalidCastException + Throw New Global.System.Data.StrongTypingException("The value for column 'ReorderLevel' in table 'Products' is DBNull.", e) + End Try + End Get + + Set(ByVal value As Short) + Me(Me.tableProducts.ReorderLevelColumn) = value + End Set + End Property + + + + Public Property Discontinued As Boolean + Get + Try + Return(CBool((Me(Me.tableProducts.DiscontinuedColumn)))) + Catch e As Global.System.InvalidCastException + Throw New Global.System.Data.StrongTypingException("The value for column 'Discontinued' in table 'Products' is DBNull.", e) + End Try + End Get + + Set(ByVal value As Boolean) + Me(Me.tableProducts.DiscontinuedColumn) = value + End Set + End Property + + + + Public Property EAN13 As String + Get + Try + Return(CStr((Me(Me.tableProducts.EAN13Column)))) + Catch e As Global.System.InvalidCastException + Throw New Global.System.Data.StrongTypingException("The value for column 'EAN13' in table 'Products' is DBNull.", e) + End Try + End Get + + Set(ByVal value As String) + Me(Me.tableProducts.EAN13Column) = value + End Set + End Property + + + + Public Function IsProductNameNull() As Boolean + Return Me.IsNull(Me.tableProducts.ProductNameColumn) + End Function + + + + Public Sub SetProductNameNull() + Me(Me.tableProducts.ProductNameColumn) = Global.System.Convert.DBNull + End Sub + + + + Public Function IsSupplierIDNull() As Boolean + Return Me.IsNull(Me.tableProducts.SupplierIDColumn) + End Function + + + + Public Sub SetSupplierIDNull() + Me(Me.tableProducts.SupplierIDColumn) = Global.System.Convert.DBNull + End Sub + + + + Public Function IsCategoryIDNull() As Boolean + Return Me.IsNull(Me.tableProducts.CategoryIDColumn) + End Function + + + + Public Sub SetCategoryIDNull() + Me(Me.tableProducts.CategoryIDColumn) = Global.System.Convert.DBNull + End Sub + + + + Public Function IsQuantityPerUnitNull() As Boolean + Return Me.IsNull(Me.tableProducts.QuantityPerUnitColumn) + End Function + + + + Public Sub SetQuantityPerUnitNull() + Me(Me.tableProducts.QuantityPerUnitColumn) = Global.System.Convert.DBNull + End Sub + + + + Public Function IsUnitPriceNull() As Boolean + Return Me.IsNull(Me.tableProducts.UnitPriceColumn) + End Function + + + + Public Sub SetUnitPriceNull() + Me(Me.tableProducts.UnitPriceColumn) = Global.System.Convert.DBNull + End Sub + + + + Public Function IsUnitsInStockNull() As Boolean + Return Me.IsNull(Me.tableProducts.UnitsInStockColumn) + End Function + + + + Public Sub SetUnitsInStockNull() + Me(Me.tableProducts.UnitsInStockColumn) = Global.System.Convert.DBNull + End Sub + + + + Public Function IsUnitsOnOrderNull() As Boolean + Return Me.IsNull(Me.tableProducts.UnitsOnOrderColumn) + End Function + + + + Public Sub SetUnitsOnOrderNull() + Me(Me.tableProducts.UnitsOnOrderColumn) = Global.System.Convert.DBNull + End Sub + + + + Public Function IsReorderLevelNull() As Boolean + Return Me.IsNull(Me.tableProducts.ReorderLevelColumn) + End Function + + + + Public Sub SetReorderLevelNull() + Me(Me.tableProducts.ReorderLevelColumn) = Global.System.Convert.DBNull + End Sub + + + + Public Function IsDiscontinuedNull() As Boolean + Return Me.IsNull(Me.tableProducts.DiscontinuedColumn) + End Function + + + + Public Sub SetDiscontinuedNull() + Me(Me.tableProducts.DiscontinuedColumn) = Global.System.Convert.DBNull + End Sub + + + + Public Function IsEAN13Null() As Boolean + Return Me.IsNull(Me.tableProducts.EAN13Column) + End Function + + + + Public Sub SetEAN13Null() + Me(Me.tableProducts.EAN13Column) = Global.System.Convert.DBNull + End Sub + End Class + + ''' + ''' Row event argument class + ''' + + Public Class ProductsRowChangeEvent + Inherits Global.System.EventArgs + + Private eventRow As MinimalisticReportPreviewDemo.nwindDataSet.ProductsRow + + Private eventAction As Global.System.Data.DataRowAction + + + + Public Sub New(ByVal row As MinimalisticReportPreviewDemo.nwindDataSet.ProductsRow, ByVal action As Global.System.Data.DataRowAction) + Me.eventRow = row + Me.eventAction = action + End Sub + + + + Public ReadOnly Property Row As ProductsRow + Get + Return Me.eventRow + End Get + End Property + + + + Public ReadOnly Property Action As Global.System.Data.DataRowAction + Get + Return Me.eventAction + End Get + End Property + End Class End Class -End Class - -Namespace nwindDataSetTableAdapters - - ''' - '''Represents the connection and commands used to retrieve and save data. - ''' - _ - Partial Public Class ProductsTableAdapter +End Namespace + +Namespace MinimalisticReportPreviewDemo.nwindDataSetTableAdapters + + ''' + ''' Represents the connection and commands used to retrieve and save data. + ''' + + + + + + Public Partial Class ProductsTableAdapter Inherits Global.System.ComponentModel.Component - Private WithEvents _adapter As Global.System.Data.OleDb.OleDbDataAdapter + Private _adapter As Global.System.Data.OleDb.OleDbDataAdapter Private _connection As Global.System.Data.OleDb.OleDbConnection Private _transaction As Global.System.Data.OleDb.OleDbTransaction - Private _commandCollection() As Global.System.Data.OleDb.OleDbCommand + Private _commandCollection As Global.System.Data.OleDb.OleDbCommand() Private _clearBeforeFill As Boolean - _ + + Public Sub New() - MyBase.New() Me.ClearBeforeFill = True End Sub - _ - Protected Friend ReadOnly Property Adapter() As Global.System.Data.OleDb.OleDbDataAdapter + + + Protected Friend ReadOnly Property Adapter As Global.System.Data.OleDb.OleDbDataAdapter Get - If (Me._adapter Is Nothing) Then + If(Me._adapter Is Nothing) Then Me.InitAdapter() End If + Return Me._adapter End Get End Property - _ - Friend Property Connection() As Global.System.Data.OleDb.OleDbConnection + + + Friend Property Connection As Global.System.Data.OleDb.OleDbConnection Get - If (Me._connection Is Nothing) Then + If(Me._connection Is Nothing) Then Me.InitConnection() End If + Return Me._connection End Get - Set(value As Global.System.Data.OleDb.OleDbConnection) + + Set(ByVal value As Global.System.Data.OleDb.OleDbConnection) Me._connection = value - If (Not (Me.Adapter.InsertCommand) Is Nothing) Then + If(Me.Adapter.InsertCommand IsNot Nothing) Then Me.Adapter.InsertCommand.Connection = value End If - If (Not (Me.Adapter.DeleteCommand) Is Nothing) Then + + If(Me.Adapter.DeleteCommand IsNot Nothing) Then Me.Adapter.DeleteCommand.Connection = value End If - If (Not (Me.Adapter.UpdateCommand) Is Nothing) Then + + If(Me.Adapter.UpdateCommand IsNot Nothing) Then Me.Adapter.UpdateCommand.Connection = value End If + Dim i As Integer = 0 - Do While (i < Me.CommandCollection.Length) - If (Not (Me.CommandCollection(i)) Is Nothing) Then - CType(Me.CommandCollection(i), Global.System.Data.OleDb.OleDbCommand).Connection = value + While(i < Me.CommandCollection.Length) + If(Me.CommandCollection(i) IsNot Nothing) Then + CType((Me.CommandCollection(CInt((i)))), Global.System.Data.OleDb.OleDbCommand).Connection = value End If - i = (i + 1) - Loop + + i =(i + 1) + End While End Set End Property - _ - Friend Property Transaction() As Global.System.Data.OleDb.OleDbTransaction + + + Friend Property Transaction As Global.System.Data.OleDb.OleDbTransaction Get Return Me._transaction End Get - Set(value As Global.System.Data.OleDb.OleDbTransaction) + + Set(ByVal value As Global.System.Data.OleDb.OleDbTransaction) Me._transaction = value Dim i As Integer = 0 - Do While (i < Me.CommandCollection.Length) - Me.CommandCollection(i).Transaction = Me._transaction - i = (i + 1) - Loop - If ((Not (Me.Adapter) Is Nothing) _ - AndAlso (Not (Me.Adapter.DeleteCommand) Is Nothing)) Then + While(i < Me.CommandCollection.Length) + Me.CommandCollection(CInt((i))).Transaction = Me._transaction + i =(i + 1) + End While + + If((Me.Adapter IsNot Nothing) AndAlso (Me.Adapter.DeleteCommand IsNot Nothing)) Then Me.Adapter.DeleteCommand.Transaction = Me._transaction End If - If ((Not (Me.Adapter) Is Nothing) _ - AndAlso (Not (Me.Adapter.InsertCommand) Is Nothing)) Then + + If((Me.Adapter IsNot Nothing) AndAlso (Me.Adapter.InsertCommand IsNot Nothing)) Then Me.Adapter.InsertCommand.Transaction = Me._transaction End If - If ((Not (Me.Adapter) Is Nothing) _ - AndAlso (Not (Me.Adapter.UpdateCommand) Is Nothing)) Then + + If((Me.Adapter IsNot Nothing) AndAlso (Me.Adapter.UpdateCommand IsNot Nothing)) Then Me.Adapter.UpdateCommand.Transaction = Me._transaction End If End Set End Property - _ - Protected ReadOnly Property CommandCollection() As Global.System.Data.OleDb.OleDbCommand() + + + Protected ReadOnly Property CommandCollection As Global.System.Data.OleDb.OleDbCommand() Get - If (Me._commandCollection Is Nothing) Then + If(Me._commandCollection Is Nothing) Then Me.InitCommandCollection() End If + Return Me._commandCollection End Get End Property - _ - Public Property ClearBeforeFill() As Boolean + + + Public Property ClearBeforeFill As Boolean Get Return Me._clearBeforeFill End Get - Set(value As Boolean) + + Set(ByVal value As Boolean) Me._clearBeforeFill = value End Set End Property - _ + + Private Sub InitAdapter() Me._adapter = New Global.System.Data.OleDb.OleDbDataAdapter() Dim tableMapping As Global.System.Data.Common.DataTableMapping = New Global.System.Data.Common.DataTableMapping() @@ -1149,678 +1159,680 @@ Namespace nwindDataSetTableAdapters Me._adapter.TableMappings.Add(tableMapping) Me._adapter.DeleteCommand = New Global.System.Data.OleDb.OleDbCommand() Me._adapter.DeleteCommand.Connection = Me.Connection - Me._adapter.DeleteCommand.CommandText = "DELETE FROM `Products` WHERE ((`ProductID` = ?) AND ((? = 1 AND `ProductName` IS " & _ - "NULL) OR (`ProductName` = ?)) AND ((? = 1 AND `SupplierID` IS NULL) OR (`Supplie" & _ - "rID` = ?)) AND ((? = 1 AND `CategoryID` IS NULL) OR (`CategoryID` = ?)) AND ((? " & _ - "= 1 AND `QuantityPerUnit` IS NULL) OR (`QuantityPerUnit` = ?)) AND ((? = 1 AND `" & _ - "UnitPrice` IS NULL) OR (`UnitPrice` = ?)) AND ((? = 1 AND `UnitsInStock` IS NULL" & _ - ") OR (`UnitsInStock` = ?)) AND ((? = 1 AND `UnitsOnOrder` IS NULL) OR (`UnitsOnO" & _ - "rder` = ?)) AND ((? = 1 AND `ReorderLevel` IS NULL) OR (`ReorderLevel` = ?)) AND" & _ - " ((? = 1 AND `Discontinued` IS NULL) OR (`Discontinued` = ?)) AND ((? = 1 AND `E" & _ - "AN13` IS NULL) OR (`EAN13` = ?)))" + Me._adapter.DeleteCommand.CommandText = "DELETE FROM `Products` WHERE ((`ProductID` = ?) AND ((? = 1 AND `ProductName` IS NULL) OR (`ProductName` = ?)) AND ((? = 1 AND `SupplierID` IS NULL) OR (`SupplierID` = ?)) AND ((? = 1 AND `CategoryID` IS NULL) OR (`CategoryID` = ?)) AND ((? = 1 AND `QuantityPerUnit` IS NULL) OR (`QuantityPerUnit` = ?)) AND ((? = 1 AND `UnitPrice` IS NULL) OR (`UnitPrice` = ?)) AND ((? = 1 AND `UnitsInStock` IS NULL) OR (`UnitsInStock` = ?)) AND ((? = 1 AND `UnitsOnOrder` IS NULL) OR (`UnitsOnOrder` = ?)) AND ((? = 1 AND `ReorderLevel` IS NULL) OR (`ReorderLevel` = ?)) AND ((? = 1 AND `Discontinued` IS NULL) OR (`Discontinued` = ?)) AND ((? = 1 AND `EAN13` IS NULL) OR (`EAN13` = ?)))" Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_ProductID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "ProductID", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_ProductName", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "ProductName", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_ProductName", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "ProductName", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_SupplierID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "SupplierID", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_SupplierID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "SupplierID", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_CategoryID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "CategoryID", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_CategoryID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "CategoryID", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_QuantityPerUnit", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "QuantityPerUnit", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_QuantityPerUnit", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "QuantityPerUnit", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UnitPrice", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "UnitPrice", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UnitPrice", Global.System.Data.OleDb.OleDbType.Currency, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "UnitPrice", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UnitsInStock", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "UnitsInStock", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UnitsInStock", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "UnitsInStock", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UnitsOnOrder", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "UnitsOnOrder", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UnitsOnOrder", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "UnitsOnOrder", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_ReorderLevel", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "ReorderLevel", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_ReorderLevel", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "ReorderLevel", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_Discontinued", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "Discontinued", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_Discontinued", Global.System.Data.OleDb.OleDbType.[Boolean], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "Discontinued", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_EAN13", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "EAN13", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_EAN13", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "EAN13", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_ProductID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "ProductID", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_ProductName", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "ProductName", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_ProductName", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "ProductName", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_SupplierID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "SupplierID", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_SupplierID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "SupplierID", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_CategoryID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "CategoryID", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_CategoryID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "CategoryID", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_QuantityPerUnit", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "QuantityPerUnit", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_QuantityPerUnit", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "QuantityPerUnit", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UnitPrice", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "UnitPrice", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UnitPrice", Global.System.Data.OleDb.OleDbType.Currency, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "UnitPrice", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UnitsInStock", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "UnitsInStock", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UnitsInStock", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "UnitsInStock", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UnitsOnOrder", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "UnitsOnOrder", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UnitsOnOrder", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "UnitsOnOrder", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_ReorderLevel", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "ReorderLevel", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_ReorderLevel", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "ReorderLevel", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_Discontinued", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "Discontinued", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_Discontinued", Global.System.Data.OleDb.OleDbType.[Boolean], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "Discontinued", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_EAN13", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "EAN13", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_EAN13", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "EAN13", Global.System.Data.DataRowVersion.Original, False, Nothing)) Me._adapter.InsertCommand = New Global.System.Data.OleDb.OleDbCommand() Me._adapter.InsertCommand.Connection = Me.Connection - Me._adapter.InsertCommand.CommandText = "INSERT INTO `Products` (`ProductName`, `SupplierID`, `CategoryID`, `QuantityPerUn" & _ - "it`, `UnitPrice`, `UnitsInStock`, `UnitsOnOrder`, `ReorderLevel`, `Discontinued`" & _ - ", `EAN13`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" + Me._adapter.InsertCommand.CommandText = "INSERT INTO `Products` (`ProductName`, `SupplierID`, `CategoryID`, `QuantityPerUn" & "it`, `UnitPrice`, `UnitsInStock`, `UnitsOnOrder`, `ReorderLevel`, `Discontinued`" & ", `EAN13`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text - Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("ProductName", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "ProductName", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("SupplierID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "SupplierID", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("CategoryID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "CategoryID", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("QuantityPerUnit", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "QuantityPerUnit", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UnitPrice", Global.System.Data.OleDb.OleDbType.Currency, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "UnitPrice", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UnitsInStock", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "UnitsInStock", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UnitsOnOrder", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "UnitsOnOrder", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("ReorderLevel", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "ReorderLevel", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Discontinued", Global.System.Data.OleDb.OleDbType.[Boolean], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "Discontinued", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("EAN13", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "EAN13", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("ProductName", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "ProductName", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("SupplierID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "SupplierID", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("CategoryID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "CategoryID", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("QuantityPerUnit", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "QuantityPerUnit", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UnitPrice", Global.System.Data.OleDb.OleDbType.Currency, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "UnitPrice", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UnitsInStock", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "UnitsInStock", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UnitsOnOrder", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "UnitsOnOrder", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("ReorderLevel", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "ReorderLevel", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Discontinued", Global.System.Data.OleDb.OleDbType.[Boolean], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "Discontinued", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("EAN13", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "EAN13", Global.System.Data.DataRowVersion.Current, False, Nothing)) Me._adapter.UpdateCommand = New Global.System.Data.OleDb.OleDbCommand() Me._adapter.UpdateCommand.Connection = Me.Connection - Me._adapter.UpdateCommand.CommandText = "UPDATE `Products` SET `ProductName` = ?, `SupplierID` = ?, `CategoryID` = ?, `Qua" & _ - "ntityPerUnit` = ?, `UnitPrice` = ?, `UnitsInStock` = ?, `UnitsOnOrder` = ?, `Reo" & _ - "rderLevel` = ?, `Discontinued` = ?, `EAN13` = ? WHERE ((`ProductID` = ?) AND ((?" & _ - " = 1 AND `ProductName` IS NULL) OR (`ProductName` = ?)) AND ((? = 1 AND `Supplie" & _ - "rID` IS NULL) OR (`SupplierID` = ?)) AND ((? = 1 AND `CategoryID` IS NULL) OR (`" & _ - "CategoryID` = ?)) AND ((? = 1 AND `QuantityPerUnit` IS NULL) OR (`QuantityPerUni" & _ - "t` = ?)) AND ((? = 1 AND `UnitPrice` IS NULL) OR (`UnitPrice` = ?)) AND ((? = 1 " & _ - "AND `UnitsInStock` IS NULL) OR (`UnitsInStock` = ?)) AND ((? = 1 AND `UnitsOnOrd" & _ - "er` IS NULL) OR (`UnitsOnOrder` = ?)) AND ((? = 1 AND `ReorderLevel` IS NULL) OR" & _ - " (`ReorderLevel` = ?)) AND ((? = 1 AND `Discontinued` IS NULL) OR (`Discontinued" & _ - "` = ?)) AND ((? = 1 AND `EAN13` IS NULL) OR (`EAN13` = ?)))" + Me._adapter.UpdateCommand.CommandText = "UPDATE `Products` SET `ProductName` = ?, `SupplierID` = ?, `CategoryID` = ?, `QuantityPerUnit` = ?, `UnitPrice` = ?, `UnitsInStock` = ?, `UnitsOnOrder` = ?, `ReorderLevel` = ?, `Discontinued` = ?, `EAN13` = ? WHERE ((`ProductID` = ?) AND ((? = 1 AND `ProductName` IS NULL) OR (`ProductName` = ?)) AND ((? = 1 AND `SupplierID` IS NULL) OR (`SupplierID` = ?)) AND ((? = 1 AND `CategoryID` IS NULL) OR (`CategoryID` = ?)) AND ((? = 1 AND `QuantityPerUnit` IS NULL) OR (`QuantityPerUnit` = ?)) AND ((? = 1 AND `UnitPrice` IS NULL) OR (`UnitPrice` = ?)) AND ((? = 1 AND `UnitsInStock` IS NULL) OR (`UnitsInStock` = ?)) AND ((? = 1 AND `UnitsOnOrder` IS NULL) OR (`UnitsOnOrder` = ?)) AND ((? = 1 AND `ReorderLevel` IS NULL) OR (`ReorderLevel` = ?)) AND ((? = 1 AND `Discontinued` IS NULL) OR (`Discontinued` = ?)) AND ((? = 1 AND `EAN13` IS NULL) OR (`EAN13` = ?)))" Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("ProductName", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "ProductName", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("SupplierID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "SupplierID", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("CategoryID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "CategoryID", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("QuantityPerUnit", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "QuantityPerUnit", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UnitPrice", Global.System.Data.OleDb.OleDbType.Currency, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "UnitPrice", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UnitsInStock", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "UnitsInStock", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UnitsOnOrder", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "UnitsOnOrder", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("ReorderLevel", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "ReorderLevel", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Discontinued", Global.System.Data.OleDb.OleDbType.[Boolean], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "Discontinued", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("EAN13", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "EAN13", Global.System.Data.DataRowVersion.Current, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_ProductID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "ProductID", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_ProductName", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "ProductName", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_ProductName", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "ProductName", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_SupplierID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "SupplierID", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_SupplierID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "SupplierID", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_CategoryID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "CategoryID", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_CategoryID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "CategoryID", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_QuantityPerUnit", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "QuantityPerUnit", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_QuantityPerUnit", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "QuantityPerUnit", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UnitPrice", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "UnitPrice", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UnitPrice", Global.System.Data.OleDb.OleDbType.Currency, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "UnitPrice", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UnitsInStock", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "UnitsInStock", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UnitsInStock", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "UnitsInStock", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UnitsOnOrder", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "UnitsOnOrder", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UnitsOnOrder", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "UnitsOnOrder", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_ReorderLevel", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "ReorderLevel", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_ReorderLevel", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "ReorderLevel", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_Discontinued", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "Discontinued", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_Discontinued", Global.System.Data.OleDb.OleDbType.[Boolean], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "Discontinued", Global.System.Data.DataRowVersion.Original, False, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_EAN13", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "EAN13", Global.System.Data.DataRowVersion.Original, True, Nothing)) - Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_EAN13", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0, Byte), CType(0, Byte), "EAN13", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("ProductName", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "ProductName", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("SupplierID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "SupplierID", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("CategoryID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "CategoryID", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("QuantityPerUnit", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "QuantityPerUnit", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UnitPrice", Global.System.Data.OleDb.OleDbType.Currency, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "UnitPrice", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UnitsInStock", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "UnitsInStock", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UnitsOnOrder", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "UnitsOnOrder", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("ReorderLevel", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "ReorderLevel", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Discontinued", Global.System.Data.OleDb.OleDbType.[Boolean], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "Discontinued", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("EAN13", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "EAN13", Global.System.Data.DataRowVersion.Current, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_ProductID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "ProductID", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_ProductName", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "ProductName", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_ProductName", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "ProductName", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_SupplierID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "SupplierID", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_SupplierID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "SupplierID", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_CategoryID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "CategoryID", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_CategoryID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "CategoryID", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_QuantityPerUnit", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "QuantityPerUnit", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_QuantityPerUnit", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "QuantityPerUnit", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UnitPrice", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "UnitPrice", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UnitPrice", Global.System.Data.OleDb.OleDbType.Currency, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "UnitPrice", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UnitsInStock", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "UnitsInStock", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UnitsInStock", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "UnitsInStock", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UnitsOnOrder", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "UnitsOnOrder", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UnitsOnOrder", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "UnitsOnOrder", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_ReorderLevel", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "ReorderLevel", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_ReorderLevel", Global.System.Data.OleDb.OleDbType.SmallInt, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "ReorderLevel", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_Discontinued", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "Discontinued", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_Discontinued", Global.System.Data.OleDb.OleDbType.[Boolean], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "Discontinued", Global.System.Data.DataRowVersion.Original, False, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_EAN13", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "EAN13", Global.System.Data.DataRowVersion.Original, True, Nothing)) + Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_EAN13", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, (CByte((0))), (CByte((0))), "EAN13", Global.System.Data.DataRowVersion.Original, False, Nothing)) End Sub - _ + + Private Sub InitConnection() Me._connection = New Global.System.Data.OleDb.OleDbConnection() - Me._connection.ConnectionString = My.Settings.Default.nwindConnectionString + Me._connection.ConnectionString = Global.MinimalisticReportPreviewDemo.Properties.Settings.[Default].nwindConnectionString End Sub - _ + + Private Sub InitCommandCollection() Me._commandCollection = New Global.System.Data.OleDb.OleDbCommand(0) {} Me._commandCollection(0) = New Global.System.Data.OleDb.OleDbCommand() - Me._commandCollection(0).Connection = Me.Connection - Me._commandCollection(0).CommandText = "SELECT ProductID, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice" & _ - ", UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued, EAN13 FROM Products" - Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text + Me._commandCollection(CInt((0))).Connection = Me.Connection + Me._commandCollection(CInt((0))).CommandText = "SELECT ProductID, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice" & ", UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued, EAN13 FROM Products" + Me._commandCollection(CInt((0))).CommandType = Global.System.Data.CommandType.Text End Sub - _ - Public Overridable Overloads Function Fill(ByVal dataTable As nwindDataSet.ProductsDataTable) As Integer + + + + + Public Overridable Function Fill(ByVal dataTable As MinimalisticReportPreviewDemo.nwindDataSet.ProductsDataTable) As Integer Me.Adapter.SelectCommand = Me.CommandCollection(0) - If (Me.ClearBeforeFill = True) Then + If(Me.ClearBeforeFill = True) Then dataTable.Clear() End If + Dim returnValue As Integer = Me.Adapter.Fill(dataTable) Return returnValue End Function - _ - Public Overridable Overloads Function GetData() As nwindDataSet.ProductsDataTable + + + + + Public Overridable Function GetData() As MinimalisticReportPreviewDemo.nwindDataSet.ProductsDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) - Dim dataTable As nwindDataSet.ProductsDataTable = New nwindDataSet.ProductsDataTable() + Dim dataTable As MinimalisticReportPreviewDemo.nwindDataSet.ProductsDataTable = New MinimalisticReportPreviewDemo.nwindDataSet.ProductsDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function - _ - Public Overridable Overloads Function Update(ByVal dataTable As nwindDataSet.ProductsDataTable) As Integer + + + + Public Overridable Function Update(ByVal dataTable As MinimalisticReportPreviewDemo.nwindDataSet.ProductsDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function - _ - Public Overridable Overloads Function Update(ByVal dataSet As nwindDataSet) As Integer + + + + Public Overridable Function Update(ByVal dataSet As MinimalisticReportPreviewDemo.nwindDataSet) As Integer Return Me.Adapter.Update(dataSet, "Products") End Function - _ - Public Overridable Overloads Function Update(ByVal dataRow As Global.System.Data.DataRow) As Integer + + + + Public Overridable Function Update(ByVal dataRow As Global.System.Data.DataRow) As Integer Return Me.Adapter.Update(New Global.System.Data.DataRow() {dataRow}) End Function - _ - Public Overridable Overloads Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer + + + + Public Overridable Function Update(ByVal dataRows As Global.System.Data.DataRow()) As Integer Return Me.Adapter.Update(dataRows) End Function - _ - Public Overridable Overloads Function Delete(ByVal Original_ProductID As Integer, ByVal Original_ProductName As String, ByVal Original_SupplierID As Global.System.Nullable(Of Integer), ByVal Original_CategoryID As Global.System.Nullable(Of Integer), ByVal Original_QuantityPerUnit As String, ByVal Original_UnitPrice As Global.System.Nullable(Of Decimal), ByVal Original_UnitsInStock As Global.System.Nullable(Of Short), ByVal Original_UnitsOnOrder As Global.System.Nullable(Of Short), ByVal Original_ReorderLevel As Global.System.Nullable(Of Short), ByVal Original_Discontinued As Boolean, ByVal Original_EAN13 As String) As Integer - Me.Adapter.DeleteCommand.Parameters(0).Value = CType(Original_ProductID, Integer) - If (Original_ProductName Is Nothing) Then + + + + + Public Overridable Function Delete(ByVal Original_ProductID As Integer, ByVal Original_ProductName As String, ByVal Original_SupplierID As Global.System.Nullable(Of Integer), ByVal Original_CategoryID As Global.System.Nullable(Of Integer), ByVal Original_QuantityPerUnit As String, ByVal Original_UnitPrice As Global.System.Nullable(Of Decimal), ByVal Original_UnitsInStock As Global.System.Nullable(Of Short), ByVal Original_UnitsOnOrder As Global.System.Nullable(Of Short), ByVal Original_ReorderLevel As Global.System.Nullable(Of Short), ByVal Original_Discontinued As Boolean, ByVal Original_EAN13 As String) As Integer + Me.Adapter.DeleteCommand.Parameters(CInt((0))).Value =(CInt((Original_ProductID))) + If(Equals(Original_ProductName, Nothing)) Then Throw New Global.System.ArgumentNullException("Original_ProductName") Else - Me.Adapter.DeleteCommand.Parameters(1).Value = CType(0, Object) - Me.Adapter.DeleteCommand.Parameters(2).Value = CType(Original_ProductName, String) + Me.Adapter.DeleteCommand.Parameters(CInt((1))).Value =(CObj((0))) + Me.Adapter.DeleteCommand.Parameters(CInt((2))).Value =(CStr((Original_ProductName))) End If - If (Original_SupplierID.HasValue = True) Then - Me.Adapter.DeleteCommand.Parameters(3).Value = CType(0, Object) - Me.Adapter.DeleteCommand.Parameters(4).Value = CType(Original_SupplierID.Value, Integer) + + If(Original_SupplierID.HasValue = True) Then + Me.Adapter.DeleteCommand.Parameters(CInt((3))).Value =(CObj((0))) + Me.Adapter.DeleteCommand.Parameters(CInt((4))).Value =(CInt((Original_SupplierID.Value))) Else - Me.Adapter.DeleteCommand.Parameters(3).Value = CType(1, Object) - Me.Adapter.DeleteCommand.Parameters(4).Value = Global.System.DBNull.Value + Me.Adapter.DeleteCommand.Parameters(CInt((3))).Value =(CObj((1))) + Me.Adapter.DeleteCommand.Parameters(CInt((4))).Value = Global.System.DBNull.Value End If - If (Original_CategoryID.HasValue = True) Then - Me.Adapter.DeleteCommand.Parameters(5).Value = CType(0, Object) - Me.Adapter.DeleteCommand.Parameters(6).Value = CType(Original_CategoryID.Value, Integer) + + If(Original_CategoryID.HasValue = True) Then + Me.Adapter.DeleteCommand.Parameters(CInt((5))).Value =(CObj((0))) + Me.Adapter.DeleteCommand.Parameters(CInt((6))).Value =(CInt((Original_CategoryID.Value))) Else - Me.Adapter.DeleteCommand.Parameters(5).Value = CType(1, Object) - Me.Adapter.DeleteCommand.Parameters(6).Value = Global.System.DBNull.Value + Me.Adapter.DeleteCommand.Parameters(CInt((5))).Value =(CObj((1))) + Me.Adapter.DeleteCommand.Parameters(CInt((6))).Value = Global.System.DBNull.Value End If - If (Original_QuantityPerUnit Is Nothing) Then - Me.Adapter.DeleteCommand.Parameters(7).Value = CType(1, Object) - Me.Adapter.DeleteCommand.Parameters(8).Value = Global.System.DBNull.Value + + If(Equals(Original_QuantityPerUnit, Nothing)) Then + Me.Adapter.DeleteCommand.Parameters(CInt((7))).Value =(CObj((1))) + Me.Adapter.DeleteCommand.Parameters(CInt((8))).Value = Global.System.DBNull.Value Else - Me.Adapter.DeleteCommand.Parameters(7).Value = CType(0, Object) - Me.Adapter.DeleteCommand.Parameters(8).Value = CType(Original_QuantityPerUnit, String) + Me.Adapter.DeleteCommand.Parameters(CInt((7))).Value =(CObj((0))) + Me.Adapter.DeleteCommand.Parameters(CInt((8))).Value =(CStr((Original_QuantityPerUnit))) End If - If (Original_UnitPrice.HasValue = True) Then - Me.Adapter.DeleteCommand.Parameters(9).Value = CType(0, Object) - Me.Adapter.DeleteCommand.Parameters(10).Value = CType(Original_UnitPrice.Value, Decimal) + + If(Original_UnitPrice.HasValue = True) Then + Me.Adapter.DeleteCommand.Parameters(CInt((9))).Value =(CObj((0))) + Me.Adapter.DeleteCommand.Parameters(CInt((10))).Value =(CDec((Original_UnitPrice.Value))) Else - Me.Adapter.DeleteCommand.Parameters(9).Value = CType(1, Object) - Me.Adapter.DeleteCommand.Parameters(10).Value = Global.System.DBNull.Value + Me.Adapter.DeleteCommand.Parameters(CInt((9))).Value =(CObj((1))) + Me.Adapter.DeleteCommand.Parameters(CInt((10))).Value = Global.System.DBNull.Value End If - If (Original_UnitsInStock.HasValue = True) Then - Me.Adapter.DeleteCommand.Parameters(11).Value = CType(0, Object) - Me.Adapter.DeleteCommand.Parameters(12).Value = CType(Original_UnitsInStock.Value, Short) + + If(Original_UnitsInStock.HasValue = True) Then + Me.Adapter.DeleteCommand.Parameters(CInt((11))).Value =(CObj((0))) + Me.Adapter.DeleteCommand.Parameters(CInt((12))).Value =(CShort((Original_UnitsInStock.Value))) Else - Me.Adapter.DeleteCommand.Parameters(11).Value = CType(1, Object) - Me.Adapter.DeleteCommand.Parameters(12).Value = Global.System.DBNull.Value + Me.Adapter.DeleteCommand.Parameters(CInt((11))).Value =(CObj((1))) + Me.Adapter.DeleteCommand.Parameters(CInt((12))).Value = Global.System.DBNull.Value End If - If (Original_UnitsOnOrder.HasValue = True) Then - Me.Adapter.DeleteCommand.Parameters(13).Value = CType(0, Object) - Me.Adapter.DeleteCommand.Parameters(14).Value = CType(Original_UnitsOnOrder.Value, Short) + + If(Original_UnitsOnOrder.HasValue = True) Then + Me.Adapter.DeleteCommand.Parameters(CInt((13))).Value =(CObj((0))) + Me.Adapter.DeleteCommand.Parameters(CInt((14))).Value =(CShort((Original_UnitsOnOrder.Value))) Else - Me.Adapter.DeleteCommand.Parameters(13).Value = CType(1, Object) - Me.Adapter.DeleteCommand.Parameters(14).Value = Global.System.DBNull.Value + Me.Adapter.DeleteCommand.Parameters(CInt((13))).Value =(CObj((1))) + Me.Adapter.DeleteCommand.Parameters(CInt((14))).Value = Global.System.DBNull.Value End If - If (Original_ReorderLevel.HasValue = True) Then - Me.Adapter.DeleteCommand.Parameters(15).Value = CType(0, Object) - Me.Adapter.DeleteCommand.Parameters(16).Value = CType(Original_ReorderLevel.Value, Short) + + If(Original_ReorderLevel.HasValue = True) Then + Me.Adapter.DeleteCommand.Parameters(CInt((15))).Value =(CObj((0))) + Me.Adapter.DeleteCommand.Parameters(CInt((16))).Value =(CShort((Original_ReorderLevel.Value))) Else - Me.Adapter.DeleteCommand.Parameters(15).Value = CType(1, Object) - Me.Adapter.DeleteCommand.Parameters(16).Value = Global.System.DBNull.Value + Me.Adapter.DeleteCommand.Parameters(CInt((15))).Value =(CObj((1))) + Me.Adapter.DeleteCommand.Parameters(CInt((16))).Value = Global.System.DBNull.Value End If - Me.Adapter.DeleteCommand.Parameters(17).Value = CType(0, Object) - Me.Adapter.DeleteCommand.Parameters(18).Value = CType(Original_Discontinued, Boolean) - If (Original_EAN13 Is Nothing) Then - Me.Adapter.DeleteCommand.Parameters(19).Value = CType(1, Object) - Me.Adapter.DeleteCommand.Parameters(20).Value = Global.System.DBNull.Value + + Me.Adapter.DeleteCommand.Parameters(CInt((17))).Value =(CObj((0))) + Me.Adapter.DeleteCommand.Parameters(CInt((18))).Value =(CBool((Original_Discontinued))) + If(Equals(Original_EAN13, Nothing)) Then + Me.Adapter.DeleteCommand.Parameters(CInt((19))).Value =(CObj((1))) + Me.Adapter.DeleteCommand.Parameters(CInt((20))).Value = Global.System.DBNull.Value Else - Me.Adapter.DeleteCommand.Parameters(19).Value = CType(0, Object) - Me.Adapter.DeleteCommand.Parameters(20).Value = CType(Original_EAN13, String) + Me.Adapter.DeleteCommand.Parameters(CInt((19))).Value =(CObj((0))) + Me.Adapter.DeleteCommand.Parameters(CInt((20))).Value =(CStr((Original_EAN13))) End If + Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.DeleteCommand.Connection.State - If ((Me.Adapter.DeleteCommand.Connection.State And Global.System.Data.ConnectionState.Open) _ - <> Global.System.Data.ConnectionState.Open) Then + If((Me.Adapter.DeleteCommand.Connection.State And Global.System.Data.ConnectionState.Open) <> Global.System.Data.ConnectionState.Open) Then Me.Adapter.DeleteCommand.Connection.Open() End If + Try - Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery + Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery() Return returnValue Finally - If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then + If(previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.DeleteCommand.Connection.Close() End If End Try End Function - _ - Public Overridable Overloads Function Insert(ByVal ProductName As String, ByVal SupplierID As Global.System.Nullable(Of Integer), ByVal CategoryID As Global.System.Nullable(Of Integer), ByVal QuantityPerUnit As String, ByVal UnitPrice As Global.System.Nullable(Of Decimal), ByVal UnitsInStock As Global.System.Nullable(Of Short), ByVal UnitsOnOrder As Global.System.Nullable(Of Short), ByVal ReorderLevel As Global.System.Nullable(Of Short), ByVal Discontinued As Boolean, ByVal EAN13 As String) As Integer - If (ProductName Is Nothing) Then + + + + + Public Overridable Function Insert(ByVal ProductName As String, ByVal SupplierID As Global.System.Nullable(Of Integer), ByVal CategoryID As Global.System.Nullable(Of Integer), ByVal QuantityPerUnit As String, ByVal UnitPrice As Global.System.Nullable(Of Decimal), ByVal UnitsInStock As Global.System.Nullable(Of Short), ByVal UnitsOnOrder As Global.System.Nullable(Of Short), ByVal ReorderLevel As Global.System.Nullable(Of Short), ByVal Discontinued As Boolean, ByVal EAN13 As String) As Integer + If(Equals(ProductName, Nothing)) Then Throw New Global.System.ArgumentNullException("ProductName") Else - Me.Adapter.InsertCommand.Parameters(0).Value = CType(ProductName, String) + Me.Adapter.InsertCommand.Parameters(CInt((0))).Value =(CStr((ProductName))) End If - If (SupplierID.HasValue = True) Then - Me.Adapter.InsertCommand.Parameters(1).Value = CType(SupplierID.Value, Integer) + + If(SupplierID.HasValue = True) Then + Me.Adapter.InsertCommand.Parameters(CInt((1))).Value =(CInt((SupplierID.Value))) Else - Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value + Me.Adapter.InsertCommand.Parameters(CInt((1))).Value = Global.System.DBNull.Value End If - If (CategoryID.HasValue = True) Then - Me.Adapter.InsertCommand.Parameters(2).Value = CType(CategoryID.Value, Integer) + + If(CategoryID.HasValue = True) Then + Me.Adapter.InsertCommand.Parameters(CInt((2))).Value =(CInt((CategoryID.Value))) Else - Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value + Me.Adapter.InsertCommand.Parameters(CInt((2))).Value = Global.System.DBNull.Value End If - If (QuantityPerUnit Is Nothing) Then - Me.Adapter.InsertCommand.Parameters(3).Value = Global.System.DBNull.Value + + If(Equals(QuantityPerUnit, Nothing)) Then + Me.Adapter.InsertCommand.Parameters(CInt((3))).Value = Global.System.DBNull.Value Else - Me.Adapter.InsertCommand.Parameters(3).Value = CType(QuantityPerUnit, String) + Me.Adapter.InsertCommand.Parameters(CInt((3))).Value =(CStr((QuantityPerUnit))) End If - If (UnitPrice.HasValue = True) Then - Me.Adapter.InsertCommand.Parameters(4).Value = CType(UnitPrice.Value, Decimal) + + If(UnitPrice.HasValue = True) Then + Me.Adapter.InsertCommand.Parameters(CInt((4))).Value =(CDec((UnitPrice.Value))) Else - Me.Adapter.InsertCommand.Parameters(4).Value = Global.System.DBNull.Value + Me.Adapter.InsertCommand.Parameters(CInt((4))).Value = Global.System.DBNull.Value End If - If (UnitsInStock.HasValue = True) Then - Me.Adapter.InsertCommand.Parameters(5).Value = CType(UnitsInStock.Value, Short) + + If(UnitsInStock.HasValue = True) Then + Me.Adapter.InsertCommand.Parameters(CInt((5))).Value =(CShort((UnitsInStock.Value))) Else - Me.Adapter.InsertCommand.Parameters(5).Value = Global.System.DBNull.Value + Me.Adapter.InsertCommand.Parameters(CInt((5))).Value = Global.System.DBNull.Value End If - If (UnitsOnOrder.HasValue = True) Then - Me.Adapter.InsertCommand.Parameters(6).Value = CType(UnitsOnOrder.Value, Short) + + If(UnitsOnOrder.HasValue = True) Then + Me.Adapter.InsertCommand.Parameters(CInt((6))).Value =(CShort((UnitsOnOrder.Value))) Else - Me.Adapter.InsertCommand.Parameters(6).Value = Global.System.DBNull.Value + Me.Adapter.InsertCommand.Parameters(CInt((6))).Value = Global.System.DBNull.Value End If - If (ReorderLevel.HasValue = True) Then - Me.Adapter.InsertCommand.Parameters(7).Value = CType(ReorderLevel.Value, Short) + + If(ReorderLevel.HasValue = True) Then + Me.Adapter.InsertCommand.Parameters(CInt((7))).Value =(CShort((ReorderLevel.Value))) Else - Me.Adapter.InsertCommand.Parameters(7).Value = Global.System.DBNull.Value + Me.Adapter.InsertCommand.Parameters(CInt((7))).Value = Global.System.DBNull.Value End If - Me.Adapter.InsertCommand.Parameters(8).Value = CType(Discontinued, Boolean) - If (EAN13 Is Nothing) Then - Me.Adapter.InsertCommand.Parameters(9).Value = Global.System.DBNull.Value + + Me.Adapter.InsertCommand.Parameters(CInt((8))).Value =(CBool((Discontinued))) + If(Equals(EAN13, Nothing)) Then + Me.Adapter.InsertCommand.Parameters(CInt((9))).Value = Global.System.DBNull.Value Else - Me.Adapter.InsertCommand.Parameters(9).Value = CType(EAN13, String) + Me.Adapter.InsertCommand.Parameters(CInt((9))).Value =(CStr((EAN13))) End If + Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.InsertCommand.Connection.State - If ((Me.Adapter.InsertCommand.Connection.State And Global.System.Data.ConnectionState.Open) _ - <> Global.System.Data.ConnectionState.Open) Then + If((Me.Adapter.InsertCommand.Connection.State And Global.System.Data.ConnectionState.Open) <> Global.System.Data.ConnectionState.Open) Then Me.Adapter.InsertCommand.Connection.Open() End If + Try - Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery + Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery() Return returnValue Finally - If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then + If(previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.InsertCommand.Connection.Close() End If End Try End Function - _ - Public Overridable Overloads Function Update( _ - ByVal ProductName As String, _ - ByVal SupplierID As Global.System.Nullable(Of Integer), _ - ByVal CategoryID As Global.System.Nullable(Of Integer), _ - ByVal QuantityPerUnit As String, _ - ByVal UnitPrice As Global.System.Nullable(Of Decimal), _ - ByVal UnitsInStock As Global.System.Nullable(Of Short), _ - ByVal UnitsOnOrder As Global.System.Nullable(Of Short), _ - ByVal ReorderLevel As Global.System.Nullable(Of Short), _ - ByVal Discontinued As Boolean, _ - ByVal EAN13 As String, _ - ByVal Original_ProductID As Integer, _ - ByVal Original_ProductName As String, _ - ByVal Original_SupplierID As Global.System.Nullable(Of Integer), _ - ByVal Original_CategoryID As Global.System.Nullable(Of Integer), _ - ByVal Original_QuantityPerUnit As String, _ - ByVal Original_UnitPrice As Global.System.Nullable(Of Decimal), _ - ByVal Original_UnitsInStock As Global.System.Nullable(Of Short), _ - ByVal Original_UnitsOnOrder As Global.System.Nullable(Of Short), _ - ByVal Original_ReorderLevel As Global.System.Nullable(Of Short), _ - ByVal Original_Discontinued As Boolean, _ - ByVal Original_EAN13 As String) As Integer - If (ProductName Is Nothing) Then + + + + + Public Overridable Function Update(ByVal ProductName As String, ByVal SupplierID As Global.System.Nullable(Of Integer), ByVal CategoryID As Global.System.Nullable(Of Integer), ByVal QuantityPerUnit As String, ByVal UnitPrice As Global.System.Nullable(Of Decimal), ByVal UnitsInStock As Global.System.Nullable(Of Short), ByVal UnitsOnOrder As Global.System.Nullable(Of Short), ByVal ReorderLevel As Global.System.Nullable(Of Short), ByVal Discontinued As Boolean, ByVal EAN13 As String, ByVal Original_ProductID As Integer, ByVal Original_ProductName As String, ByVal Original_SupplierID As Global.System.Nullable(Of Integer), ByVal Original_CategoryID As Global.System.Nullable(Of Integer), ByVal Original_QuantityPerUnit As String, ByVal Original_UnitPrice As Global.System.Nullable(Of Decimal), ByVal Original_UnitsInStock As Global.System.Nullable(Of Short), ByVal Original_UnitsOnOrder As Global.System.Nullable(Of Short), ByVal Original_ReorderLevel As Global.System.Nullable(Of Short), ByVal Original_Discontinued As Boolean, ByVal Original_EAN13 As String) As Integer + If(Equals(ProductName, Nothing)) Then Throw New Global.System.ArgumentNullException("ProductName") Else - Me.Adapter.UpdateCommand.Parameters(0).Value = CType(ProductName, String) + Me.Adapter.UpdateCommand.Parameters(CInt((0))).Value =(CStr((ProductName))) End If - If (SupplierID.HasValue = True) Then - Me.Adapter.UpdateCommand.Parameters(1).Value = CType(SupplierID.Value, Integer) + + If(SupplierID.HasValue = True) Then + Me.Adapter.UpdateCommand.Parameters(CInt((1))).Value =(CInt((SupplierID.Value))) Else - Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value + Me.Adapter.UpdateCommand.Parameters(CInt((1))).Value = Global.System.DBNull.Value End If - If (CategoryID.HasValue = True) Then - Me.Adapter.UpdateCommand.Parameters(2).Value = CType(CategoryID.Value, Integer) + + If(CategoryID.HasValue = True) Then + Me.Adapter.UpdateCommand.Parameters(CInt((2))).Value =(CInt((CategoryID.Value))) Else - Me.Adapter.UpdateCommand.Parameters(2).Value = Global.System.DBNull.Value + Me.Adapter.UpdateCommand.Parameters(CInt((2))).Value = Global.System.DBNull.Value End If - If (QuantityPerUnit Is Nothing) Then - Me.Adapter.UpdateCommand.Parameters(3).Value = Global.System.DBNull.Value + + If(Equals(QuantityPerUnit, Nothing)) Then + Me.Adapter.UpdateCommand.Parameters(CInt((3))).Value = Global.System.DBNull.Value Else - Me.Adapter.UpdateCommand.Parameters(3).Value = CType(QuantityPerUnit, String) + Me.Adapter.UpdateCommand.Parameters(CInt((3))).Value =(CStr((QuantityPerUnit))) End If - If (UnitPrice.HasValue = True) Then - Me.Adapter.UpdateCommand.Parameters(4).Value = CType(UnitPrice.Value, Decimal) + + If(UnitPrice.HasValue = True) Then + Me.Adapter.UpdateCommand.Parameters(CInt((4))).Value =(CDec((UnitPrice.Value))) Else - Me.Adapter.UpdateCommand.Parameters(4).Value = Global.System.DBNull.Value + Me.Adapter.UpdateCommand.Parameters(CInt((4))).Value = Global.System.DBNull.Value End If - If (UnitsInStock.HasValue = True) Then - Me.Adapter.UpdateCommand.Parameters(5).Value = CType(UnitsInStock.Value, Short) + + If(UnitsInStock.HasValue = True) Then + Me.Adapter.UpdateCommand.Parameters(CInt((5))).Value =(CShort((UnitsInStock.Value))) Else - Me.Adapter.UpdateCommand.Parameters(5).Value = Global.System.DBNull.Value + Me.Adapter.UpdateCommand.Parameters(CInt((5))).Value = Global.System.DBNull.Value End If - If (UnitsOnOrder.HasValue = True) Then - Me.Adapter.UpdateCommand.Parameters(6).Value = CType(UnitsOnOrder.Value, Short) + + If(UnitsOnOrder.HasValue = True) Then + Me.Adapter.UpdateCommand.Parameters(CInt((6))).Value =(CShort((UnitsOnOrder.Value))) Else - Me.Adapter.UpdateCommand.Parameters(6).Value = Global.System.DBNull.Value + Me.Adapter.UpdateCommand.Parameters(CInt((6))).Value = Global.System.DBNull.Value End If - If (ReorderLevel.HasValue = True) Then - Me.Adapter.UpdateCommand.Parameters(7).Value = CType(ReorderLevel.Value, Short) + + If(ReorderLevel.HasValue = True) Then + Me.Adapter.UpdateCommand.Parameters(CInt((7))).Value =(CShort((ReorderLevel.Value))) Else - Me.Adapter.UpdateCommand.Parameters(7).Value = Global.System.DBNull.Value + Me.Adapter.UpdateCommand.Parameters(CInt((7))).Value = Global.System.DBNull.Value End If - Me.Adapter.UpdateCommand.Parameters(8).Value = CType(Discontinued, Boolean) - If (EAN13 Is Nothing) Then - Me.Adapter.UpdateCommand.Parameters(9).Value = Global.System.DBNull.Value + + Me.Adapter.UpdateCommand.Parameters(CInt((8))).Value =(CBool((Discontinued))) + If(Equals(EAN13, Nothing)) Then + Me.Adapter.UpdateCommand.Parameters(CInt((9))).Value = Global.System.DBNull.Value Else - Me.Adapter.UpdateCommand.Parameters(9).Value = CType(EAN13, String) + Me.Adapter.UpdateCommand.Parameters(CInt((9))).Value =(CStr((EAN13))) End If - Me.Adapter.UpdateCommand.Parameters(10).Value = CType(Original_ProductID, Integer) - If (Original_ProductName Is Nothing) Then + + Me.Adapter.UpdateCommand.Parameters(CInt((10))).Value =(CInt((Original_ProductID))) + If(Equals(Original_ProductName, Nothing)) Then Throw New Global.System.ArgumentNullException("Original_ProductName") Else - Me.Adapter.UpdateCommand.Parameters(11).Value = CType(0, Object) - Me.Adapter.UpdateCommand.Parameters(12).Value = CType(Original_ProductName, String) + Me.Adapter.UpdateCommand.Parameters(CInt((11))).Value =(CObj((0))) + Me.Adapter.UpdateCommand.Parameters(CInt((12))).Value =(CStr((Original_ProductName))) End If - If (Original_SupplierID.HasValue = True) Then - Me.Adapter.UpdateCommand.Parameters(13).Value = CType(0, Object) - Me.Adapter.UpdateCommand.Parameters(14).Value = CType(Original_SupplierID.Value, Integer) + + If(Original_SupplierID.HasValue = True) Then + Me.Adapter.UpdateCommand.Parameters(CInt((13))).Value =(CObj((0))) + Me.Adapter.UpdateCommand.Parameters(CInt((14))).Value =(CInt((Original_SupplierID.Value))) Else - Me.Adapter.UpdateCommand.Parameters(13).Value = CType(1, Object) - Me.Adapter.UpdateCommand.Parameters(14).Value = Global.System.DBNull.Value + Me.Adapter.UpdateCommand.Parameters(CInt((13))).Value =(CObj((1))) + Me.Adapter.UpdateCommand.Parameters(CInt((14))).Value = Global.System.DBNull.Value End If - If (Original_CategoryID.HasValue = True) Then - Me.Adapter.UpdateCommand.Parameters(15).Value = CType(0, Object) - Me.Adapter.UpdateCommand.Parameters(16).Value = CType(Original_CategoryID.Value, Integer) + + If(Original_CategoryID.HasValue = True) Then + Me.Adapter.UpdateCommand.Parameters(CInt((15))).Value =(CObj((0))) + Me.Adapter.UpdateCommand.Parameters(CInt((16))).Value =(CInt((Original_CategoryID.Value))) Else - Me.Adapter.UpdateCommand.Parameters(15).Value = CType(1, Object) - Me.Adapter.UpdateCommand.Parameters(16).Value = Global.System.DBNull.Value + Me.Adapter.UpdateCommand.Parameters(CInt((15))).Value =(CObj((1))) + Me.Adapter.UpdateCommand.Parameters(CInt((16))).Value = Global.System.DBNull.Value End If - If (Original_QuantityPerUnit Is Nothing) Then - Me.Adapter.UpdateCommand.Parameters(17).Value = CType(1, Object) - Me.Adapter.UpdateCommand.Parameters(18).Value = Global.System.DBNull.Value + + If(Equals(Original_QuantityPerUnit, Nothing)) Then + Me.Adapter.UpdateCommand.Parameters(CInt((17))).Value =(CObj((1))) + Me.Adapter.UpdateCommand.Parameters(CInt((18))).Value = Global.System.DBNull.Value Else - Me.Adapter.UpdateCommand.Parameters(17).Value = CType(0, Object) - Me.Adapter.UpdateCommand.Parameters(18).Value = CType(Original_QuantityPerUnit, String) + Me.Adapter.UpdateCommand.Parameters(CInt((17))).Value =(CObj((0))) + Me.Adapter.UpdateCommand.Parameters(CInt((18))).Value =(CStr((Original_QuantityPerUnit))) End If - If (Original_UnitPrice.HasValue = True) Then - Me.Adapter.UpdateCommand.Parameters(19).Value = CType(0, Object) - Me.Adapter.UpdateCommand.Parameters(20).Value = CType(Original_UnitPrice.Value, Decimal) + + If(Original_UnitPrice.HasValue = True) Then + Me.Adapter.UpdateCommand.Parameters(CInt((19))).Value =(CObj((0))) + Me.Adapter.UpdateCommand.Parameters(CInt((20))).Value =(CDec((Original_UnitPrice.Value))) Else - Me.Adapter.UpdateCommand.Parameters(19).Value = CType(1, Object) - Me.Adapter.UpdateCommand.Parameters(20).Value = Global.System.DBNull.Value + Me.Adapter.UpdateCommand.Parameters(CInt((19))).Value =(CObj((1))) + Me.Adapter.UpdateCommand.Parameters(CInt((20))).Value = Global.System.DBNull.Value End If - If (Original_UnitsInStock.HasValue = True) Then - Me.Adapter.UpdateCommand.Parameters(21).Value = CType(0, Object) - Me.Adapter.UpdateCommand.Parameters(22).Value = CType(Original_UnitsInStock.Value, Short) + + If(Original_UnitsInStock.HasValue = True) Then + Me.Adapter.UpdateCommand.Parameters(CInt((21))).Value =(CObj((0))) + Me.Adapter.UpdateCommand.Parameters(CInt((22))).Value =(CShort((Original_UnitsInStock.Value))) Else - Me.Adapter.UpdateCommand.Parameters(21).Value = CType(1, Object) - Me.Adapter.UpdateCommand.Parameters(22).Value = Global.System.DBNull.Value + Me.Adapter.UpdateCommand.Parameters(CInt((21))).Value =(CObj((1))) + Me.Adapter.UpdateCommand.Parameters(CInt((22))).Value = Global.System.DBNull.Value End If - If (Original_UnitsOnOrder.HasValue = True) Then - Me.Adapter.UpdateCommand.Parameters(23).Value = CType(0, Object) - Me.Adapter.UpdateCommand.Parameters(24).Value = CType(Original_UnitsOnOrder.Value, Short) + + If(Original_UnitsOnOrder.HasValue = True) Then + Me.Adapter.UpdateCommand.Parameters(CInt((23))).Value =(CObj((0))) + Me.Adapter.UpdateCommand.Parameters(CInt((24))).Value =(CShort((Original_UnitsOnOrder.Value))) Else - Me.Adapter.UpdateCommand.Parameters(23).Value = CType(1, Object) - Me.Adapter.UpdateCommand.Parameters(24).Value = Global.System.DBNull.Value + Me.Adapter.UpdateCommand.Parameters(CInt((23))).Value =(CObj((1))) + Me.Adapter.UpdateCommand.Parameters(CInt((24))).Value = Global.System.DBNull.Value End If - If (Original_ReorderLevel.HasValue = True) Then - Me.Adapter.UpdateCommand.Parameters(25).Value = CType(0, Object) - Me.Adapter.UpdateCommand.Parameters(26).Value = CType(Original_ReorderLevel.Value, Short) + + If(Original_ReorderLevel.HasValue = True) Then + Me.Adapter.UpdateCommand.Parameters(CInt((25))).Value =(CObj((0))) + Me.Adapter.UpdateCommand.Parameters(CInt((26))).Value =(CShort((Original_ReorderLevel.Value))) Else - Me.Adapter.UpdateCommand.Parameters(25).Value = CType(1, Object) - Me.Adapter.UpdateCommand.Parameters(26).Value = Global.System.DBNull.Value + Me.Adapter.UpdateCommand.Parameters(CInt((25))).Value =(CObj((1))) + Me.Adapter.UpdateCommand.Parameters(CInt((26))).Value = Global.System.DBNull.Value End If - Me.Adapter.UpdateCommand.Parameters(27).Value = CType(0, Object) - Me.Adapter.UpdateCommand.Parameters(28).Value = CType(Original_Discontinued, Boolean) - If (Original_EAN13 Is Nothing) Then - Me.Adapter.UpdateCommand.Parameters(29).Value = CType(1, Object) - Me.Adapter.UpdateCommand.Parameters(30).Value = Global.System.DBNull.Value + + Me.Adapter.UpdateCommand.Parameters(CInt((27))).Value =(CObj((0))) + Me.Adapter.UpdateCommand.Parameters(CInt((28))).Value =(CBool((Original_Discontinued))) + If(Equals(Original_EAN13, Nothing)) Then + Me.Adapter.UpdateCommand.Parameters(CInt((29))).Value =(CObj((1))) + Me.Adapter.UpdateCommand.Parameters(CInt((30))).Value = Global.System.DBNull.Value Else - Me.Adapter.UpdateCommand.Parameters(29).Value = CType(0, Object) - Me.Adapter.UpdateCommand.Parameters(30).Value = CType(Original_EAN13, String) + Me.Adapter.UpdateCommand.Parameters(CInt((29))).Value =(CObj((0))) + Me.Adapter.UpdateCommand.Parameters(CInt((30))).Value =(CStr((Original_EAN13))) End If + Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.UpdateCommand.Connection.State - If ((Me.Adapter.UpdateCommand.Connection.State And Global.System.Data.ConnectionState.Open) _ - <> Global.System.Data.ConnectionState.Open) Then + If((Me.Adapter.UpdateCommand.Connection.State And Global.System.Data.ConnectionState.Open) <> Global.System.Data.ConnectionState.Open) Then Me.Adapter.UpdateCommand.Connection.Open() End If + Try - Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery + Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery() Return returnValue Finally - If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then + If(previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.UpdateCommand.Connection.Close() End If End Try End Function End Class - ''' - '''TableAdapterManager is used to coordinate TableAdapters in the dataset to enable Hierarchical Update scenarios - ''' - _ - Partial Public Class TableAdapterManager + ''' + ''' TableAdapterManager is used to coordinate TableAdapters in the dataset to enable Hierarchical Update scenarios + ''' + + + + + Public Partial Class TableAdapterManager Inherits Global.System.ComponentModel.Component - Private _updateOrder As UpdateOrderOption + Private _updateOrder As MinimalisticReportPreviewDemo.nwindDataSetTableAdapters.TableAdapterManager.UpdateOrderOption - Private _productsTableAdapter As ProductsTableAdapter + Private _productsTableAdapter As MinimalisticReportPreviewDemo.nwindDataSetTableAdapters.ProductsTableAdapter Private _backupDataSetBeforeUpdate As Boolean Private _connection As Global.System.Data.IDbConnection - _ - Public Property UpdateOrder() As UpdateOrderOption + + + Public Property UpdateOrder As UpdateOrderOption Get Return Me._updateOrder End Get - Set(value As UpdateOrderOption) + + Set(ByVal value As UpdateOrderOption) Me._updateOrder = value End Set End Property - _ - Public Property ProductsTableAdapter() As ProductsTableAdapter + + + + Public Property ProductsTableAdapter As ProductsTableAdapter Get Return Me._productsTableAdapter End Get - Set(value As ProductsTableAdapter) + + Set(ByVal value As ProductsTableAdapter) Me._productsTableAdapter = value End Set End Property - _ - Public Property BackupDataSetBeforeUpdate() As Boolean + + + Public Property BackupDataSetBeforeUpdate As Boolean Get Return Me._backupDataSetBeforeUpdate End Get - Set(value As Boolean) + + Set(ByVal value As Boolean) Me._backupDataSetBeforeUpdate = value End Set End Property - _ - Public Property Connection() As Global.System.Data.IDbConnection + + + + Public Property Connection As Global.System.Data.IDbConnection Get - If (Not (Me._connection) Is Nothing) Then + If(Me._connection IsNot Nothing) Then Return Me._connection End If - If ((Not (Me._productsTableAdapter) Is Nothing) _ - AndAlso (Not (Me._productsTableAdapter.Connection) Is Nothing)) Then + + If((Me._productsTableAdapter IsNot Nothing) AndAlso (Me._productsTableAdapter.Connection IsNot Nothing)) Then Return Me._productsTableAdapter.Connection End If + Return Nothing End Get - Set(value As Global.System.Data.IDbConnection) + + Set(ByVal value As Global.System.Data.IDbConnection) Me._connection = value End Set End Property - _ - Public ReadOnly Property TableAdapterInstanceCount() As Integer + + + + Public ReadOnly Property TableAdapterInstanceCount As Integer Get Dim count As Integer = 0 - If (Not (Me._productsTableAdapter) Is Nothing) Then - count = (count + 1) + If(Me._productsTableAdapter IsNot Nothing) Then + count =(count + 1) End If + Return count End Get End Property - ''' - '''Update rows in top-down order. - ''' - _ - Private Function UpdateUpdatedRows(ByVal dataSet As nwindDataSet, ByVal allChangedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow), ByVal allAddedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)) As Integer + ''' + ''' Update rows in top-down order. + ''' + + + Private Function UpdateUpdatedRows(ByVal dataSet As MinimalisticReportPreviewDemo.nwindDataSet, ByVal allChangedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow), ByVal allAddedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)) As Integer Dim result As Integer = 0 - If (Not (Me._productsTableAdapter) Is Nothing) Then - Dim updatedRows() As Global.System.Data.DataRow = dataSet.Products.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.ModifiedCurrent) + If(Me._productsTableAdapter IsNot Nothing) Then + Dim updatedRows As Global.System.Data.DataRow() = dataSet.Products.[Select](Nothing, Nothing, Global.System.Data.DataViewRowState.ModifiedCurrent) updatedRows = Me.GetRealUpdatedRows(updatedRows, allAddedRows) - If ((Not (updatedRows) Is Nothing) _ - AndAlso (0 < updatedRows.Length)) Then - result = (result + Me._productsTableAdapter.Update(updatedRows)) + If((updatedRows IsNot Nothing) AndAlso (0 < updatedRows.Length)) Then + result =(result + Me._productsTableAdapter.Update(updatedRows)) allChangedRows.AddRange(updatedRows) End If End If + Return result End Function - ''' - '''Insert rows in top-down order. - ''' - _ - Private Function UpdateInsertedRows(ByVal dataSet As nwindDataSet, ByVal allAddedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)) As Integer + ''' + ''' Insert rows in top-down order. + ''' + + + Private Function UpdateInsertedRows(ByVal dataSet As MinimalisticReportPreviewDemo.nwindDataSet, ByVal allAddedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)) As Integer Dim result As Integer = 0 - If (Not (Me._productsTableAdapter) Is Nothing) Then - Dim addedRows() As Global.System.Data.DataRow = dataSet.Products.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) - If ((Not (addedRows) Is Nothing) _ - AndAlso (0 < addedRows.Length)) Then - result = (result + Me._productsTableAdapter.Update(addedRows)) + If(Me._productsTableAdapter IsNot Nothing) Then + Dim addedRows As Global.System.Data.DataRow() = dataSet.Products.[Select](Nothing, Nothing, Global.System.Data.DataViewRowState.Added) + If((addedRows IsNot Nothing) AndAlso (0 < addedRows.Length)) Then + result =(result + Me._productsTableAdapter.Update(addedRows)) allAddedRows.AddRange(addedRows) End If End If + Return result End Function - ''' - '''Delete rows in bottom-up order. - ''' - _ - Private Function UpdateDeletedRows(ByVal dataSet As nwindDataSet, ByVal allChangedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)) As Integer + ''' + ''' Delete rows in bottom-up order. + ''' + + + Private Function UpdateDeletedRows(ByVal dataSet As MinimalisticReportPreviewDemo.nwindDataSet, ByVal allChangedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)) As Integer Dim result As Integer = 0 - If (Not (Me._productsTableAdapter) Is Nothing) Then - Dim deletedRows() As Global.System.Data.DataRow = dataSet.Products.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) - If ((Not (deletedRows) Is Nothing) _ - AndAlso (0 < deletedRows.Length)) Then - result = (result + Me._productsTableAdapter.Update(deletedRows)) + If(Me._productsTableAdapter IsNot Nothing) Then + Dim deletedRows As Global.System.Data.DataRow() = dataSet.Products.[Select](Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) + If((deletedRows IsNot Nothing) AndAlso (0 < deletedRows.Length)) Then + result =(result + Me._productsTableAdapter.Update(deletedRows)) allChangedRows.AddRange(deletedRows) End If End If + Return result End Function - ''' - '''Remove inserted rows that become updated rows after calling TableAdapter.Update(inserted rows) first - ''' - _ - Private Function GetRealUpdatedRows(ByVal updatedRows() As Global.System.Data.DataRow, ByVal allAddedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)) As Global.System.Data.DataRow() - If ((updatedRows Is Nothing) _ - OrElse (updatedRows.Length < 1)) Then + ''' + ''' Remove inserted rows that become updated rows after calling TableAdapter.Update(inserted rows) first + ''' + + + Private Function GetRealUpdatedRows(ByVal updatedRows As Global.System.Data.DataRow(), ByVal allAddedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)) As Global.System.Data.DataRow() + If((updatedRows Is Nothing) OrElse (updatedRows.Length < 1)) Then Return updatedRows End If - If ((allAddedRows Is Nothing) _ - OrElse (allAddedRows.Count < 1)) Then + + If((allAddedRows Is Nothing) OrElse (allAddedRows.Count < 1)) Then Return updatedRows End If + Dim realUpdatedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow) = New Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)() Dim i As Integer = 0 - Do While (i < updatedRows.Length) + While(i < updatedRows.Length) Dim row As Global.System.Data.DataRow = updatedRows(i) - If (allAddedRows.Contains(row) = False) Then + If(allAddedRows.Contains(row) = False) Then realUpdatedRows.Add(row) End If - i = (i + 1) - Loop - Return realUpdatedRows.ToArray + + i =(i + 1) + End While + + Return realUpdatedRows.ToArray() End Function - ''' - '''Update all changes to the dataset. - ''' - _ - Public Overridable Function UpdateAll(ByVal dataSet As nwindDataSet) As Integer - If (dataSet Is Nothing) Then + ''' + ''' Update all changes to the dataset. + ''' + + + Public Overridable Function UpdateAll(ByVal dataSet As MinimalisticReportPreviewDemo.nwindDataSet) As Integer + If(dataSet Is Nothing) Then Throw New Global.System.ArgumentNullException("dataSet") End If - If (dataSet.HasChanges = False) Then + + If(dataSet.HasChanges() = False) Then Return 0 End If - If ((Not (Me._productsTableAdapter) Is Nothing) _ - AndAlso (Me.MatchTableAdapterConnection(Me._productsTableAdapter.Connection) = False)) Then - Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" & _ - "tring.") + + If((Me._productsTableAdapter IsNot Nothing) AndAlso (Me.MatchTableAdapterConnection(Me._productsTableAdapter.Connection) = False)) Then + Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" & "tring.") End If + Dim workConnection As Global.System.Data.IDbConnection = Me.Connection - If (workConnection Is Nothing) Then - Throw New Global.System.ApplicationException("TableAdapterManager contains no connection information. Set each TableAdapterMana" & _ - "ger TableAdapter property to a valid TableAdapter instance.") + If(workConnection Is Nothing) Then + Throw New Global.System.ApplicationException("TableAdapterManager contains no connection information. Set each TableAdapterMana" & "ger TableAdapter property to a valid TableAdapter instance.") End If + Dim workConnOpened As Boolean = False - If ((workConnection.State And Global.System.Data.ConnectionState.Broken) _ - = Global.System.Data.ConnectionState.Broken) Then + If((workConnection.State And Global.System.Data.ConnectionState.Broken) = Global.System.Data.ConnectionState.Broken) Then workConnection.Close() End If - If (workConnection.State = Global.System.Data.ConnectionState.Closed) Then + + If(workConnection.State = Global.System.Data.ConnectionState.Closed) Then workConnection.Open() workConnOpened = True End If - Dim workTransaction As Global.System.Data.IDbTransaction = workConnection.BeginTransaction - If (workTransaction Is Nothing) Then - Throw New Global.System.ApplicationException("The transaction cannot begin. The current data connection does not support transa" & _ - "ctions or the current state is not allowing the transaction to begin.") + + Dim workTransaction As Global.System.Data.IDbTransaction = workConnection.BeginTransaction() + If(workTransaction Is Nothing) Then + Throw New Global.System.ApplicationException("The transaction cannot begin. The current data connection does not support transa" & "ctions or the current state is not allowing the transaction to begin.") End If + Dim allChangedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow) = New Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)() Dim allAddedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow) = New Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)() Dim adaptersWithAcceptChangesDuringUpdate As Global.System.Collections.Generic.List(Of Global.System.Data.Common.DataAdapter) = New Global.System.Collections.Generic.List(Of Global.System.Data.Common.DataAdapter)() @@ -1831,133 +1843,141 @@ Namespace nwindDataSetTableAdapters backupDataSet = New Global.System.Data.DataSet() backupDataSet.Merge(dataSet) End If + Try - '---- Prepare for update ----------- + ' ---- Prepare for update ----------- ' - If (Not (Me._productsTableAdapter) Is Nothing) Then + If(Me._productsTableAdapter IsNot Nothing) Then revertConnections.Add(Me._productsTableAdapter, Me._productsTableAdapter.Connection) - Me._productsTableAdapter.Connection = CType(workConnection, Global.System.Data.OleDb.OleDbConnection) - Me._productsTableAdapter.Transaction = CType(workTransaction, Global.System.Data.OleDb.OleDbTransaction) + Me._productsTableAdapter.Connection = CType((workConnection), Global.System.Data.OleDb.OleDbConnection) + Me._productsTableAdapter.Transaction = CType((workTransaction), Global.System.Data.OleDb.OleDbTransaction) If Me._productsTableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._productsTableAdapter.Adapter.AcceptChangesDuringUpdate = False adaptersWithAcceptChangesDuringUpdate.Add(Me._productsTableAdapter.Adapter) End If End If - ' + + ' '---- Perform updates ----------- ' - If (Me.UpdateOrder = UpdateOrderOption.UpdateInsertDelete) Then - result = (result + Me.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows)) - result = (result + Me.UpdateInsertedRows(dataSet, allAddedRows)) + If(Me.UpdateOrder = MinimalisticReportPreviewDemo.nwindDataSetTableAdapters.TableAdapterManager.UpdateOrderOption.UpdateInsertDelete) Then + result =(result + Me.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows)) + result =(result + Me.UpdateInsertedRows(dataSet, allAddedRows)) Else - result = (result + Me.UpdateInsertedRows(dataSet, allAddedRows)) - result = (result + Me.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows)) + result =(result + Me.UpdateInsertedRows(dataSet, allAddedRows)) + result =(result + Me.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows)) End If - result = (result + Me.UpdateDeletedRows(dataSet, allChangedRows)) - ' + + result =(result + Me.UpdateDeletedRows(dataSet, allChangedRows)) + ' '---- Commit updates ----------- ' workTransaction.Commit() - If (0 < allAddedRows.Count) Then - Dim rows((allAddedRows.Count) - 1) As Global.System.Data.DataRow + If(0 < allAddedRows.Count) Then + Dim rows As Global.System.Data.DataRow() = New System.Data.DataRow(allAddedRows.Count - 1) {} allAddedRows.CopyTo(rows) Dim i As Integer = 0 - Do While (i < rows.Length) + While(i < rows.Length) Dim row As Global.System.Data.DataRow = rows(i) row.AcceptChanges() - i = (i + 1) - Loop + i =(i + 1) + End While End If - If (0 < allChangedRows.Count) Then - Dim rows((allChangedRows.Count) - 1) As Global.System.Data.DataRow + + If(0 < allChangedRows.Count) Then + Dim rows As Global.System.Data.DataRow() = New System.Data.DataRow(allChangedRows.Count - 1) {} allChangedRows.CopyTo(rows) Dim i As Integer = 0 - Do While (i < rows.Length) + While(i < rows.Length) Dim row As Global.System.Data.DataRow = rows(i) row.AcceptChanges() - i = (i + 1) - Loop + i =(i + 1) + End While End If Catch ex As Global.System.Exception workTransaction.Rollback() - '---- Restore the dataset ----------- + ' ---- Restore the dataset ----------- If Me.BackupDataSetBeforeUpdate Then - Global.System.Diagnostics.Debug.Assert((Not (backupDataSet) Is Nothing)) + Call Global.System.Diagnostics.Debug.Assert((backupDataSet IsNot Nothing)) dataSet.Clear() dataSet.Merge(backupDataSet) Else - If (0 < allAddedRows.Count) Then - Dim rows((allAddedRows.Count) - 1) As Global.System.Data.DataRow + If(0 < allAddedRows.Count) Then + Dim rows As Global.System.Data.DataRow() = New System.Data.DataRow(allAddedRows.Count - 1) {} allAddedRows.CopyTo(rows) Dim i As Integer = 0 - Do While (i < rows.Length) + While(i < rows.Length) Dim row As Global.System.Data.DataRow = rows(i) row.AcceptChanges() row.SetAdded() - i = (i + 1) - Loop + i =(i + 1) + End While End If End If + Throw ex Finally If workConnOpened Then workConnection.Close() End If - If (Not (Me._productsTableAdapter) Is Nothing) Then - Me._productsTableAdapter.Connection = CType(revertConnections(Me._productsTableAdapter), Global.System.Data.OleDb.OleDbConnection) + + If(Me._productsTableAdapter IsNot Nothing) Then + Me._productsTableAdapter.Connection = CType((revertConnections(Me._productsTableAdapter)), Global.System.Data.OleDb.OleDbConnection) Me._productsTableAdapter.Transaction = Nothing End If - If (0 < adaptersWithAcceptChangesDuringUpdate.Count) Then - Dim adapters((adaptersWithAcceptChangesDuringUpdate.Count) - 1) As Global.System.Data.Common.DataAdapter + + If(0 < adaptersWithAcceptChangesDuringUpdate.Count) Then + Dim adapters As Global.System.Data.Common.DataAdapter() = New System.Data.Common.DataAdapter(adaptersWithAcceptChangesDuringUpdate.Count - 1) {} adaptersWithAcceptChangesDuringUpdate.CopyTo(adapters) Dim i As Integer = 0 - Do While (i < adapters.Length) + While(i < adapters.Length) Dim adapter As Global.System.Data.Common.DataAdapter = adapters(i) adapter.AcceptChangesDuringUpdate = True - i = (i + 1) - Loop + i =(i + 1) + End While End If End Try + Return result End Function - _ - Protected Overridable Sub SortSelfReferenceRows(ByVal rows() As Global.System.Data.DataRow, ByVal relation As Global.System.Data.DataRelation, ByVal childFirst As Boolean) - Global.System.Array.Sort(Of Global.System.Data.DataRow)(rows, New SelfReferenceComparer(relation, childFirst)) + + + Protected Overridable Sub SortSelfReferenceRows(ByVal rows As Global.System.Data.DataRow(), ByVal relation As Global.System.Data.DataRelation, ByVal childFirst As Boolean) + Call Global.System.Array.Sort(Of Global.System.Data.DataRow)(rows, New MinimalisticReportPreviewDemo.nwindDataSetTableAdapters.TableAdapterManager.SelfReferenceComparer(relation, childFirst)) End Sub - _ + + Protected Overridable Function MatchTableAdapterConnection(ByVal inputConnection As Global.System.Data.IDbConnection) As Boolean - If (Not (Me._connection) Is Nothing) Then + If(Me._connection IsNot Nothing) Then Return True End If - If ((Me.Connection Is Nothing) _ - OrElse (inputConnection Is Nothing)) Then + + If((Me.Connection Is Nothing) OrElse (inputConnection Is Nothing)) Then Return True End If + If String.Equals(Me.Connection.ConnectionString, inputConnection.ConnectionString, Global.System.StringComparison.Ordinal) Then Return True End If + Return False End Function - ''' - '''Update Order Option - ''' - _ + ''' + ''' Update Order Option + ''' + Public Enum UpdateOrderOption - InsertUpdateDelete = 0 - UpdateInsertDelete = 1 End Enum - ''' - '''Used to sort self-referenced table's rows - ''' - _ + ''' + ''' Used to sort self-referenced table's rows + ''' + Private Class SelfReferenceComparer Inherits Object Implements Global.System.Collections.Generic.IComparer(Of Global.System.Data.DataRow) @@ -1966,10 +1986,9 @@ Namespace nwindDataSetTableAdapters Private _childFirst As Integer - _ + + Friend Sub New(ByVal relation As Global.System.Data.DataRelation, ByVal childFirst As Boolean) - MyBase.New() Me._relation = relation If childFirst Then Me._childFirst = -1 @@ -1978,70 +1997,61 @@ Namespace nwindDataSetTableAdapters End If End Sub - _ - Private Function GetRoot(ByVal row As Global.System.Data.DataRow, ByRef distance As Integer) As Global.System.Data.DataRow - Global.System.Diagnostics.Debug.Assert((Not (row) Is Nothing)) + + + Private Function GetRoot(ByVal row As Global.System.Data.DataRow, ByRef distance As Integer) As Global.System.Data.DataRow + Call Global.System.Diagnostics.Debug.Assert((row IsNot Nothing)) Dim root As Global.System.Data.DataRow = row distance = 0 - Dim traversedRows As Global.System.Collections.Generic.IDictionary(Of Global.System.Data.DataRow, Global.System.Data.DataRow) = New Global.System.Collections.Generic.Dictionary(Of Global.System.Data.DataRow, Global.System.Data.DataRow)() traversedRows(row) = row - Dim parent As Global.System.Data.DataRow = row.GetParentRow(Me._relation, Global.System.Data.DataRowVersion.[Default]) - - Do While ((Not (parent) Is Nothing) _ - AndAlso (traversedRows.ContainsKey(parent) = False)) - distance = (distance + 1) + While((parent IsNot Nothing) AndAlso (traversedRows.ContainsKey(parent) = False)) + distance =(distance + 1) root = parent traversedRows(parent) = parent parent = parent.GetParentRow(Me._relation, Global.System.Data.DataRowVersion.[Default]) + End While - Loop - - If (distance = 0) Then + If(distance = 0) Then traversedRows.Clear() traversedRows(row) = row parent = row.GetParentRow(Me._relation, Global.System.Data.DataRowVersion.Original) - - Do While ((Not (parent) Is Nothing) _ - AndAlso (traversedRows.ContainsKey(parent) = False)) - distance = (distance + 1) + While((parent IsNot Nothing) AndAlso (traversedRows.ContainsKey(parent) = False)) + distance =(distance + 1) root = parent traversedRows(parent) = parent parent = parent.GetParentRow(Me._relation, Global.System.Data.DataRowVersion.Original) - - Loop + End While End If Return root End Function - _ + + Public Function Compare(ByVal row1 As Global.System.Data.DataRow, ByVal row2 As Global.System.Data.DataRow) As Integer Implements Global.System.Collections.Generic.IComparer(Of Global.System.Data.DataRow).Compare If Object.ReferenceEquals(row1, row2) Then Return 0 End If - If (row1 Is Nothing) Then + + If(row1 Is Nothing) Then Return -1 End If - If (row2 Is Nothing) Then + + If(row2 Is Nothing) Then Return 1 End If Dim distance1 As Integer = 0 Dim root1 As Global.System.Data.DataRow = Me.GetRoot(row1, distance1) - Dim distance2 As Integer = 0 Dim root2 As Global.System.Data.DataRow = Me.GetRoot(row2, distance2) - If Object.ReferenceEquals(root1, root2) Then - Return (Me._childFirst * distance1.CompareTo(distance2)) + Return(Me._childFirst * distance1.CompareTo(distance2)) Else - Global.System.Diagnostics.Debug.Assert(((Not (root1.Table) Is Nothing) _ - AndAlso (Not (root2.Table) Is Nothing))) - If (root1.Table.Rows.IndexOf(root1) < root2.Table.Rows.IndexOf(root2)) Then + Call Global.System.Diagnostics.Debug.Assert(((root1.Table IsNot Nothing) AndAlso (root2.Table IsNot Nothing))) + If(root1.Table.Rows.IndexOf(root1) < root2.Table.Rows.IndexOf(root2)) Then Return -1 Else Return 1 diff --git a/VB/MinimalisticReportPreviewDemo/nwindDataSet.xss b/VB/MinimalisticReportPreviewDemo/nwindDataSet.xss index e369bb9..5f28270 100644 --- a/VB/MinimalisticReportPreviewDemo/nwindDataSet.xss +++ b/VB/MinimalisticReportPreviewDemo/nwindDataSet.xss @@ -1,12 +1 @@ - - - - - - - - \ No newline at end of file + \ No newline at end of file