'------------------------------------------------------------------------------ ' ' This code was generated by a tool. ' Runtime Version:4.0.30319.42000 ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' '------------------------------------------------------------------------------ Option Strict Off Option Explicit On ''' '''Represents a strongly typed in-memory cache of data. ''' _ Partial Public Class NEADataSet Inherits Global.System.Data.DataSet Private tableAchievement As AchievementDataTable Private tableDOW As DOWDataTable Private tableFriends As FriendsDataTable Private tableGames As GamesDataTable Private tablePurchased As PurchasedDataTable Private tableReviews As ReviewsDataTable Private tableTags As TagsDataTable Private tableUser_Details As User_DetailsDataTable Private tableUsers As UsersDataTable Private tableWishlist As WishlistDataTable Private relationGamesAchievement As Global.System.Data.DataRelation Private relationGamesDOW As Global.System.Data.DataRelation Private relationGamesPurchased As Global.System.Data.DataRelation Private relationGamesReviews As Global.System.Data.DataRelation Private relationUser_DetailsUsers As Global.System.Data.DataRelation Private relationGamesWishlist As Global.System.Data.DataRelation 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("Achievement")) Is Nothing) Then MyBase.Tables.Add(New AchievementDataTable(ds.Tables("Achievement"))) End If If (Not (ds.Tables("DOW")) Is Nothing) Then MyBase.Tables.Add(New DOWDataTable(ds.Tables("DOW"))) End If If (Not (ds.Tables("Friends")) Is Nothing) Then MyBase.Tables.Add(New FriendsDataTable(ds.Tables("Friends"))) End If If (Not (ds.Tables("Games")) Is Nothing) Then MyBase.Tables.Add(New GamesDataTable(ds.Tables("Games"))) End If If (Not (ds.Tables("Purchased")) Is Nothing) Then MyBase.Tables.Add(New PurchasedDataTable(ds.Tables("Purchased"))) End If If (Not (ds.Tables("Reviews")) Is Nothing) Then MyBase.Tables.Add(New ReviewsDataTable(ds.Tables("Reviews"))) End If If (Not (ds.Tables("Tags")) Is Nothing) Then MyBase.Tables.Add(New TagsDataTable(ds.Tables("Tags"))) End If If (Not (ds.Tables("User_Details")) Is Nothing) Then MyBase.Tables.Add(New User_DetailsDataTable(ds.Tables("User_Details"))) End If If (Not (ds.Tables("Users")) Is Nothing) Then MyBase.Tables.Add(New UsersDataTable(ds.Tables("Users"))) End If If (Not (ds.Tables("Wishlist")) Is Nothing) Then MyBase.Tables.Add(New WishlistDataTable(ds.Tables("Wishlist"))) 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 Achievement() As AchievementDataTable Get Return Me.tableAchievement End Get End Property _ Public ReadOnly Property DOW() As DOWDataTable Get Return Me.tableDOW End Get End Property _ Public ReadOnly Property Friends() As FriendsDataTable Get Return Me.tableFriends End Get End Property _ Public ReadOnly Property Games() As GamesDataTable Get Return Me.tableGames End Get End Property _ Public ReadOnly Property Purchased() As PurchasedDataTable Get Return Me.tablePurchased End Get End Property _ Public ReadOnly Property Reviews() As ReviewsDataTable Get Return Me.tableReviews End Get End Property _ Public ReadOnly Property Tags() As TagsDataTable Get Return Me.tableTags End Get End Property _ Public ReadOnly Property User_Details() As User_DetailsDataTable Get Return Me.tableUser_Details End Get End Property _ Public ReadOnly Property Users() As UsersDataTable Get Return Me.tableUsers End Get End Property _ Public ReadOnly Property Wishlist() As WishlistDataTable Get Return Me.tableWishlist End Get End Property _ Public Overrides Property SchemaSerializationMode() As Global.System.Data.SchemaSerializationMode Get Return Me._schemaSerializationMode End Get Set 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 NEADataSet = CType(MyBase.Clone,NEADataSet) 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("Achievement")) Is Nothing) Then MyBase.Tables.Add(New AchievementDataTable(ds.Tables("Achievement"))) End If If (Not (ds.Tables("DOW")) Is Nothing) Then MyBase.Tables.Add(New DOWDataTable(ds.Tables("DOW"))) End If If (Not (ds.Tables("Friends")) Is Nothing) Then MyBase.Tables.Add(New FriendsDataTable(ds.Tables("Friends"))) End If If (Not (ds.Tables("Games")) Is Nothing) Then MyBase.Tables.Add(New GamesDataTable(ds.Tables("Games"))) End If If (Not (ds.Tables("Purchased")) Is Nothing) Then MyBase.Tables.Add(New PurchasedDataTable(ds.Tables("Purchased"))) End If If (Not (ds.Tables("Reviews")) Is Nothing) Then MyBase.Tables.Add(New ReviewsDataTable(ds.Tables("Reviews"))) End If If (Not (ds.Tables("Tags")) Is Nothing) Then MyBase.Tables.Add(New TagsDataTable(ds.Tables("Tags"))) End If If (Not (ds.Tables("User_Details")) Is Nothing) Then MyBase.Tables.Add(New User_DetailsDataTable(ds.Tables("User_Details"))) End If If (Not (ds.Tables("Users")) Is Nothing) Then MyBase.Tables.Add(New UsersDataTable(ds.Tables("Users"))) End If If (Not (ds.Tables("Wishlist")) Is Nothing) Then MyBase.Tables.Add(New WishlistDataTable(ds.Tables("Wishlist"))) 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.tableAchievement = CType(MyBase.Tables("Achievement"),AchievementDataTable) If (initTable = true) Then If (Not (Me.tableAchievement) Is Nothing) Then Me.tableAchievement.InitVars End If End If Me.tableDOW = CType(MyBase.Tables("DOW"),DOWDataTable) If (initTable = true) Then If (Not (Me.tableDOW) Is Nothing) Then Me.tableDOW.InitVars End If End If Me.tableFriends = CType(MyBase.Tables("Friends"),FriendsDataTable) If (initTable = true) Then If (Not (Me.tableFriends) Is Nothing) Then Me.tableFriends.InitVars End If End If Me.tableGames = CType(MyBase.Tables("Games"),GamesDataTable) If (initTable = true) Then If (Not (Me.tableGames) Is Nothing) Then Me.tableGames.InitVars End If End If Me.tablePurchased = CType(MyBase.Tables("Purchased"),PurchasedDataTable) If (initTable = true) Then If (Not (Me.tablePurchased) Is Nothing) Then Me.tablePurchased.InitVars End If End If Me.tableReviews = CType(MyBase.Tables("Reviews"),ReviewsDataTable) If (initTable = true) Then If (Not (Me.tableReviews) Is Nothing) Then Me.tableReviews.InitVars End If End If Me.tableTags = CType(MyBase.Tables("Tags"),TagsDataTable) If (initTable = true) Then If (Not (Me.tableTags) Is Nothing) Then Me.tableTags.InitVars End If End If Me.tableUser_Details = CType(MyBase.Tables("User_Details"),User_DetailsDataTable) If (initTable = true) Then If (Not (Me.tableUser_Details) Is Nothing) Then Me.tableUser_Details.InitVars End If End If Me.tableUsers = CType(MyBase.Tables("Users"),UsersDataTable) If (initTable = true) Then If (Not (Me.tableUsers) Is Nothing) Then Me.tableUsers.InitVars End If End If Me.tableWishlist = CType(MyBase.Tables("Wishlist"),WishlistDataTable) If (initTable = true) Then If (Not (Me.tableWishlist) Is Nothing) Then Me.tableWishlist.InitVars End If End If Me.relationGamesAchievement = Me.Relations("GamesAchievement") Me.relationGamesDOW = Me.Relations("GamesDOW") Me.relationGamesPurchased = Me.Relations("GamesPurchased") Me.relationGamesReviews = Me.Relations("GamesReviews") Me.relationUser_DetailsUsers = Me.Relations("User_DetailsUsers") Me.relationGamesWishlist = Me.Relations("GamesWishlist") End Sub _ Private Sub InitClass() Me.DataSetName = "NEADataSet" Me.Prefix = "" Me.Namespace = "http://tempuri.org/NEADataSet.xsd" Me.EnforceConstraints = true Me.SchemaSerializationMode = Global.System.Data.SchemaSerializationMode.IncludeSchema Me.tableAchievement = New AchievementDataTable() MyBase.Tables.Add(Me.tableAchievement) Me.tableDOW = New DOWDataTable() MyBase.Tables.Add(Me.tableDOW) Me.tableFriends = New FriendsDataTable() MyBase.Tables.Add(Me.tableFriends) Me.tableGames = New GamesDataTable() MyBase.Tables.Add(Me.tableGames) Me.tablePurchased = New PurchasedDataTable() MyBase.Tables.Add(Me.tablePurchased) Me.tableReviews = New ReviewsDataTable() MyBase.Tables.Add(Me.tableReviews) Me.tableTags = New TagsDataTable() MyBase.Tables.Add(Me.tableTags) Me.tableUser_Details = New User_DetailsDataTable() MyBase.Tables.Add(Me.tableUser_Details) Me.tableUsers = New UsersDataTable() MyBase.Tables.Add(Me.tableUsers) Me.tableWishlist = New WishlistDataTable() MyBase.Tables.Add(Me.tableWishlist) Me.relationGamesAchievement = New Global.System.Data.DataRelation("GamesAchievement", New Global.System.Data.DataColumn() {Me.tableGames.GameIDColumn}, New Global.System.Data.DataColumn() {Me.tableAchievement.GameIDColumn}, false) Me.Relations.Add(Me.relationGamesAchievement) Me.relationGamesDOW = New Global.System.Data.DataRelation("GamesDOW", New Global.System.Data.DataColumn() {Me.tableGames.GameIDColumn}, New Global.System.Data.DataColumn() {Me.tableDOW.GameIDColumn}, false) Me.Relations.Add(Me.relationGamesDOW) Me.relationGamesPurchased = New Global.System.Data.DataRelation("GamesPurchased", New Global.System.Data.DataColumn() {Me.tableGames.GameIDColumn}, New Global.System.Data.DataColumn() {Me.tablePurchased.GameIDColumn}, false) Me.Relations.Add(Me.relationGamesPurchased) Me.relationGamesReviews = New Global.System.Data.DataRelation("GamesReviews", New Global.System.Data.DataColumn() {Me.tableGames.GameIDColumn}, New Global.System.Data.DataColumn() {Me.tableReviews.GameIDColumn}, false) Me.Relations.Add(Me.relationGamesReviews) Me.relationUser_DetailsUsers = New Global.System.Data.DataRelation("User_DetailsUsers", New Global.System.Data.DataColumn() {Me.tableUser_Details.UserDetailsIDColumn}, New Global.System.Data.DataColumn() {Me.tableUsers.User_DetailsIDColumn}, false) Me.Relations.Add(Me.relationUser_DetailsUsers) Me.relationGamesWishlist = New Global.System.Data.DataRelation("GamesWishlist", New Global.System.Data.DataColumn() {Me.tableGames.GameIDColumn}, New Global.System.Data.DataColumn() {Me.tableWishlist.GameIDColumn}, false) Me.Relations.Add(Me.relationGamesWishlist) End Sub _ Private Function ShouldSerializeAchievement() As Boolean Return false End Function _ Private Function ShouldSerializeDOW() As Boolean Return false End Function _ Private Function ShouldSerializeFriends() As Boolean Return false End Function _ Private Function ShouldSerializeGames() As Boolean Return false End Function _ Private Function ShouldSerializePurchased() As Boolean Return false End Function _ Private Function ShouldSerializeReviews() As Boolean Return false End Function _ Private Function ShouldSerializeTags() As Boolean Return false End Function _ Private Function ShouldSerializeUser_Details() As Boolean Return false End Function _ Private Function ShouldSerializeUsers() As Boolean Return false End Function _ Private Function ShouldSerializeWishlist() 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 NEADataSet = New NEADataSet() 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 AchievementRowChangeEventHandler(ByVal sender As Object, ByVal e As AchievementRowChangeEvent) _ Public Delegate Sub DOWRowChangeEventHandler(ByVal sender As Object, ByVal e As DOWRowChangeEvent) _ Public Delegate Sub FriendsRowChangeEventHandler(ByVal sender As Object, ByVal e As FriendsRowChangeEvent) _ Public Delegate Sub GamesRowChangeEventHandler(ByVal sender As Object, ByVal e As GamesRowChangeEvent) _ Public Delegate Sub PurchasedRowChangeEventHandler(ByVal sender As Object, ByVal e As PurchasedRowChangeEvent) _ Public Delegate Sub ReviewsRowChangeEventHandler(ByVal sender As Object, ByVal e As ReviewsRowChangeEvent) _ Public Delegate Sub TagsRowChangeEventHandler(ByVal sender As Object, ByVal e As TagsRowChangeEvent) _ Public Delegate Sub User_DetailsRowChangeEventHandler(ByVal sender As Object, ByVal e As User_DetailsRowChangeEvent) _ Public Delegate Sub UsersRowChangeEventHandler(ByVal sender As Object, ByVal e As UsersRowChangeEvent) _ Public Delegate Sub WishlistRowChangeEventHandler(ByVal sender As Object, ByVal e As WishlistRowChangeEvent) ''' '''Represents the strongly named DataTable class. ''' _ Partial Public Class AchievementDataTable Inherits Global.System.Data.TypedTableBase(Of AchievementRow) Private columnAchievementID As Global.System.Data.DataColumn Private columnGameID As Global.System.Data.DataColumn Private columnUserID As Global.System.Data.DataColumn Private columnAchievment_1 As Global.System.Data.DataColumn Private columnAchievment_2 As Global.System.Data.DataColumn Private columnAchievment_3 As Global.System.Data.DataColumn Private columnAchievment_4 As Global.System.Data.DataColumn Private columnAchievment_5 As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "Achievement" Me.BeginInit Me.InitClass 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 AchievementIDColumn() As Global.System.Data.DataColumn Get Return Me.columnAchievementID End Get End Property _ Public ReadOnly Property GameIDColumn() As Global.System.Data.DataColumn Get Return Me.columnGameID End Get End Property _ Public ReadOnly Property UserIDColumn() As Global.System.Data.DataColumn Get Return Me.columnUserID End Get End Property _ Public ReadOnly Property Achievment_1Column() As Global.System.Data.DataColumn Get Return Me.columnAchievment_1 End Get End Property _ Public ReadOnly Property Achievment_2Column() As Global.System.Data.DataColumn Get Return Me.columnAchievment_2 End Get End Property _ Public ReadOnly Property Achievment_3Column() As Global.System.Data.DataColumn Get Return Me.columnAchievment_3 End Get End Property _ Public ReadOnly Property Achievment_4Column() As Global.System.Data.DataColumn Get Return Me.columnAchievment_4 End Get End Property _ Public ReadOnly Property Achievment_5Column() As Global.System.Data.DataColumn Get Return Me.columnAchievment_5 End Get End Property _ Public ReadOnly Property Count() As Integer Get Return Me.Rows.Count End Get End Property _ Public Default ReadOnly Property Item(ByVal index As Integer) As AchievementRow Get Return CType(Me.Rows(index),AchievementRow) End Get End Property _ Public Event AchievementRowChanging As AchievementRowChangeEventHandler _ Public Event AchievementRowChanged As AchievementRowChangeEventHandler _ Public Event AchievementRowDeleting As AchievementRowChangeEventHandler _ Public Event AchievementRowDeleted As AchievementRowChangeEventHandler _ Public Overloads Sub AddAchievementRow(ByVal row As AchievementRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddAchievementRow(ByVal parentGamesRowByGamesAchievement As GamesRow, ByVal UserID As Integer, ByVal Achievment_1 As String, ByVal Achievment_2 As String, ByVal Achievment_3 As String, ByVal Achievment_4 As String, ByVal Achievment_5 As String) As AchievementRow Dim rowAchievementRow As AchievementRow = CType(Me.NewRow,AchievementRow) Dim columnValuesArray() As Object = New Object() {Nothing, Nothing, UserID, Achievment_1, Achievment_2, Achievment_3, Achievment_4, Achievment_5} If (Not (parentGamesRowByGamesAchievement) Is Nothing) Then columnValuesArray(1) = parentGamesRowByGamesAchievement(0) End If rowAchievementRow.ItemArray = columnValuesArray Me.Rows.Add(rowAchievementRow) Return rowAchievementRow End Function _ Public Function FindByAchievementID(ByVal AchievementID As Integer) As AchievementRow Return CType(Me.Rows.Find(New Object() {AchievementID}),AchievementRow) End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As AchievementDataTable = CType(MyBase.Clone,AchievementDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New AchievementDataTable() End Function _ Friend Sub InitVars() Me.columnAchievementID = MyBase.Columns("AchievementID") Me.columnGameID = MyBase.Columns("GameID") Me.columnUserID = MyBase.Columns("UserID") Me.columnAchievment_1 = MyBase.Columns("Achievment 1") Me.columnAchievment_2 = MyBase.Columns("Achievment 2") Me.columnAchievment_3 = MyBase.Columns("Achievment 3") Me.columnAchievment_4 = MyBase.Columns("Achievment 4") Me.columnAchievment_5 = MyBase.Columns("Achievment 5") End Sub _ Private Sub InitClass() Me.columnAchievementID = New Global.System.Data.DataColumn("AchievementID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnAchievementID) Me.columnGameID = New Global.System.Data.DataColumn("GameID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnGameID) Me.columnUserID = New Global.System.Data.DataColumn("UserID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnUserID) Me.columnAchievment_1 = New Global.System.Data.DataColumn("Achievment 1", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnAchievment_1) Me.columnAchievment_2 = New Global.System.Data.DataColumn("Achievment 2", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnAchievment_2) Me.columnAchievment_3 = New Global.System.Data.DataColumn("Achievment 3", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnAchievment_3) Me.columnAchievment_4 = New Global.System.Data.DataColumn("Achievment 4", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnAchievment_4) Me.columnAchievment_5 = New Global.System.Data.DataColumn("Achievment 5", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnAchievment_5) Me.Constraints.Add(New Global.System.Data.UniqueConstraint("Constraint1", New Global.System.Data.DataColumn() {Me.columnAchievementID}, true)) Me.columnAchievementID.AutoIncrement = true Me.columnAchievementID.AutoIncrementSeed = -1 Me.columnAchievementID.AutoIncrementStep = -1 Me.columnAchievementID.AllowDBNull = false Me.columnAchievementID.Unique = true Me.columnAchievment_1.MaxLength = 536870910 Me.columnAchievment_2.MaxLength = 536870910 Me.columnAchievment_3.MaxLength = 536870910 Me.columnAchievment_4.MaxLength = 536870910 Me.columnAchievment_5.MaxLength = 536870910 End Sub _ Public Function NewAchievementRow() As AchievementRow Return CType(Me.NewRow,AchievementRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New AchievementRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(AchievementRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.AchievementRowChangedEvent) Is Nothing) Then RaiseEvent AchievementRowChanged(Me, New AchievementRowChangeEvent(CType(e.Row,AchievementRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.AchievementRowChangingEvent) Is Nothing) Then RaiseEvent AchievementRowChanging(Me, New AchievementRowChangeEvent(CType(e.Row,AchievementRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.AchievementRowDeletedEvent) Is Nothing) Then RaiseEvent AchievementRowDeleted(Me, New AchievementRowChangeEvent(CType(e.Row,AchievementRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.AchievementRowDeletingEvent) Is Nothing) Then RaiseEvent AchievementRowDeleting(Me, New AchievementRowChangeEvent(CType(e.Row,AchievementRow), e.Action)) End If End Sub _ Public Sub RemoveAchievementRow(ByVal row As AchievementRow) Me.Rows.Remove(row) End Sub _ 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 NEADataSet = New NEADataSet() 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 = "AchievementDataTable" 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(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 End Class ''' '''Represents the strongly named DataTable class. ''' _ Partial Public Class DOWDataTable Inherits Global.System.Data.TypedTableBase(Of DOWRow) Private columnDOWID As Global.System.Data.DataColumn Private columnStart As Global.System.Data.DataColumn Private columnEnd As Global.System.Data.DataColumn Private columnGameID As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "DOW" Me.BeginInit Me.InitClass 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 DOWIDColumn() As Global.System.Data.DataColumn Get Return Me.columnDOWID End Get End Property _ Public ReadOnly Property StartColumn() As Global.System.Data.DataColumn Get Return Me.columnStart End Get End Property _ Public ReadOnly Property EndColumn() As Global.System.Data.DataColumn Get Return Me.columnEnd End Get End Property _ Public ReadOnly Property GameIDColumn() As Global.System.Data.DataColumn Get Return Me.columnGameID End Get End Property _ Public ReadOnly Property Count() As Integer Get Return Me.Rows.Count End Get End Property _ Public Default ReadOnly Property Item(ByVal index As Integer) As DOWRow Get Return CType(Me.Rows(index),DOWRow) End Get End Property _ Public Event DOWRowChanging As DOWRowChangeEventHandler _ Public Event DOWRowChanged As DOWRowChangeEventHandler _ Public Event DOWRowDeleting As DOWRowChangeEventHandler _ Public Event DOWRowDeleted As DOWRowChangeEventHandler _ Public Overloads Sub AddDOWRow(ByVal row As DOWRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddDOWRow(ByVal Start As Date, ByVal _End As Date, ByVal parentGamesRowByGamesDOW As GamesRow) As DOWRow Dim rowDOWRow As DOWRow = CType(Me.NewRow,DOWRow) Dim columnValuesArray() As Object = New Object() {Nothing, Start, _End, Nothing} If (Not (parentGamesRowByGamesDOW) Is Nothing) Then columnValuesArray(3) = parentGamesRowByGamesDOW(0) End If rowDOWRow.ItemArray = columnValuesArray Me.Rows.Add(rowDOWRow) Return rowDOWRow End Function _ Public Function FindByDOWID(ByVal DOWID As Integer) As DOWRow Return CType(Me.Rows.Find(New Object() {DOWID}),DOWRow) End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As DOWDataTable = CType(MyBase.Clone,DOWDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New DOWDataTable() End Function _ Friend Sub InitVars() Me.columnDOWID = MyBase.Columns("DOWID") Me.columnStart = MyBase.Columns("Start") Me.columnEnd = MyBase.Columns("End") Me.columnGameID = MyBase.Columns("GameID") End Sub _ Private Sub InitClass() Me.columnDOWID = New Global.System.Data.DataColumn("DOWID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnDOWID) Me.columnStart = New Global.System.Data.DataColumn("Start", GetType(Date), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnStart) Me.columnEnd = New Global.System.Data.DataColumn("End", GetType(Date), Nothing, Global.System.Data.MappingType.Element) Me.columnEnd.ExtendedProperties.Add("Generator_ColumnPropNameInTable", "EndColumn") Me.columnEnd.ExtendedProperties.Add("Generator_ColumnVarNameInTable", "columnEnd") Me.columnEnd.ExtendedProperties.Add("Generator_UserColumnName", "End") MyBase.Columns.Add(Me.columnEnd) Me.columnGameID = New Global.System.Data.DataColumn("GameID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnGameID) Me.Constraints.Add(New Global.System.Data.UniqueConstraint("Constraint1", New Global.System.Data.DataColumn() {Me.columnDOWID}, true)) Me.columnDOWID.AutoIncrement = true Me.columnDOWID.AutoIncrementSeed = -1 Me.columnDOWID.AutoIncrementStep = -1 Me.columnDOWID.AllowDBNull = false Me.columnDOWID.Unique = true End Sub _ Public Function NewDOWRow() As DOWRow Return CType(Me.NewRow,DOWRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New DOWRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(DOWRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.DOWRowChangedEvent) Is Nothing) Then RaiseEvent DOWRowChanged(Me, New DOWRowChangeEvent(CType(e.Row,DOWRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.DOWRowChangingEvent) Is Nothing) Then RaiseEvent DOWRowChanging(Me, New DOWRowChangeEvent(CType(e.Row,DOWRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.DOWRowDeletedEvent) Is Nothing) Then RaiseEvent DOWRowDeleted(Me, New DOWRowChangeEvent(CType(e.Row,DOWRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.DOWRowDeletingEvent) Is Nothing) Then RaiseEvent DOWRowDeleting(Me, New DOWRowChangeEvent(CType(e.Row,DOWRow), e.Action)) End If End Sub _ Public Sub RemoveDOWRow(ByVal row As DOWRow) Me.Rows.Remove(row) End Sub _ 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 NEADataSet = New NEADataSet() 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 = "DOWDataTable" 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(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 End Class ''' '''Represents the strongly named DataTable class. ''' _ Partial Public Class FriendsDataTable Inherits Global.System.Data.TypedTableBase(Of FriendsRow) Private columnID As Global.System.Data.DataColumn Private columnFriendID As Global.System.Data.DataColumn Private columnUserID As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "Friends" Me.BeginInit Me.InitClass 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 IDColumn() As Global.System.Data.DataColumn Get Return Me.columnID End Get End Property _ Public ReadOnly Property FriendIDColumn() As Global.System.Data.DataColumn Get Return Me.columnFriendID End Get End Property _ Public ReadOnly Property UserIDColumn() As Global.System.Data.DataColumn Get Return Me.columnUserID End Get End Property _ Public ReadOnly Property Count() As Integer Get Return Me.Rows.Count End Get End Property _ Public Default ReadOnly Property Item(ByVal index As Integer) As FriendsRow Get Return CType(Me.Rows(index),FriendsRow) End Get End Property _ Public Event FriendsRowChanging As FriendsRowChangeEventHandler _ Public Event FriendsRowChanged As FriendsRowChangeEventHandler _ Public Event FriendsRowDeleting As FriendsRowChangeEventHandler _ Public Event FriendsRowDeleted As FriendsRowChangeEventHandler _ Public Overloads Sub AddFriendsRow(ByVal row As FriendsRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddFriendsRow(ByVal FriendID As Integer, ByVal UserID As Integer) As FriendsRow Dim rowFriendsRow As FriendsRow = CType(Me.NewRow,FriendsRow) Dim columnValuesArray() As Object = New Object() {Nothing, FriendID, UserID} rowFriendsRow.ItemArray = columnValuesArray Me.Rows.Add(rowFriendsRow) Return rowFriendsRow End Function _ Public Function FindByID(ByVal ID As Integer) As FriendsRow Return CType(Me.Rows.Find(New Object() {ID}),FriendsRow) End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As FriendsDataTable = CType(MyBase.Clone,FriendsDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New FriendsDataTable() End Function _ Friend Sub InitVars() Me.columnID = MyBase.Columns("ID") Me.columnFriendID = MyBase.Columns("FriendID") Me.columnUserID = MyBase.Columns("UserID") End Sub _ Private Sub InitClass() Me.columnID = New Global.System.Data.DataColumn("ID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnID) Me.columnFriendID = New Global.System.Data.DataColumn("FriendID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnFriendID) Me.columnUserID = New Global.System.Data.DataColumn("UserID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnUserID) Me.Constraints.Add(New Global.System.Data.UniqueConstraint("Constraint1", New Global.System.Data.DataColumn() {Me.columnID}, true)) Me.columnID.AutoIncrement = true Me.columnID.AutoIncrementSeed = -1 Me.columnID.AutoIncrementStep = -1 Me.columnID.AllowDBNull = false Me.columnID.Unique = true End Sub _ Public Function NewFriendsRow() As FriendsRow Return CType(Me.NewRow,FriendsRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New FriendsRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(FriendsRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.FriendsRowChangedEvent) Is Nothing) Then RaiseEvent FriendsRowChanged(Me, New FriendsRowChangeEvent(CType(e.Row,FriendsRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.FriendsRowChangingEvent) Is Nothing) Then RaiseEvent FriendsRowChanging(Me, New FriendsRowChangeEvent(CType(e.Row,FriendsRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.FriendsRowDeletedEvent) Is Nothing) Then RaiseEvent FriendsRowDeleted(Me, New FriendsRowChangeEvent(CType(e.Row,FriendsRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.FriendsRowDeletingEvent) Is Nothing) Then RaiseEvent FriendsRowDeleting(Me, New FriendsRowChangeEvent(CType(e.Row,FriendsRow), e.Action)) End If End Sub _ Public Sub RemoveFriendsRow(ByVal row As FriendsRow) Me.Rows.Remove(row) End Sub _ 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 NEADataSet = New NEADataSet() 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 = "FriendsDataTable" 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(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 End Class ''' '''Represents the strongly named DataTable class. ''' _ Partial Public Class GamesDataTable Inherits Global.System.Data.TypedTableBase(Of GamesRow) Private columnGameID As Global.System.Data.DataColumn Private columnName As Global.System.Data.DataColumn Private columnPrice As Global.System.Data.DataColumn Private columnRating As Global.System.Data.DataColumn Private columnCertificate As Global.System.Data.DataColumn Private columnDev As Global.System.Data.DataColumn Private columnPublisher As Global.System.Data.DataColumn Private columnTags As Global.System.Data.DataColumn Private columnTheme_Colour As Global.System.Data.DataColumn Private columnIcon As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "Games" Me.BeginInit Me.InitClass 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 GameIDColumn() As Global.System.Data.DataColumn Get Return Me.columnGameID End Get End Property _ Public ReadOnly Property NameColumn() As Global.System.Data.DataColumn Get Return Me.columnName End Get End Property _ Public ReadOnly Property PriceColumn() As Global.System.Data.DataColumn Get Return Me.columnPrice End Get End Property _ Public ReadOnly Property RatingColumn() As Global.System.Data.DataColumn Get Return Me.columnRating End Get End Property _ Public ReadOnly Property CertificateColumn() As Global.System.Data.DataColumn Get Return Me.columnCertificate End Get End Property _ Public ReadOnly Property DevColumn() As Global.System.Data.DataColumn Get Return Me.columnDev End Get End Property _ Public ReadOnly Property PublisherColumn() As Global.System.Data.DataColumn Get Return Me.columnPublisher End Get End Property _ Public ReadOnly Property TagsColumn() As Global.System.Data.DataColumn Get Return Me.columnTags End Get End Property _ Public ReadOnly Property Theme_ColourColumn() As Global.System.Data.DataColumn Get Return Me.columnTheme_Colour End Get End Property _ Public ReadOnly Property IconColumn() As Global.System.Data.DataColumn Get Return Me.columnIcon End Get End Property _ Public ReadOnly Property Count() As Integer Get Return Me.Rows.Count End Get End Property _ Public Default ReadOnly Property Item(ByVal index As Integer) As GamesRow Get Return CType(Me.Rows(index),GamesRow) End Get End Property _ Public Event GamesRowChanging As GamesRowChangeEventHandler _ Public Event GamesRowChanged As GamesRowChangeEventHandler _ Public Event GamesRowDeleting As GamesRowChangeEventHandler _ Public Event GamesRowDeleted As GamesRowChangeEventHandler _ Public Overloads Sub AddGamesRow(ByVal row As GamesRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddGamesRow(ByVal Name As String, ByVal Price As Decimal, ByVal Rating As Integer, ByVal Certificate As Integer, ByVal Dev As String, ByVal Publisher As String, ByVal Tags As String, ByVal Theme_Colour As Integer, ByVal Icon() As Byte) As GamesRow Dim rowGamesRow As GamesRow = CType(Me.NewRow,GamesRow) Dim columnValuesArray() As Object = New Object() {Nothing, Name, Price, Rating, Certificate, Dev, Publisher, Tags, Theme_Colour, Icon} rowGamesRow.ItemArray = columnValuesArray Me.Rows.Add(rowGamesRow) Return rowGamesRow End Function _ Public Function FindByGameID(ByVal GameID As Integer) As GamesRow Return CType(Me.Rows.Find(New Object() {GameID}),GamesRow) End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As GamesDataTable = CType(MyBase.Clone,GamesDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New GamesDataTable() End Function _ Friend Sub InitVars() Me.columnGameID = MyBase.Columns("GameID") Me.columnName = MyBase.Columns("Name") Me.columnPrice = MyBase.Columns("Price") Me.columnRating = MyBase.Columns("Rating") Me.columnCertificate = MyBase.Columns("Certificate") Me.columnDev = MyBase.Columns("Dev") Me.columnPublisher = MyBase.Columns("Publisher") Me.columnTags = MyBase.Columns("Tags") Me.columnTheme_Colour = MyBase.Columns("Theme Colour") Me.columnIcon = MyBase.Columns("Icon") End Sub _ Private Sub InitClass() Me.columnGameID = New Global.System.Data.DataColumn("GameID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnGameID) Me.columnName = New Global.System.Data.DataColumn("Name", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnName) Me.columnPrice = New Global.System.Data.DataColumn("Price", GetType(Decimal), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnPrice) Me.columnRating = New Global.System.Data.DataColumn("Rating", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnRating) Me.columnCertificate = New Global.System.Data.DataColumn("Certificate", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnCertificate) Me.columnDev = New Global.System.Data.DataColumn("Dev", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnDev) Me.columnPublisher = New Global.System.Data.DataColumn("Publisher", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnPublisher) Me.columnTags = New Global.System.Data.DataColumn("Tags", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnTags) Me.columnTheme_Colour = New Global.System.Data.DataColumn("Theme Colour", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnTheme_Colour) Me.columnIcon = New Global.System.Data.DataColumn("Icon", GetType(Byte()), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnIcon) Me.Constraints.Add(New Global.System.Data.UniqueConstraint("Constraint1", New Global.System.Data.DataColumn() {Me.columnGameID}, true)) Me.columnGameID.AutoIncrement = true Me.columnGameID.AutoIncrementSeed = -1 Me.columnGameID.AutoIncrementStep = -1 Me.columnGameID.AllowDBNull = false Me.columnGameID.Unique = true Me.columnName.MaxLength = 536870910 Me.columnDev.MaxLength = 536870910 Me.columnPublisher.MaxLength = 536870910 Me.columnTags.MaxLength = 536870910 End Sub _ Public Function NewGamesRow() As GamesRow Return CType(Me.NewRow,GamesRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New GamesRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(GamesRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.GamesRowChangedEvent) Is Nothing) Then RaiseEvent GamesRowChanged(Me, New GamesRowChangeEvent(CType(e.Row,GamesRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.GamesRowChangingEvent) Is Nothing) Then RaiseEvent GamesRowChanging(Me, New GamesRowChangeEvent(CType(e.Row,GamesRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.GamesRowDeletedEvent) Is Nothing) Then RaiseEvent GamesRowDeleted(Me, New GamesRowChangeEvent(CType(e.Row,GamesRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.GamesRowDeletingEvent) Is Nothing) Then RaiseEvent GamesRowDeleting(Me, New GamesRowChangeEvent(CType(e.Row,GamesRow), e.Action)) End If End Sub _ Public Sub RemoveGamesRow(ByVal row As GamesRow) Me.Rows.Remove(row) End Sub _ 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 NEADataSet = New NEADataSet() 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 = "GamesDataTable" 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(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 End Class ''' '''Represents the strongly named DataTable class. ''' _ Partial Public Class PurchasedDataTable Inherits Global.System.Data.TypedTableBase(Of PurchasedRow) Private columnPurchaseID As Global.System.Data.DataColumn Private columnUserID As Global.System.Data.DataColumn Private columnGameID As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "Purchased" Me.BeginInit Me.InitClass 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 PurchaseIDColumn() As Global.System.Data.DataColumn Get Return Me.columnPurchaseID End Get End Property _ Public ReadOnly Property UserIDColumn() As Global.System.Data.DataColumn Get Return Me.columnUserID End Get End Property _ Public ReadOnly Property GameIDColumn() As Global.System.Data.DataColumn Get Return Me.columnGameID End Get End Property _ Public ReadOnly Property Count() As Integer Get Return Me.Rows.Count End Get End Property _ Public Default ReadOnly Property Item(ByVal index As Integer) As PurchasedRow Get Return CType(Me.Rows(index),PurchasedRow) End Get End Property _ Public Event PurchasedRowChanging As PurchasedRowChangeEventHandler _ Public Event PurchasedRowChanged As PurchasedRowChangeEventHandler _ Public Event PurchasedRowDeleting As PurchasedRowChangeEventHandler _ Public Event PurchasedRowDeleted As PurchasedRowChangeEventHandler _ Public Overloads Sub AddPurchasedRow(ByVal row As PurchasedRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddPurchasedRow(ByVal UserID As Integer, ByVal parentGamesRowByGamesPurchased As GamesRow) As PurchasedRow Dim rowPurchasedRow As PurchasedRow = CType(Me.NewRow,PurchasedRow) Dim columnValuesArray() As Object = New Object() {Nothing, UserID, Nothing} If (Not (parentGamesRowByGamesPurchased) Is Nothing) Then columnValuesArray(2) = parentGamesRowByGamesPurchased(0) End If rowPurchasedRow.ItemArray = columnValuesArray Me.Rows.Add(rowPurchasedRow) Return rowPurchasedRow End Function _ Public Function FindByPurchaseID(ByVal PurchaseID As Integer) As PurchasedRow Return CType(Me.Rows.Find(New Object() {PurchaseID}),PurchasedRow) End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As PurchasedDataTable = CType(MyBase.Clone,PurchasedDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New PurchasedDataTable() End Function _ Friend Sub InitVars() Me.columnPurchaseID = MyBase.Columns("PurchaseID") Me.columnUserID = MyBase.Columns("UserID") Me.columnGameID = MyBase.Columns("GameID") End Sub _ Private Sub InitClass() Me.columnPurchaseID = New Global.System.Data.DataColumn("PurchaseID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnPurchaseID) Me.columnUserID = New Global.System.Data.DataColumn("UserID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnUserID) Me.columnGameID = New Global.System.Data.DataColumn("GameID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnGameID) Me.Constraints.Add(New Global.System.Data.UniqueConstraint("Constraint1", New Global.System.Data.DataColumn() {Me.columnPurchaseID}, true)) Me.columnPurchaseID.AutoIncrement = true Me.columnPurchaseID.AutoIncrementSeed = -1 Me.columnPurchaseID.AutoIncrementStep = -1 Me.columnPurchaseID.AllowDBNull = false Me.columnPurchaseID.Unique = true End Sub _ Public Function NewPurchasedRow() As PurchasedRow Return CType(Me.NewRow,PurchasedRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New PurchasedRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(PurchasedRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.PurchasedRowChangedEvent) Is Nothing) Then RaiseEvent PurchasedRowChanged(Me, New PurchasedRowChangeEvent(CType(e.Row,PurchasedRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.PurchasedRowChangingEvent) Is Nothing) Then RaiseEvent PurchasedRowChanging(Me, New PurchasedRowChangeEvent(CType(e.Row,PurchasedRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.PurchasedRowDeletedEvent) Is Nothing) Then RaiseEvent PurchasedRowDeleted(Me, New PurchasedRowChangeEvent(CType(e.Row,PurchasedRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.PurchasedRowDeletingEvent) Is Nothing) Then RaiseEvent PurchasedRowDeleting(Me, New PurchasedRowChangeEvent(CType(e.Row,PurchasedRow), e.Action)) End If End Sub _ Public Sub RemovePurchasedRow(ByVal row As PurchasedRow) Me.Rows.Remove(row) End Sub _ 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 NEADataSet = New NEADataSet() 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 = "PurchasedDataTable" 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(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 End Class ''' '''Represents the strongly named DataTable class. ''' _ Partial Public Class ReviewsDataTable Inherits Global.System.Data.TypedTableBase(Of ReviewsRow) Private columnReviewID As Global.System.Data.DataColumn Private columnGameID As Global.System.Data.DataColumn Private columnReview As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "Reviews" Me.BeginInit Me.InitClass 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 ReviewIDColumn() As Global.System.Data.DataColumn Get Return Me.columnReviewID End Get End Property _ Public ReadOnly Property GameIDColumn() As Global.System.Data.DataColumn Get Return Me.columnGameID End Get End Property _ Public ReadOnly Property ReviewColumn() As Global.System.Data.DataColumn Get Return Me.columnReview End Get End Property _ Public ReadOnly Property Count() As Integer Get Return Me.Rows.Count End Get End Property _ Public Default ReadOnly Property Item(ByVal index As Integer) As ReviewsRow Get Return CType(Me.Rows(index),ReviewsRow) End Get End Property _ Public Event ReviewsRowChanging As ReviewsRowChangeEventHandler _ Public Event ReviewsRowChanged As ReviewsRowChangeEventHandler _ Public Event ReviewsRowDeleting As ReviewsRowChangeEventHandler _ Public Event ReviewsRowDeleted As ReviewsRowChangeEventHandler _ Public Overloads Sub AddReviewsRow(ByVal row As ReviewsRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddReviewsRow(ByVal parentGamesRowByGamesReviews As GamesRow, ByVal Review As String) As ReviewsRow Dim rowReviewsRow As ReviewsRow = CType(Me.NewRow,ReviewsRow) Dim columnValuesArray() As Object = New Object() {Nothing, Nothing, Review} If (Not (parentGamesRowByGamesReviews) Is Nothing) Then columnValuesArray(1) = parentGamesRowByGamesReviews(0) End If rowReviewsRow.ItemArray = columnValuesArray Me.Rows.Add(rowReviewsRow) Return rowReviewsRow End Function _ Public Function FindByReviewID(ByVal ReviewID As Integer) As ReviewsRow Return CType(Me.Rows.Find(New Object() {ReviewID}),ReviewsRow) End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As ReviewsDataTable = CType(MyBase.Clone,ReviewsDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New ReviewsDataTable() End Function _ Friend Sub InitVars() Me.columnReviewID = MyBase.Columns("ReviewID") Me.columnGameID = MyBase.Columns("GameID") Me.columnReview = MyBase.Columns("Review") End Sub _ Private Sub InitClass() Me.columnReviewID = New Global.System.Data.DataColumn("ReviewID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnReviewID) Me.columnGameID = New Global.System.Data.DataColumn("GameID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnGameID) Me.columnReview = New Global.System.Data.DataColumn("Review", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnReview) Me.Constraints.Add(New Global.System.Data.UniqueConstraint("Constraint1", New Global.System.Data.DataColumn() {Me.columnReviewID}, true)) Me.columnReviewID.AutoIncrement = true Me.columnReviewID.AutoIncrementSeed = -1 Me.columnReviewID.AutoIncrementStep = -1 Me.columnReviewID.AllowDBNull = false Me.columnReviewID.Unique = true Me.columnReview.MaxLength = 536870910 End Sub _ Public Function NewReviewsRow() As ReviewsRow Return CType(Me.NewRow,ReviewsRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New ReviewsRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(ReviewsRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.ReviewsRowChangedEvent) Is Nothing) Then RaiseEvent ReviewsRowChanged(Me, New ReviewsRowChangeEvent(CType(e.Row,ReviewsRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.ReviewsRowChangingEvent) Is Nothing) Then RaiseEvent ReviewsRowChanging(Me, New ReviewsRowChangeEvent(CType(e.Row,ReviewsRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.ReviewsRowDeletedEvent) Is Nothing) Then RaiseEvent ReviewsRowDeleted(Me, New ReviewsRowChangeEvent(CType(e.Row,ReviewsRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.ReviewsRowDeletingEvent) Is Nothing) Then RaiseEvent ReviewsRowDeleting(Me, New ReviewsRowChangeEvent(CType(e.Row,ReviewsRow), e.Action)) End If End Sub _ Public Sub RemoveReviewsRow(ByVal row As ReviewsRow) Me.Rows.Remove(row) End Sub _ 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 NEADataSet = New NEADataSet() 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 = "ReviewsDataTable" 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(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 End Class ''' '''Represents the strongly named DataTable class. ''' _ Partial Public Class TagsDataTable Inherits Global.System.Data.TypedTableBase(Of TagsRow) Private columnID As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "Tags" Me.BeginInit Me.InitClass 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 IDColumn() As Global.System.Data.DataColumn Get Return Me.columnID End Get End Property _ Public ReadOnly Property Count() As Integer Get Return Me.Rows.Count End Get End Property _ Public Default ReadOnly Property Item(ByVal index As Integer) As TagsRow Get Return CType(Me.Rows(index),TagsRow) End Get End Property _ Public Event TagsRowChanging As TagsRowChangeEventHandler _ Public Event TagsRowChanged As TagsRowChangeEventHandler _ Public Event TagsRowDeleting As TagsRowChangeEventHandler _ Public Event TagsRowDeleted As TagsRowChangeEventHandler _ Public Overloads Sub AddTagsRow(ByVal row As TagsRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddTagsRow() As TagsRow Dim rowTagsRow As TagsRow = CType(Me.NewRow,TagsRow) Dim columnValuesArray() As Object = New Object() {Nothing} rowTagsRow.ItemArray = columnValuesArray Me.Rows.Add(rowTagsRow) Return rowTagsRow End Function _ Public Function FindByID(ByVal ID As Integer) As TagsRow Return CType(Me.Rows.Find(New Object() {ID}),TagsRow) End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As TagsDataTable = CType(MyBase.Clone,TagsDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New TagsDataTable() End Function _ Friend Sub InitVars() Me.columnID = MyBase.Columns("ID") End Sub _ Private Sub InitClass() Me.columnID = New Global.System.Data.DataColumn("ID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnID) Me.Constraints.Add(New Global.System.Data.UniqueConstraint("Constraint1", New Global.System.Data.DataColumn() {Me.columnID}, true)) Me.columnID.AutoIncrement = true Me.columnID.AutoIncrementSeed = -1 Me.columnID.AutoIncrementStep = -1 Me.columnID.AllowDBNull = false Me.columnID.Unique = true End Sub _ Public Function NewTagsRow() As TagsRow Return CType(Me.NewRow,TagsRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New TagsRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(TagsRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.TagsRowChangedEvent) Is Nothing) Then RaiseEvent TagsRowChanged(Me, New TagsRowChangeEvent(CType(e.Row,TagsRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.TagsRowChangingEvent) Is Nothing) Then RaiseEvent TagsRowChanging(Me, New TagsRowChangeEvent(CType(e.Row,TagsRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.TagsRowDeletedEvent) Is Nothing) Then RaiseEvent TagsRowDeleted(Me, New TagsRowChangeEvent(CType(e.Row,TagsRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.TagsRowDeletingEvent) Is Nothing) Then RaiseEvent TagsRowDeleting(Me, New TagsRowChangeEvent(CType(e.Row,TagsRow), e.Action)) End If End Sub _ Public Sub RemoveTagsRow(ByVal row As TagsRow) Me.Rows.Remove(row) End Sub _ 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 NEADataSet = New NEADataSet() 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 = "TagsDataTable" 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(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 End Class ''' '''Represents the strongly named DataTable class. ''' _ Partial Public Class User_DetailsDataTable Inherits Global.System.Data.TypedTableBase(Of User_DetailsRow) Private columnUserDetailsID As Global.System.Data.DataColumn Private columnFirstName As Global.System.Data.DataColumn Private columnLastName As Global.System.Data.DataColumn Private columnAddressLine1 As Global.System.Data.DataColumn Private columnTown As Global.System.Data.DataColumn Private columnPostcode As Global.System.Data.DataColumn Private columnCardNumber As Global.System.Data.DataColumn Private columnCVC As Global.System.Data.DataColumn Private columnIGN As Global.System.Data.DataColumn Private columnEmail As Global.System.Data.DataColumn Private columnProfilePic As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "User_Details" Me.BeginInit Me.InitClass 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 UserDetailsIDColumn() As Global.System.Data.DataColumn Get Return Me.columnUserDetailsID End Get End Property _ Public ReadOnly Property FirstNameColumn() As Global.System.Data.DataColumn Get Return Me.columnFirstName End Get End Property _ Public ReadOnly Property LastNameColumn() As Global.System.Data.DataColumn Get Return Me.columnLastName End Get End Property _ Public ReadOnly Property AddressLine1Column() As Global.System.Data.DataColumn Get Return Me.columnAddressLine1 End Get End Property _ Public ReadOnly Property TownColumn() As Global.System.Data.DataColumn Get Return Me.columnTown End Get End Property _ Public ReadOnly Property PostcodeColumn() As Global.System.Data.DataColumn Get Return Me.columnPostcode End Get End Property _ Public ReadOnly Property CardNumberColumn() As Global.System.Data.DataColumn Get Return Me.columnCardNumber End Get End Property _ Public ReadOnly Property CVCColumn() As Global.System.Data.DataColumn Get Return Me.columnCVC End Get End Property _ Public ReadOnly Property IGNColumn() As Global.System.Data.DataColumn Get Return Me.columnIGN End Get End Property _ Public ReadOnly Property EmailColumn() As Global.System.Data.DataColumn Get Return Me.columnEmail End Get End Property _ Public ReadOnly Property ProfilePicColumn() As Global.System.Data.DataColumn Get Return Me.columnProfilePic End Get End Property _ Public ReadOnly Property Count() As Integer Get Return Me.Rows.Count End Get End Property _ Public Default ReadOnly Property Item(ByVal index As Integer) As User_DetailsRow Get Return CType(Me.Rows(index),User_DetailsRow) End Get End Property _ Public Event User_DetailsRowChanging As User_DetailsRowChangeEventHandler _ Public Event User_DetailsRowChanged As User_DetailsRowChangeEventHandler _ Public Event User_DetailsRowDeleting As User_DetailsRowChangeEventHandler _ Public Event User_DetailsRowDeleted As User_DetailsRowChangeEventHandler _ Public Overloads Sub AddUser_DetailsRow(ByVal row As User_DetailsRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddUser_DetailsRow(ByVal FirstName As String, ByVal LastName As String, ByVal AddressLine1 As String, ByVal Town As String, ByVal Postcode As String, ByVal CardNumber As Integer, ByVal CVC As Integer, ByVal IGN As String, ByVal Email As String, ByVal ProfilePic() As Byte) As User_DetailsRow Dim rowUser_DetailsRow As User_DetailsRow = CType(Me.NewRow,User_DetailsRow) Dim columnValuesArray() As Object = New Object() {Nothing, FirstName, LastName, AddressLine1, Town, Postcode, CardNumber, CVC, IGN, Email, ProfilePic} rowUser_DetailsRow.ItemArray = columnValuesArray Me.Rows.Add(rowUser_DetailsRow) Return rowUser_DetailsRow End Function _ Public Function FindByUserDetailsID(ByVal UserDetailsID As Integer) As User_DetailsRow Return CType(Me.Rows.Find(New Object() {UserDetailsID}),User_DetailsRow) End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As User_DetailsDataTable = CType(MyBase.Clone,User_DetailsDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New User_DetailsDataTable() End Function _ Friend Sub InitVars() Me.columnUserDetailsID = MyBase.Columns("UserDetailsID") Me.columnFirstName = MyBase.Columns("FirstName") Me.columnLastName = MyBase.Columns("LastName") Me.columnAddressLine1 = MyBase.Columns("AddressLine1") Me.columnTown = MyBase.Columns("Town") Me.columnPostcode = MyBase.Columns("Postcode") Me.columnCardNumber = MyBase.Columns("CardNumber") Me.columnCVC = MyBase.Columns("CVC") Me.columnIGN = MyBase.Columns("IGN") Me.columnEmail = MyBase.Columns("Email") Me.columnProfilePic = MyBase.Columns("ProfilePic") End Sub _ Private Sub InitClass() Me.columnUserDetailsID = New Global.System.Data.DataColumn("UserDetailsID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnUserDetailsID) Me.columnFirstName = New Global.System.Data.DataColumn("FirstName", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnFirstName) Me.columnLastName = New Global.System.Data.DataColumn("LastName", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnLastName) Me.columnAddressLine1 = New Global.System.Data.DataColumn("AddressLine1", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnAddressLine1) Me.columnTown = New Global.System.Data.DataColumn("Town", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnTown) Me.columnPostcode = New Global.System.Data.DataColumn("Postcode", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnPostcode) Me.columnCardNumber = New Global.System.Data.DataColumn("CardNumber", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnCardNumber) Me.columnCVC = New Global.System.Data.DataColumn("CVC", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnCVC) Me.columnIGN = New Global.System.Data.DataColumn("IGN", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnIGN) Me.columnEmail = New Global.System.Data.DataColumn("Email", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnEmail) Me.columnProfilePic = New Global.System.Data.DataColumn("ProfilePic", GetType(Byte()), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnProfilePic) Me.Constraints.Add(New Global.System.Data.UniqueConstraint("Constraint1", New Global.System.Data.DataColumn() {Me.columnUserDetailsID}, true)) Me.columnUserDetailsID.AutoIncrement = true Me.columnUserDetailsID.AutoIncrementSeed = -1 Me.columnUserDetailsID.AutoIncrementStep = -1 Me.columnUserDetailsID.AllowDBNull = false Me.columnUserDetailsID.Unique = true Me.columnFirstName.MaxLength = 536870910 Me.columnLastName.MaxLength = 536870910 Me.columnAddressLine1.MaxLength = 536870910 Me.columnTown.MaxLength = 255 Me.columnPostcode.MaxLength = 536870910 Me.columnIGN.MaxLength = 536870910 Me.columnEmail.MaxLength = 536870910 End Sub _ Public Function NewUser_DetailsRow() As User_DetailsRow Return CType(Me.NewRow,User_DetailsRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New User_DetailsRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(User_DetailsRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.User_DetailsRowChangedEvent) Is Nothing) Then RaiseEvent User_DetailsRowChanged(Me, New User_DetailsRowChangeEvent(CType(e.Row,User_DetailsRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.User_DetailsRowChangingEvent) Is Nothing) Then RaiseEvent User_DetailsRowChanging(Me, New User_DetailsRowChangeEvent(CType(e.Row,User_DetailsRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.User_DetailsRowDeletedEvent) Is Nothing) Then RaiseEvent User_DetailsRowDeleted(Me, New User_DetailsRowChangeEvent(CType(e.Row,User_DetailsRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.User_DetailsRowDeletingEvent) Is Nothing) Then RaiseEvent User_DetailsRowDeleting(Me, New User_DetailsRowChangeEvent(CType(e.Row,User_DetailsRow), e.Action)) End If End Sub _ Public Sub RemoveUser_DetailsRow(ByVal row As User_DetailsRow) Me.Rows.Remove(row) End Sub _ 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 NEADataSet = New NEADataSet() 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 = "User_DetailsDataTable" 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(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 End Class ''' '''Represents the strongly named DataTable class. ''' _ Partial Public Class UsersDataTable Inherits Global.System.Data.TypedTableBase(Of UsersRow) Private columnUserID As Global.System.Data.DataColumn Private columnUser_DetailsID As Global.System.Data.DataColumn Private columnUsername As Global.System.Data.DataColumn Private columnPassword As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "Users" Me.BeginInit Me.InitClass 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 UserIDColumn() As Global.System.Data.DataColumn Get Return Me.columnUserID End Get End Property _ Public ReadOnly Property User_DetailsIDColumn() As Global.System.Data.DataColumn Get Return Me.columnUser_DetailsID End Get End Property _ Public ReadOnly Property UsernameColumn() As Global.System.Data.DataColumn Get Return Me.columnUsername End Get End Property _ Public ReadOnly Property PasswordColumn() As Global.System.Data.DataColumn Get Return Me.columnPassword End Get End Property _ Public ReadOnly Property Count() As Integer Get Return Me.Rows.Count End Get End Property _ Public Default ReadOnly Property Item(ByVal index As Integer) As UsersRow Get Return CType(Me.Rows(index),UsersRow) End Get End Property _ Public Event UsersRowChanging As UsersRowChangeEventHandler _ Public Event UsersRowChanged As UsersRowChangeEventHandler _ Public Event UsersRowDeleting As UsersRowChangeEventHandler _ Public Event UsersRowDeleted As UsersRowChangeEventHandler _ Public Overloads Sub AddUsersRow(ByVal row As UsersRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddUsersRow(ByVal parentUser_DetailsRowByUser_DetailsUsers As User_DetailsRow, ByVal Username As String, ByVal Password As String) As UsersRow Dim rowUsersRow As UsersRow = CType(Me.NewRow,UsersRow) Dim columnValuesArray() As Object = New Object() {Nothing, Nothing, Username, Password} If (Not (parentUser_DetailsRowByUser_DetailsUsers) Is Nothing) Then columnValuesArray(1) = parentUser_DetailsRowByUser_DetailsUsers(0) End If rowUsersRow.ItemArray = columnValuesArray Me.Rows.Add(rowUsersRow) Return rowUsersRow End Function _ Public Function FindByUserID(ByVal UserID As Integer) As UsersRow Return CType(Me.Rows.Find(New Object() {UserID}),UsersRow) End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As UsersDataTable = CType(MyBase.Clone,UsersDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New UsersDataTable() End Function _ Friend Sub InitVars() Me.columnUserID = MyBase.Columns("UserID") Me.columnUser_DetailsID = MyBase.Columns("User_DetailsID") Me.columnUsername = MyBase.Columns("Username") Me.columnPassword = MyBase.Columns("Password") End Sub _ Private Sub InitClass() Me.columnUserID = New Global.System.Data.DataColumn("UserID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnUserID) Me.columnUser_DetailsID = New Global.System.Data.DataColumn("User_DetailsID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnUser_DetailsID) Me.columnUsername = New Global.System.Data.DataColumn("Username", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnUsername) Me.columnPassword = New Global.System.Data.DataColumn("Password", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnPassword) Me.Constraints.Add(New Global.System.Data.UniqueConstraint("Constraint1", New Global.System.Data.DataColumn() {Me.columnUserID}, true)) Me.columnUserID.AutoIncrement = true Me.columnUserID.AutoIncrementSeed = -1 Me.columnUserID.AutoIncrementStep = -1 Me.columnUserID.AllowDBNull = false Me.columnUserID.Unique = true Me.columnUsername.MaxLength = 536870910 Me.columnPassword.MaxLength = 536870910 End Sub _ Public Function NewUsersRow() As UsersRow Return CType(Me.NewRow,UsersRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New UsersRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(UsersRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.UsersRowChangedEvent) Is Nothing) Then RaiseEvent UsersRowChanged(Me, New UsersRowChangeEvent(CType(e.Row,UsersRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.UsersRowChangingEvent) Is Nothing) Then RaiseEvent UsersRowChanging(Me, New UsersRowChangeEvent(CType(e.Row,UsersRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.UsersRowDeletedEvent) Is Nothing) Then RaiseEvent UsersRowDeleted(Me, New UsersRowChangeEvent(CType(e.Row,UsersRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.UsersRowDeletingEvent) Is Nothing) Then RaiseEvent UsersRowDeleting(Me, New UsersRowChangeEvent(CType(e.Row,UsersRow), e.Action)) End If End Sub _ Public Sub RemoveUsersRow(ByVal row As UsersRow) Me.Rows.Remove(row) End Sub _ 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 NEADataSet = New NEADataSet() 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 = "UsersDataTable" 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(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 End Class ''' '''Represents the strongly named DataTable class. ''' _ Partial Public Class WishlistDataTable Inherits Global.System.Data.TypedTableBase(Of WishlistRow) Private columnWishlistID As Global.System.Data.DataColumn Private columnUserID As Global.System.Data.DataColumn Private columnGameID As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "Wishlist" Me.BeginInit Me.InitClass 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 WishlistIDColumn() As Global.System.Data.DataColumn Get Return Me.columnWishlistID End Get End Property _ Public ReadOnly Property UserIDColumn() As Global.System.Data.DataColumn Get Return Me.columnUserID End Get End Property _ Public ReadOnly Property GameIDColumn() As Global.System.Data.DataColumn Get Return Me.columnGameID End Get End Property _ Public ReadOnly Property Count() As Integer Get Return Me.Rows.Count End Get End Property _ Public Default ReadOnly Property Item(ByVal index As Integer) As WishlistRow Get Return CType(Me.Rows(index),WishlistRow) End Get End Property _ Public Event WishlistRowChanging As WishlistRowChangeEventHandler _ Public Event WishlistRowChanged As WishlistRowChangeEventHandler _ Public Event WishlistRowDeleting As WishlistRowChangeEventHandler _ Public Event WishlistRowDeleted As WishlistRowChangeEventHandler _ Public Overloads Sub AddWishlistRow(ByVal row As WishlistRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddWishlistRow(ByVal UserID As Integer, ByVal parentGamesRowByGamesWishlist As GamesRow) As WishlistRow Dim rowWishlistRow As WishlistRow = CType(Me.NewRow,WishlistRow) Dim columnValuesArray() As Object = New Object() {Nothing, UserID, Nothing} If (Not (parentGamesRowByGamesWishlist) Is Nothing) Then columnValuesArray(2) = parentGamesRowByGamesWishlist(0) End If rowWishlistRow.ItemArray = columnValuesArray Me.Rows.Add(rowWishlistRow) Return rowWishlistRow End Function _ Public Function FindByWishlistID(ByVal WishlistID As Integer) As WishlistRow Return CType(Me.Rows.Find(New Object() {WishlistID}),WishlistRow) End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As WishlistDataTable = CType(MyBase.Clone,WishlistDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New WishlistDataTable() End Function _ Friend Sub InitVars() Me.columnWishlistID = MyBase.Columns("WishlistID") Me.columnUserID = MyBase.Columns("UserID") Me.columnGameID = MyBase.Columns("GameID") End Sub _ Private Sub InitClass() Me.columnWishlistID = New Global.System.Data.DataColumn("WishlistID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnWishlistID) Me.columnUserID = New Global.System.Data.DataColumn("UserID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnUserID) Me.columnGameID = New Global.System.Data.DataColumn("GameID", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnGameID) Me.Constraints.Add(New Global.System.Data.UniqueConstraint("Constraint1", New Global.System.Data.DataColumn() {Me.columnWishlistID}, true)) Me.columnWishlistID.AutoIncrement = true Me.columnWishlistID.AutoIncrementSeed = -1 Me.columnWishlistID.AutoIncrementStep = -1 Me.columnWishlistID.AllowDBNull = false Me.columnWishlistID.Unique = true End Sub _ Public Function NewWishlistRow() As WishlistRow Return CType(Me.NewRow,WishlistRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New WishlistRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(WishlistRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.WishlistRowChangedEvent) Is Nothing) Then RaiseEvent WishlistRowChanged(Me, New WishlistRowChangeEvent(CType(e.Row,WishlistRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.WishlistRowChangingEvent) Is Nothing) Then RaiseEvent WishlistRowChanging(Me, New WishlistRowChangeEvent(CType(e.Row,WishlistRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.WishlistRowDeletedEvent) Is Nothing) Then RaiseEvent WishlistRowDeleted(Me, New WishlistRowChangeEvent(CType(e.Row,WishlistRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.WishlistRowDeletingEvent) Is Nothing) Then RaiseEvent WishlistRowDeleting(Me, New WishlistRowChangeEvent(CType(e.Row,WishlistRow), e.Action)) End If End Sub _ Public Sub RemoveWishlistRow(ByVal row As WishlistRow) Me.Rows.Remove(row) End Sub _ 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 NEADataSet = New NEADataSet() 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 = "WishlistDataTable" 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(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 End Class ''' '''Represents strongly named DataRow class. ''' Partial Public Class AchievementRow Inherits Global.System.Data.DataRow Private tableAchievement As AchievementDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tableAchievement = CType(Me.Table,AchievementDataTable) End Sub _ Public Property AchievementID() As Integer Get Return CType(Me(Me.tableAchievement.AchievementIDColumn),Integer) End Get Set Me(Me.tableAchievement.AchievementIDColumn) = value End Set End Property _ Public Property GameID() As Integer Get Try Return CType(Me(Me.tableAchievement.GameIDColumn),Integer) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'GameID' in table 'Achievement' is DBNull.", e) End Try End Get Set Me(Me.tableAchievement.GameIDColumn) = value End Set End Property _ Public Property UserID() As Integer Get Try Return CType(Me(Me.tableAchievement.UserIDColumn),Integer) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'UserID' in table 'Achievement' is DBNull.", e) End Try End Get Set Me(Me.tableAchievement.UserIDColumn) = value End Set End Property _ Public Property Achievment_1() As String Get Try Return CType(Me(Me.tableAchievement.Achievment_1Column),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Achievment 1' in table 'Achievement' is DBNull.", e) End Try End Get Set Me(Me.tableAchievement.Achievment_1Column) = value End Set End Property _ Public Property Achievment_2() As String Get Try Return CType(Me(Me.tableAchievement.Achievment_2Column),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Achievment 2' in table 'Achievement' is DBNull.", e) End Try End Get Set Me(Me.tableAchievement.Achievment_2Column) = value End Set End Property _ Public Property Achievment_3() As String Get Try Return CType(Me(Me.tableAchievement.Achievment_3Column),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Achievment 3' in table 'Achievement' is DBNull.", e) End Try End Get Set Me(Me.tableAchievement.Achievment_3Column) = value End Set End Property _ Public Property Achievment_4() As String Get Try Return CType(Me(Me.tableAchievement.Achievment_4Column),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Achievment 4' in table 'Achievement' is DBNull.", e) End Try End Get Set Me(Me.tableAchievement.Achievment_4Column) = value End Set End Property _ Public Property Achievment_5() As String Get Try Return CType(Me(Me.tableAchievement.Achievment_5Column),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Achievment 5' in table 'Achievement' is DBNull.", e) End Try End Get Set Me(Me.tableAchievement.Achievment_5Column) = value End Set End Property _ Public Property GamesRow() As GamesRow Get Return CType(Me.GetParentRow(Me.Table.ParentRelations("GamesAchievement")),GamesRow) End Get Set Me.SetParentRow(value, Me.Table.ParentRelations("GamesAchievement")) End Set End Property _ Public Function IsGameIDNull() As Boolean Return Me.IsNull(Me.tableAchievement.GameIDColumn) End Function _ Public Sub SetGameIDNull() Me(Me.tableAchievement.GameIDColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsUserIDNull() As Boolean Return Me.IsNull(Me.tableAchievement.UserIDColumn) End Function _ Public Sub SetUserIDNull() Me(Me.tableAchievement.UserIDColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsAchievment_1Null() As Boolean Return Me.IsNull(Me.tableAchievement.Achievment_1Column) End Function _ Public Sub SetAchievment_1Null() Me(Me.tableAchievement.Achievment_1Column) = Global.System.Convert.DBNull End Sub _ Public Function IsAchievment_2Null() As Boolean Return Me.IsNull(Me.tableAchievement.Achievment_2Column) End Function _ Public Sub SetAchievment_2Null() Me(Me.tableAchievement.Achievment_2Column) = Global.System.Convert.DBNull End Sub _ Public Function IsAchievment_3Null() As Boolean Return Me.IsNull(Me.tableAchievement.Achievment_3Column) End Function _ Public Sub SetAchievment_3Null() Me(Me.tableAchievement.Achievment_3Column) = Global.System.Convert.DBNull End Sub _ Public Function IsAchievment_4Null() As Boolean Return Me.IsNull(Me.tableAchievement.Achievment_4Column) End Function _ Public Sub SetAchievment_4Null() Me(Me.tableAchievement.Achievment_4Column) = Global.System.Convert.DBNull End Sub _ Public Function IsAchievment_5Null() As Boolean Return Me.IsNull(Me.tableAchievement.Achievment_5Column) End Function _ Public Sub SetAchievment_5Null() Me(Me.tableAchievement.Achievment_5Column) = Global.System.Convert.DBNull End Sub End Class ''' '''Represents strongly named DataRow class. ''' Partial Public Class DOWRow Inherits Global.System.Data.DataRow Private tableDOW As DOWDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tableDOW = CType(Me.Table,DOWDataTable) End Sub _ Public Property DOWID() As Integer Get Return CType(Me(Me.tableDOW.DOWIDColumn),Integer) End Get Set Me(Me.tableDOW.DOWIDColumn) = value End Set End Property _ Public Property Start() As Date Get Try Return CType(Me(Me.tableDOW.StartColumn),Date) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Start' in table 'DOW' is DBNull.", e) End Try End Get Set Me(Me.tableDOW.StartColumn) = value End Set End Property _ Public Property _End() As Date Get Try Return CType(Me(Me.tableDOW.EndColumn),Date) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'End' in table 'DOW' is DBNull.", e) End Try End Get Set Me(Me.tableDOW.EndColumn) = value End Set End Property _ Public Property GameID() As Integer Get Try Return CType(Me(Me.tableDOW.GameIDColumn),Integer) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'GameID' in table 'DOW' is DBNull.", e) End Try End Get Set Me(Me.tableDOW.GameIDColumn) = value End Set End Property _ Public Property GamesRow() As GamesRow Get Return CType(Me.GetParentRow(Me.Table.ParentRelations("GamesDOW")),GamesRow) End Get Set Me.SetParentRow(value, Me.Table.ParentRelations("GamesDOW")) End Set End Property _ Public Function IsStartNull() As Boolean Return Me.IsNull(Me.tableDOW.StartColumn) End Function _ Public Sub SetStartNull() Me(Me.tableDOW.StartColumn) = Global.System.Convert.DBNull End Sub _ Public Function Is_EndNull() As Boolean Return Me.IsNull(Me.tableDOW.EndColumn) End Function _ Public Sub Set_EndNull() Me(Me.tableDOW.EndColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsGameIDNull() As Boolean Return Me.IsNull(Me.tableDOW.GameIDColumn) End Function _ Public Sub SetGameIDNull() Me(Me.tableDOW.GameIDColumn) = Global.System.Convert.DBNull End Sub End Class ''' '''Represents strongly named DataRow class. ''' Partial Public Class FriendsRow Inherits Global.System.Data.DataRow Private tableFriends As FriendsDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tableFriends = CType(Me.Table,FriendsDataTable) End Sub _ Public Property ID() As Integer Get Return CType(Me(Me.tableFriends.IDColumn),Integer) End Get Set Me(Me.tableFriends.IDColumn) = value End Set End Property _ Public Property FriendID() As Integer Get Try Return CType(Me(Me.tableFriends.FriendIDColumn),Integer) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'FriendID' in table 'Friends' is DBNull.", e) End Try End Get Set Me(Me.tableFriends.FriendIDColumn) = value End Set End Property _ Public Property UserID() As Integer Get Try Return CType(Me(Me.tableFriends.UserIDColumn),Integer) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'UserID' in table 'Friends' is DBNull.", e) End Try End Get Set Me(Me.tableFriends.UserIDColumn) = value End Set End Property _ Public Function IsFriendIDNull() As Boolean Return Me.IsNull(Me.tableFriends.FriendIDColumn) End Function _ Public Sub SetFriendIDNull() Me(Me.tableFriends.FriendIDColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsUserIDNull() As Boolean Return Me.IsNull(Me.tableFriends.UserIDColumn) End Function _ Public Sub SetUserIDNull() Me(Me.tableFriends.UserIDColumn) = Global.System.Convert.DBNull End Sub End Class ''' '''Represents strongly named DataRow class. ''' Partial Public Class GamesRow Inherits Global.System.Data.DataRow Private tableGames As GamesDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tableGames = CType(Me.Table,GamesDataTable) End Sub _ Public Property GameID() As Integer Get Return CType(Me(Me.tableGames.GameIDColumn),Integer) End Get Set Me(Me.tableGames.GameIDColumn) = value End Set End Property _ Public Property Name() As String Get Try Return CType(Me(Me.tableGames.NameColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Name' in table 'Games' is DBNull.", e) End Try End Get Set Me(Me.tableGames.NameColumn) = value End Set End Property _ Public Property Price() As Decimal Get Try Return CType(Me(Me.tableGames.PriceColumn),Decimal) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Price' in table 'Games' is DBNull.", e) End Try End Get Set Me(Me.tableGames.PriceColumn) = value End Set End Property _ Public Property Rating() As Integer Get Try Return CType(Me(Me.tableGames.RatingColumn),Integer) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Rating' in table 'Games' is DBNull.", e) End Try End Get Set Me(Me.tableGames.RatingColumn) = value End Set End Property _ Public Property Certificate() As Integer Get Try Return CType(Me(Me.tableGames.CertificateColumn),Integer) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Certificate' in table 'Games' is DBNull.", e) End Try End Get Set Me(Me.tableGames.CertificateColumn) = value End Set End Property _ Public Property Dev() As String Get Try Return CType(Me(Me.tableGames.DevColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Dev' in table 'Games' is DBNull.", e) End Try End Get Set Me(Me.tableGames.DevColumn) = value End Set End Property _ Public Property Publisher() As String Get Try Return CType(Me(Me.tableGames.PublisherColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Publisher' in table 'Games' is DBNull.", e) End Try End Get Set Me(Me.tableGames.PublisherColumn) = value End Set End Property _ Public Property Tags() As String Get Try Return CType(Me(Me.tableGames.TagsColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Tags' in table 'Games' is DBNull.", e) End Try End Get Set Me(Me.tableGames.TagsColumn) = value End Set End Property _ Public Property Theme_Colour() As Integer Get Try Return CType(Me(Me.tableGames.Theme_ColourColumn),Integer) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Theme Colour' in table 'Games' is DBNull.", e) End Try End Get Set Me(Me.tableGames.Theme_ColourColumn) = value End Set End Property _ Public Property Icon() As Byte() Get Try Return CType(Me(Me.tableGames.IconColumn),Byte()) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Icon' in table 'Games' is DBNull.", e) End Try End Get Set Me(Me.tableGames.IconColumn) = value End Set End Property _ Public Function IsNameNull() As Boolean Return Me.IsNull(Me.tableGames.NameColumn) End Function _ Public Sub SetNameNull() Me(Me.tableGames.NameColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsPriceNull() As Boolean Return Me.IsNull(Me.tableGames.PriceColumn) End Function _ Public Sub SetPriceNull() Me(Me.tableGames.PriceColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsRatingNull() As Boolean Return Me.IsNull(Me.tableGames.RatingColumn) End Function _ Public Sub SetRatingNull() Me(Me.tableGames.RatingColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsCertificateNull() As Boolean Return Me.IsNull(Me.tableGames.CertificateColumn) End Function _ Public Sub SetCertificateNull() Me(Me.tableGames.CertificateColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsDevNull() As Boolean Return Me.IsNull(Me.tableGames.DevColumn) End Function _ Public Sub SetDevNull() Me(Me.tableGames.DevColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsPublisherNull() As Boolean Return Me.IsNull(Me.tableGames.PublisherColumn) End Function _ Public Sub SetPublisherNull() Me(Me.tableGames.PublisherColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsTagsNull() As Boolean Return Me.IsNull(Me.tableGames.TagsColumn) End Function _ Public Sub SetTagsNull() Me(Me.tableGames.TagsColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsTheme_ColourNull() As Boolean Return Me.IsNull(Me.tableGames.Theme_ColourColumn) End Function _ Public Sub SetTheme_ColourNull() Me(Me.tableGames.Theme_ColourColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsIconNull() As Boolean Return Me.IsNull(Me.tableGames.IconColumn) End Function _ Public Sub SetIconNull() Me(Me.tableGames.IconColumn) = Global.System.Convert.DBNull End Sub _ Public Function GetAchievementRows() As AchievementRow() If (Me.Table.ChildRelations("GamesAchievement") Is Nothing) Then Return New AchievementRow(-1) {} Else Return CType(MyBase.GetChildRows(Me.Table.ChildRelations("GamesAchievement")),AchievementRow()) End If End Function _ Public Function GetDOWRows() As DOWRow() If (Me.Table.ChildRelations("GamesDOW") Is Nothing) Then Return New DOWRow(-1) {} Else Return CType(MyBase.GetChildRows(Me.Table.ChildRelations("GamesDOW")),DOWRow()) End If End Function _ Public Function GetPurchasedRows() As PurchasedRow() If (Me.Table.ChildRelations("GamesPurchased") Is Nothing) Then Return New PurchasedRow(-1) {} Else Return CType(MyBase.GetChildRows(Me.Table.ChildRelations("GamesPurchased")),PurchasedRow()) End If End Function _ Public Function GetReviewsRows() As ReviewsRow() If (Me.Table.ChildRelations("GamesReviews") Is Nothing) Then Return New ReviewsRow(-1) {} Else Return CType(MyBase.GetChildRows(Me.Table.ChildRelations("GamesReviews")),ReviewsRow()) End If End Function _ Public Function GetWishlistRows() As WishlistRow() If (Me.Table.ChildRelations("GamesWishlist") Is Nothing) Then Return New WishlistRow(-1) {} Else Return CType(MyBase.GetChildRows(Me.Table.ChildRelations("GamesWishlist")),WishlistRow()) End If End Function End Class ''' '''Represents strongly named DataRow class. ''' Partial Public Class PurchasedRow Inherits Global.System.Data.DataRow Private tablePurchased As PurchasedDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tablePurchased = CType(Me.Table,PurchasedDataTable) End Sub _ Public Property PurchaseID() As Integer Get Return CType(Me(Me.tablePurchased.PurchaseIDColumn),Integer) End Get Set Me(Me.tablePurchased.PurchaseIDColumn) = value End Set End Property _ Public Property UserID() As Integer Get Try Return CType(Me(Me.tablePurchased.UserIDColumn),Integer) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'UserID' in table 'Purchased' is DBNull.", e) End Try End Get Set Me(Me.tablePurchased.UserIDColumn) = value End Set End Property _ Public Property GameID() As Integer Get Try Return CType(Me(Me.tablePurchased.GameIDColumn),Integer) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'GameID' in table 'Purchased' is DBNull.", e) End Try End Get Set Me(Me.tablePurchased.GameIDColumn) = value End Set End Property _ Public Property GamesRow() As GamesRow Get Return CType(Me.GetParentRow(Me.Table.ParentRelations("GamesPurchased")),GamesRow) End Get Set Me.SetParentRow(value, Me.Table.ParentRelations("GamesPurchased")) End Set End Property _ Public Function IsUserIDNull() As Boolean Return Me.IsNull(Me.tablePurchased.UserIDColumn) End Function _ Public Sub SetUserIDNull() Me(Me.tablePurchased.UserIDColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsGameIDNull() As Boolean Return Me.IsNull(Me.tablePurchased.GameIDColumn) End Function _ Public Sub SetGameIDNull() Me(Me.tablePurchased.GameIDColumn) = Global.System.Convert.DBNull End Sub End Class ''' '''Represents strongly named DataRow class. ''' Partial Public Class ReviewsRow Inherits Global.System.Data.DataRow Private tableReviews As ReviewsDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tableReviews = CType(Me.Table,ReviewsDataTable) End Sub _ Public Property ReviewID() As Integer Get Return CType(Me(Me.tableReviews.ReviewIDColumn),Integer) End Get Set Me(Me.tableReviews.ReviewIDColumn) = value End Set End Property _ Public Property GameID() As Integer Get Try Return CType(Me(Me.tableReviews.GameIDColumn),Integer) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'GameID' in table 'Reviews' is DBNull.", e) End Try End Get Set Me(Me.tableReviews.GameIDColumn) = value End Set End Property _ Public Property Review() As String Get Try Return CType(Me(Me.tableReviews.ReviewColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Review' in table 'Reviews' is DBNull.", e) End Try End Get Set Me(Me.tableReviews.ReviewColumn) = value End Set End Property _ Public Property GamesRow() As GamesRow Get Return CType(Me.GetParentRow(Me.Table.ParentRelations("GamesReviews")),GamesRow) End Get Set Me.SetParentRow(value, Me.Table.ParentRelations("GamesReviews")) End Set End Property _ Public Function IsGameIDNull() As Boolean Return Me.IsNull(Me.tableReviews.GameIDColumn) End Function _ Public Sub SetGameIDNull() Me(Me.tableReviews.GameIDColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsReviewNull() As Boolean Return Me.IsNull(Me.tableReviews.ReviewColumn) End Function _ Public Sub SetReviewNull() Me(Me.tableReviews.ReviewColumn) = Global.System.Convert.DBNull End Sub End Class ''' '''Represents strongly named DataRow class. ''' Partial Public Class TagsRow Inherits Global.System.Data.DataRow Private tableTags As TagsDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tableTags = CType(Me.Table,TagsDataTable) End Sub _ Public Property ID() As Integer Get Return CType(Me(Me.tableTags.IDColumn),Integer) End Get Set Me(Me.tableTags.IDColumn) = value End Set End Property End Class ''' '''Represents strongly named DataRow class. ''' Partial Public Class User_DetailsRow Inherits Global.System.Data.DataRow Private tableUser_Details As User_DetailsDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tableUser_Details = CType(Me.Table,User_DetailsDataTable) End Sub _ Public Property UserDetailsID() As Integer Get Return CType(Me(Me.tableUser_Details.UserDetailsIDColumn),Integer) End Get Set Me(Me.tableUser_Details.UserDetailsIDColumn) = value End Set End Property _ Public Property FirstName() As String Get Try Return CType(Me(Me.tableUser_Details.FirstNameColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'FirstName' in table 'User_Details' is DBNull.", e) End Try End Get Set Me(Me.tableUser_Details.FirstNameColumn) = value End Set End Property _ Public Property LastName() As String Get Try Return CType(Me(Me.tableUser_Details.LastNameColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'LastName' in table 'User_Details' is DBNull.", e) End Try End Get Set Me(Me.tableUser_Details.LastNameColumn) = value End Set End Property _ Public Property AddressLine1() As String Get Try Return CType(Me(Me.tableUser_Details.AddressLine1Column),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'AddressLine1' in table 'User_Details' is DBNull.", e) End Try End Get Set Me(Me.tableUser_Details.AddressLine1Column) = value End Set End Property _ Public Property Town() As String Get Try Return CType(Me(Me.tableUser_Details.TownColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Town' in table 'User_Details' is DBNull.", e) End Try End Get Set Me(Me.tableUser_Details.TownColumn) = value End Set End Property _ Public Property Postcode() As String Get Try Return CType(Me(Me.tableUser_Details.PostcodeColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Postcode' in table 'User_Details' is DBNull.", e) End Try End Get Set Me(Me.tableUser_Details.PostcodeColumn) = value End Set End Property _ Public Property CardNumber() As Integer Get Try Return CType(Me(Me.tableUser_Details.CardNumberColumn),Integer) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'CardNumber' in table 'User_Details' is DBNull.", e) End Try End Get Set Me(Me.tableUser_Details.CardNumberColumn) = value End Set End Property _ Public Property CVC() As Integer Get Try Return CType(Me(Me.tableUser_Details.CVCColumn),Integer) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'CVC' in table 'User_Details' is DBNull.", e) End Try End Get Set Me(Me.tableUser_Details.CVCColumn) = value End Set End Property _ Public Property IGN() As String Get Try Return CType(Me(Me.tableUser_Details.IGNColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'IGN' in table 'User_Details' is DBNull.", e) End Try End Get Set Me(Me.tableUser_Details.IGNColumn) = value End Set End Property _ Public Property Email() As String Get Try Return CType(Me(Me.tableUser_Details.EmailColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Email' in table 'User_Details' is DBNull.", e) End Try End Get Set Me(Me.tableUser_Details.EmailColumn) = value End Set End Property _ Public Property ProfilePic() As Byte() Get Try Return CType(Me(Me.tableUser_Details.ProfilePicColumn),Byte()) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'ProfilePic' in table 'User_Details' is DBNull.", e) End Try End Get Set Me(Me.tableUser_Details.ProfilePicColumn) = value End Set End Property _ Public Function IsFirstNameNull() As Boolean Return Me.IsNull(Me.tableUser_Details.FirstNameColumn) End Function _ Public Sub SetFirstNameNull() Me(Me.tableUser_Details.FirstNameColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsLastNameNull() As Boolean Return Me.IsNull(Me.tableUser_Details.LastNameColumn) End Function _ Public Sub SetLastNameNull() Me(Me.tableUser_Details.LastNameColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsAddressLine1Null() As Boolean Return Me.IsNull(Me.tableUser_Details.AddressLine1Column) End Function _ Public Sub SetAddressLine1Null() Me(Me.tableUser_Details.AddressLine1Column) = Global.System.Convert.DBNull End Sub _ Public Function IsTownNull() As Boolean Return Me.IsNull(Me.tableUser_Details.TownColumn) End Function _ Public Sub SetTownNull() Me(Me.tableUser_Details.TownColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsPostcodeNull() As Boolean Return Me.IsNull(Me.tableUser_Details.PostcodeColumn) End Function _ Public Sub SetPostcodeNull() Me(Me.tableUser_Details.PostcodeColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsCardNumberNull() As Boolean Return Me.IsNull(Me.tableUser_Details.CardNumberColumn) End Function _ Public Sub SetCardNumberNull() Me(Me.tableUser_Details.CardNumberColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsCVCNull() As Boolean Return Me.IsNull(Me.tableUser_Details.CVCColumn) End Function _ Public Sub SetCVCNull() Me(Me.tableUser_Details.CVCColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsIGNNull() As Boolean Return Me.IsNull(Me.tableUser_Details.IGNColumn) End Function _ Public Sub SetIGNNull() Me(Me.tableUser_Details.IGNColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsEmailNull() As Boolean Return Me.IsNull(Me.tableUser_Details.EmailColumn) End Function _ Public Sub SetEmailNull() Me(Me.tableUser_Details.EmailColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsProfilePicNull() As Boolean Return Me.IsNull(Me.tableUser_Details.ProfilePicColumn) End Function _ Public Sub SetProfilePicNull() Me(Me.tableUser_Details.ProfilePicColumn) = Global.System.Convert.DBNull End Sub _ Public Function GetUsersRows() As UsersRow() If (Me.Table.ChildRelations("User_DetailsUsers") Is Nothing) Then Return New UsersRow(-1) {} Else Return CType(MyBase.GetChildRows(Me.Table.ChildRelations("User_DetailsUsers")),UsersRow()) End If End Function End Class ''' '''Represents strongly named DataRow class. ''' Partial Public Class UsersRow Inherits Global.System.Data.DataRow Private tableUsers As UsersDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tableUsers = CType(Me.Table,UsersDataTable) End Sub _ Public Property UserID() As Integer Get Return CType(Me(Me.tableUsers.UserIDColumn),Integer) End Get Set Me(Me.tableUsers.UserIDColumn) = value End Set End Property _ Public Property User_DetailsID() As Integer Get Try Return CType(Me(Me.tableUsers.User_DetailsIDColumn),Integer) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'User_DetailsID' in table 'Users' is DBNull.", e) End Try End Get Set Me(Me.tableUsers.User_DetailsIDColumn) = value End Set End Property _ Public Property Username() As String Get Try Return CType(Me(Me.tableUsers.UsernameColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Username' in table 'Users' is DBNull.", e) End Try End Get Set Me(Me.tableUsers.UsernameColumn) = value End Set End Property _ Public Property Password() As String Get Try Return CType(Me(Me.tableUsers.PasswordColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'Password' in table 'Users' is DBNull.", e) End Try End Get Set Me(Me.tableUsers.PasswordColumn) = value End Set End Property _ Public Property User_DetailsRow() As User_DetailsRow Get Return CType(Me.GetParentRow(Me.Table.ParentRelations("User_DetailsUsers")),User_DetailsRow) End Get Set Me.SetParentRow(value, Me.Table.ParentRelations("User_DetailsUsers")) End Set End Property _ Public Function IsUser_DetailsIDNull() As Boolean Return Me.IsNull(Me.tableUsers.User_DetailsIDColumn) End Function _ Public Sub SetUser_DetailsIDNull() Me(Me.tableUsers.User_DetailsIDColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsUsernameNull() As Boolean Return Me.IsNull(Me.tableUsers.UsernameColumn) End Function _ Public Sub SetUsernameNull() Me(Me.tableUsers.UsernameColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsPasswordNull() As Boolean Return Me.IsNull(Me.tableUsers.PasswordColumn) End Function _ Public Sub SetPasswordNull() Me(Me.tableUsers.PasswordColumn) = Global.System.Convert.DBNull End Sub End Class ''' '''Represents strongly named DataRow class. ''' Partial Public Class WishlistRow Inherits Global.System.Data.DataRow Private tableWishlist As WishlistDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tableWishlist = CType(Me.Table,WishlistDataTable) End Sub _ Public Property WishlistID() As Integer Get Return CType(Me(Me.tableWishlist.WishlistIDColumn),Integer) End Get Set Me(Me.tableWishlist.WishlistIDColumn) = value End Set End Property _ Public Property UserID() As Integer Get Try Return CType(Me(Me.tableWishlist.UserIDColumn),Integer) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'UserID' in table 'Wishlist' is DBNull.", e) End Try End Get Set Me(Me.tableWishlist.UserIDColumn) = value End Set End Property _ Public Property GameID() As Integer Get Try Return CType(Me(Me.tableWishlist.GameIDColumn),Integer) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("The value for column 'GameID' in table 'Wishlist' is DBNull.", e) End Try End Get Set Me(Me.tableWishlist.GameIDColumn) = value End Set End Property _ Public Property GamesRow() As GamesRow Get Return CType(Me.GetParentRow(Me.Table.ParentRelations("GamesWishlist")),GamesRow) End Get Set Me.SetParentRow(value, Me.Table.ParentRelations("GamesWishlist")) End Set End Property _ Public Function IsUserIDNull() As Boolean Return Me.IsNull(Me.tableWishlist.UserIDColumn) End Function _ Public Sub SetUserIDNull() Me(Me.tableWishlist.UserIDColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsGameIDNull() As Boolean Return Me.IsNull(Me.tableWishlist.GameIDColumn) End Function _ Public Sub SetGameIDNull() Me(Me.tableWishlist.GameIDColumn) = Global.System.Convert.DBNull End Sub End Class ''' '''Row event argument class ''' _ Public Class AchievementRowChangeEvent Inherits Global.System.EventArgs Private eventRow As AchievementRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As AchievementRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As AchievementRow 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 ''' '''Row event argument class ''' _ Public Class DOWRowChangeEvent Inherits Global.System.EventArgs Private eventRow As DOWRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As DOWRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As DOWRow 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 ''' '''Row event argument class ''' _ Public Class FriendsRowChangeEvent Inherits Global.System.EventArgs Private eventRow As FriendsRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As FriendsRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As FriendsRow 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 ''' '''Row event argument class ''' _ Public Class GamesRowChangeEvent Inherits Global.System.EventArgs Private eventRow As GamesRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As GamesRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As GamesRow 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 ''' '''Row event argument class ''' _ Public Class PurchasedRowChangeEvent Inherits Global.System.EventArgs Private eventRow As PurchasedRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As PurchasedRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As PurchasedRow 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 ''' '''Row event argument class ''' _ Public Class ReviewsRowChangeEvent Inherits Global.System.EventArgs Private eventRow As ReviewsRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As ReviewsRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As ReviewsRow 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 ''' '''Row event argument class ''' _ Public Class TagsRowChangeEvent Inherits Global.System.EventArgs Private eventRow As TagsRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As TagsRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As TagsRow 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 ''' '''Row event argument class ''' _ Public Class User_DetailsRowChangeEvent Inherits Global.System.EventArgs Private eventRow As User_DetailsRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As User_DetailsRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As User_DetailsRow 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 ''' '''Row event argument class ''' _ Public Class UsersRowChangeEvent Inherits Global.System.EventArgs Private eventRow As UsersRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As UsersRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As UsersRow 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 ''' '''Row event argument class ''' _ Public Class WishlistRowChangeEvent Inherits Global.System.EventArgs Private eventRow As WishlistRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As WishlistRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As WishlistRow 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 Namespace NEADataSetTableAdapters ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class AchievementTableAdapter Inherits Global.System.ComponentModel.Component Private WithEvents _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 _clearBeforeFill As Boolean _ Public Sub New() MyBase.New Me.ClearBeforeFill = true End Sub _ Protected Friend ReadOnly Property Adapter() As Global.System.Data.OleDb.OleDbDataAdapter Get 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 Get If (Me._connection Is Nothing) Then Me.InitConnection End If Return Me._connection End Get Set Me._connection = value If (Not (Me.Adapter.InsertCommand) Is Nothing) Then Me.Adapter.InsertCommand.Connection = value End If If (Not (Me.Adapter.DeleteCommand) Is Nothing) Then Me.Adapter.DeleteCommand.Connection = value End If If (Not (Me.Adapter.UpdateCommand) Is 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 End If i = (i + 1) Loop End Set End Property _ Friend Property Transaction() As Global.System.Data.OleDb.OleDbTransaction Get Return Me._transaction End Get Set 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 Me.Adapter.DeleteCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.InsertCommand) Is Nothing)) Then Me.Adapter.InsertCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.UpdateCommand) Is Nothing)) Then Me.Adapter.UpdateCommand.Transaction = Me._transaction End If End Set End Property _ Protected ReadOnly Property CommandCollection() As Global.System.Data.OleDb.OleDbCommand() Get If (Me._commandCollection Is Nothing) Then Me.InitCommandCollection End If Return Me._commandCollection End Get End Property _ Public Property ClearBeforeFill() As Boolean Get Return Me._clearBeforeFill End Get Set 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() tableMapping.SourceTable = "Table" tableMapping.DataSetTable = "Achievement" tableMapping.ColumnMappings.Add("AchievementID", "AchievementID") tableMapping.ColumnMappings.Add("GameID", "GameID") tableMapping.ColumnMappings.Add("UserID", "UserID") tableMapping.ColumnMappings.Add("Achievment 1", "Achievment 1") tableMapping.ColumnMappings.Add("Achievment 2", "Achievment 2") tableMapping.ColumnMappings.Add("Achievment 3", "Achievment 3") tableMapping.ColumnMappings.Add("Achievment 4", "Achievment 4") tableMapping.ColumnMappings.Add("Achievment 5", "Achievment 5") 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 `Achievement` WHERE ((`AchievementID` = ?) AND ((? = 1 AND `GameID` I"& _ "S NULL) OR (`GameID` = ?)) AND ((? = 1 AND `UserID` IS NULL) OR (`UserID` = ?)))"& _ "" Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_AchievementID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "AchievementID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", 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 `Achievement` (`GameID`, `UserID`, `Achievment 1`, `Achievment 2`, `A"& _ "chievment 3`, `Achievment 4`, `Achievment 5`) VALUES (?, ?, ?, ?, ?, ?, ?)" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Achievment_1", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Achievment 1", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Achievment_2", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Achievment 2", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Achievment_3", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Achievment 3", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Achievment_4", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Achievment 4", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Achievment_5", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Achievment 5", 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 `Achievement` SET `GameID` = ?, `UserID` = ?, `Achievment 1` = ?, `Achievm"& _ "ent 2` = ?, `Achievment 3` = ?, `Achievment 4` = ?, `Achievment 5` = ? WHERE ((`"& _ "AchievementID` = ?) AND ((? = 1 AND `GameID` IS NULL) OR (`GameID` = ?)) AND ((?"& _ " = 1 AND `UserID` IS NULL) OR (`UserID` = ?)))" Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Achievment_1", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Achievment 1", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Achievment_2", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Achievment 2", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Achievment_3", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Achievment 3", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Achievment_4", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Achievment 4", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Achievment_5", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Achievment 5", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_AchievementID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "AchievementID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Original, false, Nothing)) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.OleDb.OleDbConnection() Me._connection.ConnectionString = Global.NEA.MySettings.Default.NEAConnectionString2 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 AchievementID, GameID, UserID, [Achievment 1], [Achievment 2], [Achievment"& _ " 3], [Achievment 4], [Achievment 5] FROM Achievement" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text End Sub _ Public Overloads Overridable Function Fill(ByVal dataTable As NEADataSet.AchievementDataTable) As Integer Me.Adapter.SelectCommand = Me.CommandCollection(0) If (Me.ClearBeforeFill = true) Then dataTable.Clear End If Dim returnValue As Integer = Me.Adapter.Fill(dataTable) Return returnValue End Function _ Public Overloads Overridable Function GetData() As NEADataSet.AchievementDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As NEADataSet.AchievementDataTable = New NEADataSet.AchievementDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overloads Overridable Function Update(ByVal dataTable As NEADataSet.AchievementDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function _ Public Overloads Overridable Function Update(ByVal dataSet As NEADataSet) As Integer Return Me.Adapter.Update(dataSet, "Achievement") End Function _ Public Overloads 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 Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer Return Me.Adapter.Update(dataRows) End Function _ Public Overloads Overridable Function Delete(ByVal Original_AchievementID As Integer, ByVal Original_GameID As Global.System.Nullable(Of Integer), ByVal Original_UserID As Global.System.Nullable(Of Integer)) As Integer Me.Adapter.DeleteCommand.Parameters(0).Value = CType(Original_AchievementID,Integer) If (Original_GameID.HasValue = true) Then Me.Adapter.DeleteCommand.Parameters(1).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(2).Value = CType(Original_GameID.Value,Integer) Else Me.Adapter.DeleteCommand.Parameters(1).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(2).Value = Global.System.DBNull.Value End If If (Original_UserID.HasValue = true) Then Me.Adapter.DeleteCommand.Parameters(3).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = CType(Original_UserID.Value,Integer) Else Me.Adapter.DeleteCommand.Parameters(3).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = Global.System.DBNull.Value 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 Me.Adapter.DeleteCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.DeleteCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Insert(ByVal GameID As Global.System.Nullable(Of Integer), ByVal UserID As Global.System.Nullable(Of Integer), ByVal Achievment_1 As String, ByVal Achievment_2 As String, ByVal Achievment_3 As String, ByVal Achievment_4 As String, ByVal Achievment_5 As String) As Integer If (GameID.HasValue = true) Then Me.Adapter.InsertCommand.Parameters(0).Value = CType(GameID.Value,Integer) Else Me.Adapter.InsertCommand.Parameters(0).Value = Global.System.DBNull.Value End If If (UserID.HasValue = true) Then Me.Adapter.InsertCommand.Parameters(1).Value = CType(UserID.Value,Integer) Else Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value End If If (Achievment_1 Is Nothing) Then Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(2).Value = CType(Achievment_1,String) End If If (Achievment_2 Is Nothing) Then Me.Adapter.InsertCommand.Parameters(3).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(3).Value = CType(Achievment_2,String) End If If (Achievment_3 Is Nothing) Then Me.Adapter.InsertCommand.Parameters(4).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(4).Value = CType(Achievment_3,String) End If If (Achievment_4 Is Nothing) Then Me.Adapter.InsertCommand.Parameters(5).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(5).Value = CType(Achievment_4,String) End If If (Achievment_5 Is Nothing) Then Me.Adapter.InsertCommand.Parameters(6).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(6).Value = CType(Achievment_5,String) 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 Me.Adapter.InsertCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.InsertCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Update(ByVal GameID As Global.System.Nullable(Of Integer), ByVal UserID As Global.System.Nullable(Of Integer), ByVal Achievment_1 As String, ByVal Achievment_2 As String, ByVal Achievment_3 As String, ByVal Achievment_4 As String, ByVal Achievment_5 As String, ByVal Original_AchievementID As Integer, ByVal Original_GameID As Global.System.Nullable(Of Integer), ByVal Original_UserID As Global.System.Nullable(Of Integer)) As Integer If (GameID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(0).Value = CType(GameID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(0).Value = Global.System.DBNull.Value End If If (UserID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(1).Value = CType(UserID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value End If If (Achievment_1 Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(2).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(2).Value = CType(Achievment_1,String) End If If (Achievment_2 Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(3).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(3).Value = CType(Achievment_2,String) End If If (Achievment_3 Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(4).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(4).Value = CType(Achievment_3,String) End If If (Achievment_4 Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(5).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(5).Value = CType(Achievment_4,String) End If If (Achievment_5 Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(6).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(6).Value = CType(Achievment_5,String) End If Me.Adapter.UpdateCommand.Parameters(7).Value = CType(Original_AchievementID,Integer) If (Original_GameID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(8).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(9).Value = CType(Original_GameID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(8).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(9).Value = Global.System.DBNull.Value End If If (Original_UserID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(10).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(11).Value = CType(Original_UserID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(10).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(11).Value = Global.System.DBNull.Value 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 Me.Adapter.UpdateCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.UpdateCommand.Connection.Close End If End Try End Function End Class ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class DOWTableAdapter Inherits Global.System.ComponentModel.Component Private WithEvents _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 _clearBeforeFill As Boolean _ Public Sub New() MyBase.New Me.ClearBeforeFill = true End Sub _ Protected Friend ReadOnly Property Adapter() As Global.System.Data.OleDb.OleDbDataAdapter Get 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 Get If (Me._connection Is Nothing) Then Me.InitConnection End If Return Me._connection End Get Set Me._connection = value If (Not (Me.Adapter.InsertCommand) Is Nothing) Then Me.Adapter.InsertCommand.Connection = value End If If (Not (Me.Adapter.DeleteCommand) Is Nothing) Then Me.Adapter.DeleteCommand.Connection = value End If If (Not (Me.Adapter.UpdateCommand) Is 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 End If i = (i + 1) Loop End Set End Property _ Friend Property Transaction() As Global.System.Data.OleDb.OleDbTransaction Get Return Me._transaction End Get Set 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 Me.Adapter.DeleteCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.InsertCommand) Is Nothing)) Then Me.Adapter.InsertCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.UpdateCommand) Is Nothing)) Then Me.Adapter.UpdateCommand.Transaction = Me._transaction End If End Set End Property _ Protected ReadOnly Property CommandCollection() As Global.System.Data.OleDb.OleDbCommand() Get If (Me._commandCollection Is Nothing) Then Me.InitCommandCollection End If Return Me._commandCollection End Get End Property _ Public Property ClearBeforeFill() As Boolean Get Return Me._clearBeforeFill End Get Set 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() tableMapping.SourceTable = "Table" tableMapping.DataSetTable = "DOW" tableMapping.ColumnMappings.Add("DOWID", "DOWID") tableMapping.ColumnMappings.Add("Start", "Start") tableMapping.ColumnMappings.Add("End", "End") tableMapping.ColumnMappings.Add("GameID", "GameID") 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 `DOW` WHERE ((`DOWID` = ?) AND ((? = 1 AND `Start` IS NULL) OR (`Star"& _ "t` = ?)) AND ((? = 1 AND `End` IS NULL) OR (`End` = ?)) AND ((? = 1 AND `GameID`"& _ " IS NULL) OR (`GameID` = ?)))" Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_DOWID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "DOWID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_Start", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Start", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_Start", Global.System.Data.OleDb.OleDbType.[Date], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Start", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_End", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "End", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_End", Global.System.Data.OleDb.OleDbType.[Date], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "End", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", 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 `DOW` (`Start`, `End`, `GameID`) VALUES (?, ?, ?)" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Start", Global.System.Data.OleDb.OleDbType.[Date], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Start", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("End", Global.System.Data.OleDb.OleDbType.[Date], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "End", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", 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 `DOW` SET `Start` = ?, `End` = ?, `GameID` = ? WHERE ((`DOWID` = ?) AND (("& _ "? = 1 AND `Start` IS NULL) OR (`Start` = ?)) AND ((? = 1 AND `End` IS NULL) OR ("& _ "`End` = ?)) AND ((? = 1 AND `GameID` IS NULL) OR (`GameID` = ?)))" Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Start", Global.System.Data.OleDb.OleDbType.[Date], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Start", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("End", Global.System.Data.OleDb.OleDbType.[Date], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "End", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_DOWID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "DOWID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_Start", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Start", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_Start", Global.System.Data.OleDb.OleDbType.[Date], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Start", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_End", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "End", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_End", Global.System.Data.OleDb.OleDbType.[Date], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "End", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Original, false, Nothing)) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.OleDb.OleDbConnection() Me._connection.ConnectionString = Global.NEA.MySettings.Default.NEAConnectionString2 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 DOWID, Start, [End], GameID FROM DOW" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text End Sub _ Public Overloads Overridable Function Fill(ByVal dataTable As NEADataSet.DOWDataTable) As Integer Me.Adapter.SelectCommand = Me.CommandCollection(0) If (Me.ClearBeforeFill = true) Then dataTable.Clear End If Dim returnValue As Integer = Me.Adapter.Fill(dataTable) Return returnValue End Function _ Public Overloads Overridable Function GetData() As NEADataSet.DOWDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As NEADataSet.DOWDataTable = New NEADataSet.DOWDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overloads Overridable Function Update(ByVal dataTable As NEADataSet.DOWDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function _ Public Overloads Overridable Function Update(ByVal dataSet As NEADataSet) As Integer Return Me.Adapter.Update(dataSet, "DOW") End Function _ Public Overloads 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 Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer Return Me.Adapter.Update(dataRows) End Function _ Public Overloads Overridable Function Delete(ByVal Original_DOWID As Integer, ByVal Original_Start As Global.System.Nullable(Of Date), ByVal Original_End As Global.System.Nullable(Of Date), ByVal Original_GameID As Global.System.Nullable(Of Integer)) As Integer Me.Adapter.DeleteCommand.Parameters(0).Value = CType(Original_DOWID,Integer) If (Original_Start.HasValue = true) Then Me.Adapter.DeleteCommand.Parameters(1).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(2).Value = CType(Original_Start.Value,Date) Else Me.Adapter.DeleteCommand.Parameters(1).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(2).Value = Global.System.DBNull.Value End If If (Original_End.HasValue = true) Then Me.Adapter.DeleteCommand.Parameters(3).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = CType(Original_End.Value,Date) Else Me.Adapter.DeleteCommand.Parameters(3).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = Global.System.DBNull.Value End If If (Original_GameID.HasValue = true) Then Me.Adapter.DeleteCommand.Parameters(5).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(6).Value = CType(Original_GameID.Value,Integer) Else Me.Adapter.DeleteCommand.Parameters(5).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(6).Value = Global.System.DBNull.Value 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 Me.Adapter.DeleteCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.DeleteCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Insert(ByVal Start As Global.System.Nullable(Of Date), ByVal _End As Global.System.Nullable(Of Date), ByVal GameID As Global.System.Nullable(Of Integer)) As Integer If (Start.HasValue = true) Then Me.Adapter.InsertCommand.Parameters(0).Value = CType(Start.Value,Date) Else Me.Adapter.InsertCommand.Parameters(0).Value = Global.System.DBNull.Value End If If (_End.HasValue = true) Then Me.Adapter.InsertCommand.Parameters(1).Value = CType(_End.Value,Date) Else Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value End If If (GameID.HasValue = true) Then Me.Adapter.InsertCommand.Parameters(2).Value = CType(GameID.Value,Integer) Else Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value 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 Me.Adapter.InsertCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.InsertCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Update(ByVal Start As Global.System.Nullable(Of Date), ByVal _End As Global.System.Nullable(Of Date), ByVal GameID As Global.System.Nullable(Of Integer), ByVal Original_DOWID As Integer, ByVal Original_Start As Global.System.Nullable(Of Date), ByVal Original_End As Global.System.Nullable(Of Date), ByVal Original_GameID As Global.System.Nullable(Of Integer)) As Integer If (Start.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(0).Value = CType(Start.Value,Date) Else Me.Adapter.UpdateCommand.Parameters(0).Value = Global.System.DBNull.Value End If If (_End.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(1).Value = CType(_End.Value,Date) Else Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value End If If (GameID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(2).Value = CType(GameID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(2).Value = Global.System.DBNull.Value End If Me.Adapter.UpdateCommand.Parameters(3).Value = CType(Original_DOWID,Integer) If (Original_Start.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(4).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(5).Value = CType(Original_Start.Value,Date) Else Me.Adapter.UpdateCommand.Parameters(4).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(5).Value = Global.System.DBNull.Value End If If (Original_End.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(6).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(7).Value = CType(Original_End.Value,Date) Else Me.Adapter.UpdateCommand.Parameters(6).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(7).Value = Global.System.DBNull.Value End If If (Original_GameID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(8).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(9).Value = CType(Original_GameID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(8).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(9).Value = Global.System.DBNull.Value 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 Me.Adapter.UpdateCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.UpdateCommand.Connection.Close End If End Try End Function End Class ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class FriendsTableAdapter Inherits Global.System.ComponentModel.Component Private WithEvents _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 _clearBeforeFill As Boolean _ Public Sub New() MyBase.New Me.ClearBeforeFill = true End Sub _ Protected Friend ReadOnly Property Adapter() As Global.System.Data.OleDb.OleDbDataAdapter Get 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 Get If (Me._connection Is Nothing) Then Me.InitConnection End If Return Me._connection End Get Set Me._connection = value If (Not (Me.Adapter.InsertCommand) Is Nothing) Then Me.Adapter.InsertCommand.Connection = value End If If (Not (Me.Adapter.DeleteCommand) Is Nothing) Then Me.Adapter.DeleteCommand.Connection = value End If If (Not (Me.Adapter.UpdateCommand) Is 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 End If i = (i + 1) Loop End Set End Property _ Friend Property Transaction() As Global.System.Data.OleDb.OleDbTransaction Get Return Me._transaction End Get Set 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 Me.Adapter.DeleteCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.InsertCommand) Is Nothing)) Then Me.Adapter.InsertCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.UpdateCommand) Is Nothing)) Then Me.Adapter.UpdateCommand.Transaction = Me._transaction End If End Set End Property _ Protected ReadOnly Property CommandCollection() As Global.System.Data.OleDb.OleDbCommand() Get If (Me._commandCollection Is Nothing) Then Me.InitCommandCollection End If Return Me._commandCollection End Get End Property _ Public Property ClearBeforeFill() As Boolean Get Return Me._clearBeforeFill End Get Set 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() tableMapping.SourceTable = "Table" tableMapping.DataSetTable = "Friends" tableMapping.ColumnMappings.Add("ID", "ID") tableMapping.ColumnMappings.Add("FriendID", "FriendID") tableMapping.ColumnMappings.Add("UserID", "UserID") 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 `Friends` WHERE ((`ID` = ?) AND ((? = 1 AND `FriendID` IS NULL) OR (`"& _ "FriendID` = ?)) AND ((? = 1 AND `UserID` IS NULL) OR (`UserID` = ?)))" Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_ID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "ID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_FriendID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "FriendID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_FriendID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "FriendID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", 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 `Friends` (`FriendID`, `UserID`) VALUES (?, ?)" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("FriendID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "FriendID", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", 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 `Friends` SET `FriendID` = ?, `UserID` = ? WHERE ((`ID` = ?) AND ((? = 1 A"& _ "ND `FriendID` IS NULL) OR (`FriendID` = ?)) AND ((? = 1 AND `UserID` IS NULL) OR"& _ " (`UserID` = ?)))" Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("FriendID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "FriendID", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_ID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "ID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_FriendID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "FriendID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_FriendID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "FriendID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Original, false, Nothing)) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.OleDb.OleDbConnection() Me._connection.ConnectionString = Global.NEA.MySettings.Default.NEAConnectionString2 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 ID, FriendID, UserID FROM Friends" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text End Sub _ Public Overloads Overridable Function Fill(ByVal dataTable As NEADataSet.FriendsDataTable) As Integer Me.Adapter.SelectCommand = Me.CommandCollection(0) If (Me.ClearBeforeFill = true) Then dataTable.Clear End If Dim returnValue As Integer = Me.Adapter.Fill(dataTable) Return returnValue End Function _ Public Overloads Overridable Function GetData() As NEADataSet.FriendsDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As NEADataSet.FriendsDataTable = New NEADataSet.FriendsDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overloads Overridable Function Update(ByVal dataTable As NEADataSet.FriendsDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function _ Public Overloads Overridable Function Update(ByVal dataSet As NEADataSet) As Integer Return Me.Adapter.Update(dataSet, "Friends") End Function _ Public Overloads 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 Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer Return Me.Adapter.Update(dataRows) End Function _ Public Overloads Overridable Function Delete(ByVal Original_ID As Integer, ByVal Original_FriendID As Integer, ByVal Original_UserID As Global.System.Nullable(Of Integer)) As Integer Me.Adapter.DeleteCommand.Parameters(0).Value = CType(Original_ID,Integer) Me.Adapter.DeleteCommand.Parameters(1).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(2).Value = CType(Original_FriendID,Integer) If (Original_UserID.HasValue = true) Then Me.Adapter.DeleteCommand.Parameters(3).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = CType(Original_UserID.Value,Integer) Else Me.Adapter.DeleteCommand.Parameters(3).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = Global.System.DBNull.Value 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 Me.Adapter.DeleteCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.DeleteCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Insert(ByVal FriendID As Integer, ByVal UserID As Global.System.Nullable(Of Integer)) As Integer Me.Adapter.InsertCommand.Parameters(0).Value = CType(FriendID,Integer) If (UserID.HasValue = true) Then Me.Adapter.InsertCommand.Parameters(1).Value = CType(UserID.Value,Integer) Else Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value 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 Me.Adapter.InsertCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.InsertCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Update(ByVal FriendID As Integer, ByVal UserID As Global.System.Nullable(Of Integer), ByVal Original_ID As Integer, ByVal Original_FriendID As Integer, ByVal Original_UserID As Global.System.Nullable(Of Integer)) As Integer Me.Adapter.UpdateCommand.Parameters(0).Value = CType(FriendID,Integer) If (UserID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(1).Value = CType(UserID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value End If Me.Adapter.UpdateCommand.Parameters(2).Value = CType(Original_ID,Integer) Me.Adapter.UpdateCommand.Parameters(3).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(4).Value = CType(Original_FriendID,Integer) If (Original_UserID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(5).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(6).Value = CType(Original_UserID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(5).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(6).Value = Global.System.DBNull.Value 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 Me.Adapter.UpdateCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.UpdateCommand.Connection.Close End If End Try End Function End Class ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class GamesTableAdapter Inherits Global.System.ComponentModel.Component Private WithEvents _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 _clearBeforeFill As Boolean _ Public Sub New() MyBase.New Me.ClearBeforeFill = true End Sub _ Protected Friend ReadOnly Property Adapter() As Global.System.Data.OleDb.OleDbDataAdapter Get 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 Get If (Me._connection Is Nothing) Then Me.InitConnection End If Return Me._connection End Get Set Me._connection = value If (Not (Me.Adapter.InsertCommand) Is Nothing) Then Me.Adapter.InsertCommand.Connection = value End If If (Not (Me.Adapter.DeleteCommand) Is Nothing) Then Me.Adapter.DeleteCommand.Connection = value End If If (Not (Me.Adapter.UpdateCommand) Is 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 End If i = (i + 1) Loop End Set End Property _ Friend Property Transaction() As Global.System.Data.OleDb.OleDbTransaction Get Return Me._transaction End Get Set 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 Me.Adapter.DeleteCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.InsertCommand) Is Nothing)) Then Me.Adapter.InsertCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.UpdateCommand) Is Nothing)) Then Me.Adapter.UpdateCommand.Transaction = Me._transaction End If End Set End Property _ Protected ReadOnly Property CommandCollection() As Global.System.Data.OleDb.OleDbCommand() Get If (Me._commandCollection Is Nothing) Then Me.InitCommandCollection End If Return Me._commandCollection End Get End Property _ Public Property ClearBeforeFill() As Boolean Get Return Me._clearBeforeFill End Get Set 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() tableMapping.SourceTable = "Table" tableMapping.DataSetTable = "Games" tableMapping.ColumnMappings.Add("GameID", "GameID") tableMapping.ColumnMappings.Add("Name", "Name") tableMapping.ColumnMappings.Add("Price", "Price") tableMapping.ColumnMappings.Add("Rating", "Rating") tableMapping.ColumnMappings.Add("Certificate", "Certificate") tableMapping.ColumnMappings.Add("Dev", "Dev") tableMapping.ColumnMappings.Add("Publisher", "Publisher") tableMapping.ColumnMappings.Add("Tags", "Tags") tableMapping.ColumnMappings.Add("Theme Colour", "Theme Colour") tableMapping.ColumnMappings.Add("Icon", "Icon") 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 `Games` WHERE ((`GameID` = ?) AND ((? = 1 AND `Price` IS NULL) OR (`P"& _ "rice` = ?)) AND ((? = 1 AND `Rating` IS NULL) OR (`Rating` = ?)) AND ((? = 1 AND"& _ " `Certificate` IS NULL) OR (`Certificate` = ?)) AND ((? = 1 AND `Theme Colour` I"& _ "S NULL) OR (`Theme Colour` = ?)))" Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_Price", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Price", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_Price", Global.System.Data.OleDb.OleDbType.Currency, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Price", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_Rating", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Rating", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_Rating", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Rating", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_Certificate", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Certificate", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_Certificate", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Certificate", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_Theme_Colour", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Theme Colour", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_Theme_Colour", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Theme Colour", 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 `Games` (`Name`, `Price`, `Rating`, `Certificate`, `Dev`, `Publisher`"& _ ", `Tags`, `Theme Colour`, `Icon`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Name", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Name", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Price", Global.System.Data.OleDb.OleDbType.Currency, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Price", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Rating", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Rating", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Certificate", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Certificate", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Dev", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Dev", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Publisher", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Publisher", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Tags", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Tags", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Theme_Colour", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Theme Colour", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Icon", Global.System.Data.OleDb.OleDbType.LongVarBinary, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Icon", 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 `Games` SET `Name` = ?, `Price` = ?, `Rating` = ?, `Certificate` = ?, `Dev"& _ "` = ?, `Publisher` = ?, `Tags` = ?, `Theme Colour` = ?, `Icon` = ? WHERE ((`Game"& _ "ID` = ?) AND ((? = 1 AND `Price` IS NULL) OR (`Price` = ?)) AND ((? = 1 AND `Rat"& _ "ing` IS NULL) OR (`Rating` = ?)) AND ((? = 1 AND `Certificate` IS NULL) OR (`Cer"& _ "tificate` = ?)) AND ((? = 1 AND `Theme Colour` IS NULL) OR (`Theme Colour` = ?))"& _ ")" Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Name", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Name", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Price", Global.System.Data.OleDb.OleDbType.Currency, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Price", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Rating", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Rating", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Certificate", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Certificate", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Dev", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Dev", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Publisher", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Publisher", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Tags", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Tags", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Theme_Colour", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Theme Colour", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Icon", Global.System.Data.OleDb.OleDbType.LongVarBinary, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Icon", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_Price", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Price", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_Price", Global.System.Data.OleDb.OleDbType.Currency, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Price", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_Rating", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Rating", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_Rating", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Rating", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_Certificate", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Certificate", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_Certificate", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Certificate", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_Theme_Colour", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Theme Colour", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_Theme_Colour", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Theme Colour", Global.System.Data.DataRowVersion.Original, false, Nothing)) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.OleDb.OleDbConnection() Me._connection.ConnectionString = Global.NEA.MySettings.Default.NEAConnectionString2 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 GameID, Name, Price, Rating, Certificate, Dev, Publisher, Tags, [Theme Col"& _ "our], Icon FROM Games" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text End Sub _ Public Overloads Overridable Function Fill(ByVal dataTable As NEADataSet.GamesDataTable) As Integer Me.Adapter.SelectCommand = Me.CommandCollection(0) If (Me.ClearBeforeFill = true) Then dataTable.Clear End If Dim returnValue As Integer = Me.Adapter.Fill(dataTable) Return returnValue End Function _ Public Overloads Overridable Function GetData() As NEADataSet.GamesDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As NEADataSet.GamesDataTable = New NEADataSet.GamesDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overloads Overridable Function Update(ByVal dataTable As NEADataSet.GamesDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function _ Public Overloads Overridable Function Update(ByVal dataSet As NEADataSet) As Integer Return Me.Adapter.Update(dataSet, "Games") End Function _ Public Overloads 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 Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer Return Me.Adapter.Update(dataRows) End Function _ Public Overloads Overridable Function Delete(ByVal Original_GameID As Integer, ByVal Original_Price As Global.System.Nullable(Of Decimal), ByVal Original_Rating As Global.System.Nullable(Of Integer), ByVal Original_Certificate As Global.System.Nullable(Of Integer), ByVal Original_Theme_Colour As Global.System.Nullable(Of Integer)) As Integer Me.Adapter.DeleteCommand.Parameters(0).Value = CType(Original_GameID,Integer) If (Original_Price.HasValue = true) Then Me.Adapter.DeleteCommand.Parameters(1).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(2).Value = CType(Original_Price.Value,Decimal) Else Me.Adapter.DeleteCommand.Parameters(1).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(2).Value = Global.System.DBNull.Value End If If (Original_Rating.HasValue = true) Then Me.Adapter.DeleteCommand.Parameters(3).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = CType(Original_Rating.Value,Integer) Else Me.Adapter.DeleteCommand.Parameters(3).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = Global.System.DBNull.Value End If If (Original_Certificate.HasValue = true) Then Me.Adapter.DeleteCommand.Parameters(5).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(6).Value = CType(Original_Certificate.Value,Integer) Else Me.Adapter.DeleteCommand.Parameters(5).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(6).Value = Global.System.DBNull.Value End If If (Original_Theme_Colour.HasValue = true) Then Me.Adapter.DeleteCommand.Parameters(7).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(8).Value = CType(Original_Theme_Colour.Value,Integer) Else Me.Adapter.DeleteCommand.Parameters(7).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(8).Value = Global.System.DBNull.Value 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 Me.Adapter.DeleteCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.DeleteCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Insert(ByVal Name As String, ByVal Price As Global.System.Nullable(Of Decimal), ByVal Rating As Global.System.Nullable(Of Integer), ByVal Certificate As Global.System.Nullable(Of Integer), ByVal Dev As String, ByVal Publisher As String, ByVal Tags As String, ByVal Theme_Colour As Global.System.Nullable(Of Integer), ByVal Icon() As Byte) As Integer If (Name Is Nothing) Then Me.Adapter.InsertCommand.Parameters(0).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(0).Value = CType(Name,String) End If If (Price.HasValue = true) Then Me.Adapter.InsertCommand.Parameters(1).Value = CType(Price.Value,Decimal) Else Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value End If If (Rating.HasValue = true) Then Me.Adapter.InsertCommand.Parameters(2).Value = CType(Rating.Value,Integer) Else Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value End If If (Certificate.HasValue = true) Then Me.Adapter.InsertCommand.Parameters(3).Value = CType(Certificate.Value,Integer) Else Me.Adapter.InsertCommand.Parameters(3).Value = Global.System.DBNull.Value End If If (Dev Is Nothing) Then Me.Adapter.InsertCommand.Parameters(4).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(4).Value = CType(Dev,String) End If If (Publisher Is Nothing) Then Me.Adapter.InsertCommand.Parameters(5).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(5).Value = CType(Publisher,String) End If If (Tags Is Nothing) Then Me.Adapter.InsertCommand.Parameters(6).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(6).Value = CType(Tags,String) End If If (Theme_Colour.HasValue = true) Then Me.Adapter.InsertCommand.Parameters(7).Value = CType(Theme_Colour.Value,Integer) Else Me.Adapter.InsertCommand.Parameters(7).Value = Global.System.DBNull.Value End If If (Icon Is Nothing) Then Me.Adapter.InsertCommand.Parameters(8).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(8).Value = CType(Icon,Byte()) 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 Me.Adapter.InsertCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.InsertCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Update(ByVal Name As String, ByVal Price As Global.System.Nullable(Of Decimal), ByVal Rating As Global.System.Nullable(Of Integer), ByVal Certificate As Global.System.Nullable(Of Integer), ByVal Dev As String, ByVal Publisher As String, ByVal Tags As String, ByVal Theme_Colour As Global.System.Nullable(Of Integer), ByVal Icon() As Byte, ByVal Original_GameID As Integer, ByVal Original_Price As Global.System.Nullable(Of Decimal), ByVal Original_Rating As Global.System.Nullable(Of Integer), ByVal Original_Certificate As Global.System.Nullable(Of Integer), ByVal Original_Theme_Colour As Global.System.Nullable(Of Integer)) As Integer If (Name Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(0).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(0).Value = CType(Name,String) End If If (Price.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(1).Value = CType(Price.Value,Decimal) Else Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value End If If (Rating.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(2).Value = CType(Rating.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(2).Value = Global.System.DBNull.Value End If If (Certificate.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(3).Value = CType(Certificate.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(3).Value = Global.System.DBNull.Value End If If (Dev Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(4).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(4).Value = CType(Dev,String) End If If (Publisher Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(5).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(5).Value = CType(Publisher,String) End If If (Tags Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(6).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(6).Value = CType(Tags,String) End If If (Theme_Colour.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(7).Value = CType(Theme_Colour.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(7).Value = Global.System.DBNull.Value End If If (Icon Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(8).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(8).Value = CType(Icon,Byte()) End If Me.Adapter.UpdateCommand.Parameters(9).Value = CType(Original_GameID,Integer) If (Original_Price.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(10).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(11).Value = CType(Original_Price.Value,Decimal) Else Me.Adapter.UpdateCommand.Parameters(10).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(11).Value = Global.System.DBNull.Value End If If (Original_Rating.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(12).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(13).Value = CType(Original_Rating.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(12).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(13).Value = Global.System.DBNull.Value End If If (Original_Certificate.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(14).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(15).Value = CType(Original_Certificate.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(14).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(15).Value = Global.System.DBNull.Value End If If (Original_Theme_Colour.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(16).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(17).Value = CType(Original_Theme_Colour.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(16).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(17).Value = Global.System.DBNull.Value 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 Me.Adapter.UpdateCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.UpdateCommand.Connection.Close End If End Try End Function End Class ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class PurchasedTableAdapter Inherits Global.System.ComponentModel.Component Private WithEvents _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 _clearBeforeFill As Boolean _ Public Sub New() MyBase.New Me.ClearBeforeFill = true End Sub _ Protected Friend ReadOnly Property Adapter() As Global.System.Data.OleDb.OleDbDataAdapter Get 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 Get If (Me._connection Is Nothing) Then Me.InitConnection End If Return Me._connection End Get Set Me._connection = value If (Not (Me.Adapter.InsertCommand) Is Nothing) Then Me.Adapter.InsertCommand.Connection = value End If If (Not (Me.Adapter.DeleteCommand) Is Nothing) Then Me.Adapter.DeleteCommand.Connection = value End If If (Not (Me.Adapter.UpdateCommand) Is 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 End If i = (i + 1) Loop End Set End Property _ Friend Property Transaction() As Global.System.Data.OleDb.OleDbTransaction Get Return Me._transaction End Get Set 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 Me.Adapter.DeleteCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.InsertCommand) Is Nothing)) Then Me.Adapter.InsertCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.UpdateCommand) Is Nothing)) Then Me.Adapter.UpdateCommand.Transaction = Me._transaction End If End Set End Property _ Protected ReadOnly Property CommandCollection() As Global.System.Data.OleDb.OleDbCommand() Get If (Me._commandCollection Is Nothing) Then Me.InitCommandCollection End If Return Me._commandCollection End Get End Property _ Public Property ClearBeforeFill() As Boolean Get Return Me._clearBeforeFill End Get Set 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() tableMapping.SourceTable = "Table" tableMapping.DataSetTable = "Purchased" tableMapping.ColumnMappings.Add("PurchaseID", "PurchaseID") tableMapping.ColumnMappings.Add("UserID", "UserID") tableMapping.ColumnMappings.Add("GameID", "GameID") 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 `Purchased` WHERE ((`PurchaseID` = ?) AND ((? = 1 AND `UserID` IS NUL"& _ "L) OR (`UserID` = ?)) AND ((? = 1 AND `GameID` IS NULL) OR (`GameID` = ?)))" Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_PurchaseID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "PurchaseID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", 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 `Purchased` (`UserID`, `GameID`) VALUES (?, ?)" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", 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 `Purchased` SET `UserID` = ?, `GameID` = ? WHERE ((`PurchaseID` = ?) AND ("& _ "(? = 1 AND `UserID` IS NULL) OR (`UserID` = ?)) AND ((? = 1 AND `GameID` IS NULL"& _ ") OR (`GameID` = ?)))" Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_PurchaseID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "PurchaseID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Original, false, Nothing)) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.OleDb.OleDbConnection() Me._connection.ConnectionString = Global.NEA.MySettings.Default.NEAConnectionString2 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 PurchaseID, UserID, GameID FROM Purchased" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text End Sub _ Public Overloads Overridable Function Fill(ByVal dataTable As NEADataSet.PurchasedDataTable) As Integer Me.Adapter.SelectCommand = Me.CommandCollection(0) If (Me.ClearBeforeFill = true) Then dataTable.Clear End If Dim returnValue As Integer = Me.Adapter.Fill(dataTable) Return returnValue End Function _ Public Overloads Overridable Function GetData() As NEADataSet.PurchasedDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As NEADataSet.PurchasedDataTable = New NEADataSet.PurchasedDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overloads Overridable Function Update(ByVal dataTable As NEADataSet.PurchasedDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function _ Public Overloads Overridable Function Update(ByVal dataSet As NEADataSet) As Integer Return Me.Adapter.Update(dataSet, "Purchased") End Function _ Public Overloads 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 Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer Return Me.Adapter.Update(dataRows) End Function _ Public Overloads Overridable Function Delete(ByVal Original_PurchaseID As Integer, ByVal Original_UserID As Global.System.Nullable(Of Integer), ByVal Original_GameID As Global.System.Nullable(Of Integer)) As Integer Me.Adapter.DeleteCommand.Parameters(0).Value = CType(Original_PurchaseID,Integer) If (Original_UserID.HasValue = true) Then Me.Adapter.DeleteCommand.Parameters(1).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(2).Value = CType(Original_UserID.Value,Integer) Else Me.Adapter.DeleteCommand.Parameters(1).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(2).Value = Global.System.DBNull.Value End If If (Original_GameID.HasValue = true) Then Me.Adapter.DeleteCommand.Parameters(3).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = CType(Original_GameID.Value,Integer) Else Me.Adapter.DeleteCommand.Parameters(3).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = Global.System.DBNull.Value 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 Me.Adapter.DeleteCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.DeleteCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Insert(ByVal UserID As Global.System.Nullable(Of Integer), ByVal GameID As Global.System.Nullable(Of Integer)) As Integer If (UserID.HasValue = true) Then Me.Adapter.InsertCommand.Parameters(0).Value = CType(UserID.Value,Integer) Else Me.Adapter.InsertCommand.Parameters(0).Value = Global.System.DBNull.Value End If If (GameID.HasValue = true) Then Me.Adapter.InsertCommand.Parameters(1).Value = CType(GameID.Value,Integer) Else Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value 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 Me.Adapter.InsertCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.InsertCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Update(ByVal UserID As Global.System.Nullable(Of Integer), ByVal GameID As Global.System.Nullable(Of Integer), ByVal Original_PurchaseID As Integer, ByVal Original_UserID As Global.System.Nullable(Of Integer), ByVal Original_GameID As Global.System.Nullable(Of Integer)) As Integer If (UserID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(0).Value = CType(UserID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(0).Value = Global.System.DBNull.Value End If If (GameID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(1).Value = CType(GameID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value End If Me.Adapter.UpdateCommand.Parameters(2).Value = CType(Original_PurchaseID,Integer) If (Original_UserID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(3).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(4).Value = CType(Original_UserID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(3).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(4).Value = Global.System.DBNull.Value End If If (Original_GameID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(5).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(6).Value = CType(Original_GameID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(5).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(6).Value = Global.System.DBNull.Value 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 Me.Adapter.UpdateCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.UpdateCommand.Connection.Close End If End Try End Function End Class ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class ReviewsTableAdapter Inherits Global.System.ComponentModel.Component Private WithEvents _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 _clearBeforeFill As Boolean _ Public Sub New() MyBase.New Me.ClearBeforeFill = true End Sub _ Protected Friend ReadOnly Property Adapter() As Global.System.Data.OleDb.OleDbDataAdapter Get 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 Get If (Me._connection Is Nothing) Then Me.InitConnection End If Return Me._connection End Get Set Me._connection = value If (Not (Me.Adapter.InsertCommand) Is Nothing) Then Me.Adapter.InsertCommand.Connection = value End If If (Not (Me.Adapter.DeleteCommand) Is Nothing) Then Me.Adapter.DeleteCommand.Connection = value End If If (Not (Me.Adapter.UpdateCommand) Is 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 End If i = (i + 1) Loop End Set End Property _ Friend Property Transaction() As Global.System.Data.OleDb.OleDbTransaction Get Return Me._transaction End Get Set 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 Me.Adapter.DeleteCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.InsertCommand) Is Nothing)) Then Me.Adapter.InsertCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.UpdateCommand) Is Nothing)) Then Me.Adapter.UpdateCommand.Transaction = Me._transaction End If End Set End Property _ Protected ReadOnly Property CommandCollection() As Global.System.Data.OleDb.OleDbCommand() Get If (Me._commandCollection Is Nothing) Then Me.InitCommandCollection End If Return Me._commandCollection End Get End Property _ Public Property ClearBeforeFill() As Boolean Get Return Me._clearBeforeFill End Get Set 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() tableMapping.SourceTable = "Table" tableMapping.DataSetTable = "Reviews" tableMapping.ColumnMappings.Add("ReviewID", "ReviewID") tableMapping.ColumnMappings.Add("GameID", "GameID") tableMapping.ColumnMappings.Add("Review", "Review") 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 `Reviews` WHERE ((`ReviewID` = ?) AND ((? = 1 AND `GameID` IS NULL) O"& _ "R (`GameID` = ?)))" Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_ReviewID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "ReviewID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", 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 `Reviews` (`GameID`, `Review`) VALUES (?, ?)" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Review", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Review", 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 `Reviews` SET `GameID` = ?, `Review` = ? WHERE ((`ReviewID` = ?) AND ((? ="& _ " 1 AND `GameID` IS NULL) OR (`GameID` = ?)))" Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Review", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Review", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_ReviewID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "ReviewID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Original, false, Nothing)) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.OleDb.OleDbConnection() Me._connection.ConnectionString = Global.NEA.MySettings.Default.NEAConnectionString2 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 ReviewID, GameID, Review FROM Reviews" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text End Sub _ Public Overloads Overridable Function Fill(ByVal dataTable As NEADataSet.ReviewsDataTable) As Integer Me.Adapter.SelectCommand = Me.CommandCollection(0) If (Me.ClearBeforeFill = true) Then dataTable.Clear End If Dim returnValue As Integer = Me.Adapter.Fill(dataTable) Return returnValue End Function _ Public Overloads Overridable Function GetData() As NEADataSet.ReviewsDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As NEADataSet.ReviewsDataTable = New NEADataSet.ReviewsDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overloads Overridable Function Update(ByVal dataTable As NEADataSet.ReviewsDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function _ Public Overloads Overridable Function Update(ByVal dataSet As NEADataSet) As Integer Return Me.Adapter.Update(dataSet, "Reviews") End Function _ Public Overloads 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 Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer Return Me.Adapter.Update(dataRows) End Function _ Public Overloads Overridable Function Delete(ByVal Original_ReviewID As Integer, ByVal Original_GameID As Global.System.Nullable(Of Integer)) As Integer Me.Adapter.DeleteCommand.Parameters(0).Value = CType(Original_ReviewID,Integer) If (Original_GameID.HasValue = true) Then Me.Adapter.DeleteCommand.Parameters(1).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(2).Value = CType(Original_GameID.Value,Integer) Else Me.Adapter.DeleteCommand.Parameters(1).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(2).Value = Global.System.DBNull.Value 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 Me.Adapter.DeleteCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.DeleteCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Insert(ByVal GameID As Global.System.Nullable(Of Integer), ByVal Review As String) As Integer If (GameID.HasValue = true) Then Me.Adapter.InsertCommand.Parameters(0).Value = CType(GameID.Value,Integer) Else Me.Adapter.InsertCommand.Parameters(0).Value = Global.System.DBNull.Value End If If (Review Is Nothing) Then Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(1).Value = CType(Review,String) 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 Me.Adapter.InsertCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.InsertCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Update(ByVal GameID As Global.System.Nullable(Of Integer), ByVal Review As String, ByVal Original_ReviewID As Integer, ByVal Original_GameID As Global.System.Nullable(Of Integer)) As Integer If (GameID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(0).Value = CType(GameID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(0).Value = Global.System.DBNull.Value End If If (Review Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(1).Value = CType(Review,String) End If Me.Adapter.UpdateCommand.Parameters(2).Value = CType(Original_ReviewID,Integer) If (Original_GameID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(3).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(4).Value = CType(Original_GameID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(3).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(4).Value = Global.System.DBNull.Value 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 Me.Adapter.UpdateCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.UpdateCommand.Connection.Close End If End Try End Function End Class ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class TagsTableAdapter Inherits Global.System.ComponentModel.Component Private WithEvents _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 _clearBeforeFill As Boolean _ Public Sub New() MyBase.New Me.ClearBeforeFill = true End Sub _ Protected Friend ReadOnly Property Adapter() As Global.System.Data.OleDb.OleDbDataAdapter Get 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 Get If (Me._connection Is Nothing) Then Me.InitConnection End If Return Me._connection End Get Set Me._connection = value If (Not (Me.Adapter.InsertCommand) Is Nothing) Then Me.Adapter.InsertCommand.Connection = value End If If (Not (Me.Adapter.DeleteCommand) Is Nothing) Then Me.Adapter.DeleteCommand.Connection = value End If If (Not (Me.Adapter.UpdateCommand) Is 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 End If i = (i + 1) Loop End Set End Property _ Friend Property Transaction() As Global.System.Data.OleDb.OleDbTransaction Get Return Me._transaction End Get Set 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 Me.Adapter.DeleteCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.InsertCommand) Is Nothing)) Then Me.Adapter.InsertCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.UpdateCommand) Is Nothing)) Then Me.Adapter.UpdateCommand.Transaction = Me._transaction End If End Set End Property _ Protected ReadOnly Property CommandCollection() As Global.System.Data.OleDb.OleDbCommand() Get If (Me._commandCollection Is Nothing) Then Me.InitCommandCollection End If Return Me._commandCollection End Get End Property _ Public Property ClearBeforeFill() As Boolean Get Return Me._clearBeforeFill End Get Set 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() tableMapping.SourceTable = "Table" tableMapping.DataSetTable = "Tags" tableMapping.ColumnMappings.Add("ID", "ID") 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 `Tags` WHERE ((`ID` = ?))" Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_ID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "ID", 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 `Tags` DEFAULT VALUES" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.UpdateCommand = New Global.System.Data.OleDb.OleDbCommand() Me._adapter.UpdateCommand.Connection = Me.Connection Me._adapter.UpdateCommand.CommandText = "UPDATE `Tags` WHERE ((`ID` = ?))" Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_ID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "ID", Global.System.Data.DataRowVersion.Original, false, Nothing)) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.OleDb.OleDbConnection() Me._connection.ConnectionString = Global.NEA.MySettings.Default.NEAConnectionString2 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 ID FROM Tags" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text End Sub _ Public Overloads Overridable Function Fill(ByVal dataTable As NEADataSet.TagsDataTable) As Integer Me.Adapter.SelectCommand = Me.CommandCollection(0) If (Me.ClearBeforeFill = true) Then dataTable.Clear End If Dim returnValue As Integer = Me.Adapter.Fill(dataTable) Return returnValue End Function _ Public Overloads Overridable Function GetData() As NEADataSet.TagsDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As NEADataSet.TagsDataTable = New NEADataSet.TagsDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overloads Overridable Function Update(ByVal dataTable As NEADataSet.TagsDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function _ Public Overloads Overridable Function Update(ByVal dataSet As NEADataSet) As Integer Return Me.Adapter.Update(dataSet, "Tags") End Function _ Public Overloads 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 Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer Return Me.Adapter.Update(dataRows) End Function _ Public Overloads Overridable Function Delete(ByVal Original_ID As Integer) As Integer Me.Adapter.DeleteCommand.Parameters(0).Value = CType(Original_ID,Integer) 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 Me.Adapter.DeleteCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.DeleteCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Insert() As Integer 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 Me.Adapter.InsertCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.InsertCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Update(ByVal Original_ID As Integer) As Integer Me.Adapter.UpdateCommand.Parameters(0).Value = CType(Original_ID,Integer) 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 Me.Adapter.UpdateCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.UpdateCommand.Connection.Close End If End Try End Function End Class ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class User_DetailsTableAdapter Inherits Global.System.ComponentModel.Component Private WithEvents _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 _clearBeforeFill As Boolean _ Public Sub New() MyBase.New Me.ClearBeforeFill = true End Sub _ Protected Friend ReadOnly Property Adapter() As Global.System.Data.OleDb.OleDbDataAdapter Get 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 Get If (Me._connection Is Nothing) Then Me.InitConnection End If Return Me._connection End Get Set Me._connection = value If (Not (Me.Adapter.InsertCommand) Is Nothing) Then Me.Adapter.InsertCommand.Connection = value End If If (Not (Me.Adapter.DeleteCommand) Is Nothing) Then Me.Adapter.DeleteCommand.Connection = value End If If (Not (Me.Adapter.UpdateCommand) Is 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 End If i = (i + 1) Loop End Set End Property _ Friend Property Transaction() As Global.System.Data.OleDb.OleDbTransaction Get Return Me._transaction End Get Set 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 Me.Adapter.DeleteCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.InsertCommand) Is Nothing)) Then Me.Adapter.InsertCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.UpdateCommand) Is Nothing)) Then Me.Adapter.UpdateCommand.Transaction = Me._transaction End If End Set End Property _ Protected ReadOnly Property CommandCollection() As Global.System.Data.OleDb.OleDbCommand() Get If (Me._commandCollection Is Nothing) Then Me.InitCommandCollection End If Return Me._commandCollection End Get End Property _ Public Property ClearBeforeFill() As Boolean Get Return Me._clearBeforeFill End Get Set 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() tableMapping.SourceTable = "Table" tableMapping.DataSetTable = "User_Details" tableMapping.ColumnMappings.Add("UserDetailsID", "UserDetailsID") tableMapping.ColumnMappings.Add("FirstName", "FirstName") tableMapping.ColumnMappings.Add("LastName", "LastName") tableMapping.ColumnMappings.Add("AddressLine1", "AddressLine1") tableMapping.ColumnMappings.Add("Town", "Town") tableMapping.ColumnMappings.Add("Postcode", "Postcode") tableMapping.ColumnMappings.Add("CardNumber", "CardNumber") tableMapping.ColumnMappings.Add("CVC", "CVC") tableMapping.ColumnMappings.Add("IGN", "IGN") tableMapping.ColumnMappings.Add("Email", "Email") tableMapping.ColumnMappings.Add("ProfilePic", "ProfilePic") 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 `User_Details` WHERE ((`UserDetailsID` = ?) AND ((? = 1 AND `Town` IS"& _ " NULL) OR (`Town` = ?)) AND ((? = 1 AND `CardNumber` IS NULL) OR (`CardNumber` ="& _ " ?)) AND ((? = 1 AND `CVC` IS NULL) OR (`CVC` = ?)))" Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UserDetailsID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserDetailsID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_Town", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Town", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_Town", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Town", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_CardNumber", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "CardNumber", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_CardNumber", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "CardNumber", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_CVC", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "CVC", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_CVC", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "CVC", 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 `User_Details` (`FirstName`, `LastName`, `AddressLine1`, `Town`, `Pos"& _ "tcode`, `CardNumber`, `CVC`, `IGN`, `Email`, `ProfilePic`) VALUES (?, ?, ?, ?, ?"& _ ", ?, ?, ?, ?, ?)" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("FirstName", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "FirstName", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("LastName", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "LastName", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("AddressLine1", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "AddressLine1", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Town", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Town", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Postcode", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Postcode", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("CardNumber", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "CardNumber", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("CVC", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "CVC", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IGN", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "IGN", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Email", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Email", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("ProfilePic", Global.System.Data.OleDb.OleDbType.LongVarBinary, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "ProfilePic", 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 `User_Details` SET `FirstName` = ?, `LastName` = ?, `AddressLine1` = ?, `T"& _ "own` = ?, `Postcode` = ?, `CardNumber` = ?, `CVC` = ?, `IGN` = ?, `Email` = ?, `"& _ "ProfilePic` = ? WHERE ((`UserDetailsID` = ?) AND ((? = 1 AND `Town` IS NULL) OR "& _ "(`Town` = ?)) AND ((? = 1 AND `CardNumber` IS NULL) OR (`CardNumber` = ?)) AND ("& _ "(? = 1 AND `CVC` IS NULL) OR (`CVC` = ?)))" Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("FirstName", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "FirstName", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("LastName", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "LastName", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("AddressLine1", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "AddressLine1", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Town", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Town", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Postcode", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Postcode", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("CardNumber", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "CardNumber", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("CVC", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "CVC", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IGN", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "IGN", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Email", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Email", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("ProfilePic", Global.System.Data.OleDb.OleDbType.LongVarBinary, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "ProfilePic", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UserDetailsID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserDetailsID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_Town", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Town", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_Town", Global.System.Data.OleDb.OleDbType.VarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Town", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_CardNumber", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "CardNumber", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_CardNumber", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "CardNumber", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_CVC", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "CVC", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_CVC", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "CVC", Global.System.Data.DataRowVersion.Original, false, Nothing)) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.OleDb.OleDbConnection() Me._connection.ConnectionString = Global.NEA.MySettings.Default.NEAConnectionString2 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 UserDetailsID, FirstName, LastName, AddressLine1, Town, Postcode, CardNumb"& _ "er, CVC, IGN, Email, ProfilePic FROM User_Details" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text End Sub _ Public Overloads Overridable Function Fill(ByVal dataTable As NEADataSet.User_DetailsDataTable) As Integer Me.Adapter.SelectCommand = Me.CommandCollection(0) If (Me.ClearBeforeFill = true) Then dataTable.Clear End If Dim returnValue As Integer = Me.Adapter.Fill(dataTable) Return returnValue End Function _ Public Overloads Overridable Function GetData() As NEADataSet.User_DetailsDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As NEADataSet.User_DetailsDataTable = New NEADataSet.User_DetailsDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overloads Overridable Function Update(ByVal dataTable As NEADataSet.User_DetailsDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function _ Public Overloads Overridable Function Update(ByVal dataSet As NEADataSet) As Integer Return Me.Adapter.Update(dataSet, "User_Details") End Function _ Public Overloads 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 Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer Return Me.Adapter.Update(dataRows) End Function _ Public Overloads Overridable Function Delete(ByVal Original_UserDetailsID As Integer, ByVal Original_Town As String, ByVal Original_CardNumber As Global.System.Nullable(Of Integer), ByVal Original_CVC As Global.System.Nullable(Of Integer)) As Integer Me.Adapter.DeleteCommand.Parameters(0).Value = CType(Original_UserDetailsID,Integer) If (Original_Town Is Nothing) Then Me.Adapter.DeleteCommand.Parameters(1).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(2).Value = Global.System.DBNull.Value Else Me.Adapter.DeleteCommand.Parameters(1).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(2).Value = CType(Original_Town,String) End If If (Original_CardNumber.HasValue = true) Then Me.Adapter.DeleteCommand.Parameters(3).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = CType(Original_CardNumber.Value,Integer) Else Me.Adapter.DeleteCommand.Parameters(3).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = Global.System.DBNull.Value End If If (Original_CVC.HasValue = true) Then Me.Adapter.DeleteCommand.Parameters(5).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(6).Value = CType(Original_CVC.Value,Integer) Else Me.Adapter.DeleteCommand.Parameters(5).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(6).Value = Global.System.DBNull.Value 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 Me.Adapter.DeleteCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.DeleteCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Insert(ByVal FirstName As String, ByVal LastName As String, ByVal AddressLine1 As String, ByVal Town As String, ByVal Postcode As String, ByVal CardNumber As Global.System.Nullable(Of Integer), ByVal CVC As Global.System.Nullable(Of Integer), ByVal IGN As String, ByVal Email As String, ByVal ProfilePic() As Byte) As Integer If (FirstName Is Nothing) Then Me.Adapter.InsertCommand.Parameters(0).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(0).Value = CType(FirstName,String) End If If (LastName Is Nothing) Then Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(1).Value = CType(LastName,String) End If If (AddressLine1 Is Nothing) Then Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(2).Value = CType(AddressLine1,String) End If If (Town Is Nothing) Then Me.Adapter.InsertCommand.Parameters(3).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(3).Value = CType(Town,String) End If If (Postcode Is Nothing) Then Me.Adapter.InsertCommand.Parameters(4).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(4).Value = CType(Postcode,String) End If If (CardNumber.HasValue = true) Then Me.Adapter.InsertCommand.Parameters(5).Value = CType(CardNumber.Value,Integer) Else Me.Adapter.InsertCommand.Parameters(5).Value = Global.System.DBNull.Value End If If (CVC.HasValue = true) Then Me.Adapter.InsertCommand.Parameters(6).Value = CType(CVC.Value,Integer) Else Me.Adapter.InsertCommand.Parameters(6).Value = Global.System.DBNull.Value End If If (IGN Is Nothing) Then Me.Adapter.InsertCommand.Parameters(7).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(7).Value = CType(IGN,String) End If If (Email Is Nothing) Then Me.Adapter.InsertCommand.Parameters(8).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(8).Value = CType(Email,String) End If If (ProfilePic Is Nothing) Then Me.Adapter.InsertCommand.Parameters(9).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(9).Value = CType(ProfilePic,Byte()) 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 Me.Adapter.InsertCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.InsertCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Update(ByVal FirstName As String, ByVal LastName As String, ByVal AddressLine1 As String, ByVal Town As String, ByVal Postcode As String, ByVal CardNumber As Global.System.Nullable(Of Integer), ByVal CVC As Global.System.Nullable(Of Integer), ByVal IGN As String, ByVal Email As String, ByVal ProfilePic() As Byte, ByVal Original_UserDetailsID As Integer, ByVal Original_Town As String, ByVal Original_CardNumber As Global.System.Nullable(Of Integer), ByVal Original_CVC As Global.System.Nullable(Of Integer)) As Integer If (FirstName Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(0).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(0).Value = CType(FirstName,String) End If If (LastName Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(1).Value = CType(LastName,String) End If If (AddressLine1 Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(2).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(2).Value = CType(AddressLine1,String) End If If (Town Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(3).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(3).Value = CType(Town,String) End If If (Postcode Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(4).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(4).Value = CType(Postcode,String) End If If (CardNumber.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(5).Value = CType(CardNumber.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(5).Value = Global.System.DBNull.Value End If If (CVC.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(6).Value = CType(CVC.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(6).Value = Global.System.DBNull.Value End If If (IGN Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(7).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(7).Value = CType(IGN,String) End If If (Email Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(8).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(8).Value = CType(Email,String) End If If (ProfilePic Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(9).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(9).Value = CType(ProfilePic,Byte()) End If Me.Adapter.UpdateCommand.Parameters(10).Value = CType(Original_UserDetailsID,Integer) If (Original_Town Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(11).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(12).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(11).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(12).Value = CType(Original_Town,String) End If If (Original_CardNumber.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(13).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(14).Value = CType(Original_CardNumber.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(13).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(14).Value = Global.System.DBNull.Value End If If (Original_CVC.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(15).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(16).Value = CType(Original_CVC.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(15).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(16).Value = Global.System.DBNull.Value 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 Me.Adapter.UpdateCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.UpdateCommand.Connection.Close End If End Try End Function End Class ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class UsersTableAdapter Inherits Global.System.ComponentModel.Component Private WithEvents _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 _clearBeforeFill As Boolean _ Public Sub New() MyBase.New Me.ClearBeforeFill = true End Sub _ Protected Friend ReadOnly Property Adapter() As Global.System.Data.OleDb.OleDbDataAdapter Get 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 Get If (Me._connection Is Nothing) Then Me.InitConnection End If Return Me._connection End Get Set Me._connection = value If (Not (Me.Adapter.InsertCommand) Is Nothing) Then Me.Adapter.InsertCommand.Connection = value End If If (Not (Me.Adapter.DeleteCommand) Is Nothing) Then Me.Adapter.DeleteCommand.Connection = value End If If (Not (Me.Adapter.UpdateCommand) Is 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 End If i = (i + 1) Loop End Set End Property _ Friend Property Transaction() As Global.System.Data.OleDb.OleDbTransaction Get Return Me._transaction End Get Set 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 Me.Adapter.DeleteCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.InsertCommand) Is Nothing)) Then Me.Adapter.InsertCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.UpdateCommand) Is Nothing)) Then Me.Adapter.UpdateCommand.Transaction = Me._transaction End If End Set End Property _ Protected ReadOnly Property CommandCollection() As Global.System.Data.OleDb.OleDbCommand() Get If (Me._commandCollection Is Nothing) Then Me.InitCommandCollection End If Return Me._commandCollection End Get End Property _ Public Property ClearBeforeFill() As Boolean Get Return Me._clearBeforeFill End Get Set 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() tableMapping.SourceTable = "Table" tableMapping.DataSetTable = "Users" tableMapping.ColumnMappings.Add("UserID", "UserID") tableMapping.ColumnMappings.Add("User_DetailsID", "User_DetailsID") tableMapping.ColumnMappings.Add("Username", "Username") tableMapping.ColumnMappings.Add("Password", "Password") 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 `Users` WHERE ((`UserID` = ?) AND ((? = 1 AND `User_DetailsID` IS NUL"& _ "L) OR (`User_DetailsID` = ?)))" Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_User_DetailsID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "User_DetailsID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_User_DetailsID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "User_DetailsID", 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 `Users` (`User_DetailsID`, `Username`, `Password`) VALUES (?, ?, ?)" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("User_DetailsID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "User_DetailsID", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Username", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Username", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Password", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Password", 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 `Users` SET `User_DetailsID` = ?, `Username` = ?, `Password` = ? WHERE ((`"& _ "UserID` = ?) AND ((? = 1 AND `User_DetailsID` IS NULL) OR (`User_DetailsID` = ?)"& _ "))" Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("User_DetailsID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "User_DetailsID", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Username", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Username", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Password", Global.System.Data.OleDb.OleDbType.LongVarWChar, 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Password", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_User_DetailsID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "User_DetailsID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_User_DetailsID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "User_DetailsID", Global.System.Data.DataRowVersion.Original, false, Nothing)) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.OleDb.OleDbConnection() Me._connection.ConnectionString = Global.NEA.MySettings.Default.NEAConnectionString2 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 UserID, User_DetailsID, Username, [Password] FROM Users" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text End Sub _ Public Overloads Overridable Function Fill(ByVal dataTable As NEADataSet.UsersDataTable) As Integer Me.Adapter.SelectCommand = Me.CommandCollection(0) If (Me.ClearBeforeFill = true) Then dataTable.Clear End If Dim returnValue As Integer = Me.Adapter.Fill(dataTable) Return returnValue End Function _ Public Overloads Overridable Function GetData() As NEADataSet.UsersDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As NEADataSet.UsersDataTable = New NEADataSet.UsersDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overloads Overridable Function Update(ByVal dataTable As NEADataSet.UsersDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function _ Public Overloads Overridable Function Update(ByVal dataSet As NEADataSet) As Integer Return Me.Adapter.Update(dataSet, "Users") End Function _ Public Overloads 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 Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer Return Me.Adapter.Update(dataRows) End Function _ Public Overloads Overridable Function Delete(ByVal Original_UserID As Integer, ByVal Original_User_DetailsID As Global.System.Nullable(Of Integer)) As Integer Me.Adapter.DeleteCommand.Parameters(0).Value = CType(Original_UserID,Integer) If (Original_User_DetailsID.HasValue = true) Then Me.Adapter.DeleteCommand.Parameters(1).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(2).Value = CType(Original_User_DetailsID.Value,Integer) Else Me.Adapter.DeleteCommand.Parameters(1).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(2).Value = Global.System.DBNull.Value 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 Me.Adapter.DeleteCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.DeleteCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Insert(ByVal User_DetailsID As Global.System.Nullable(Of Integer), ByVal Username As String, ByVal Password As String) As Integer If (User_DetailsID.HasValue = true) Then Me.Adapter.InsertCommand.Parameters(0).Value = CType(User_DetailsID.Value,Integer) Else Me.Adapter.InsertCommand.Parameters(0).Value = Global.System.DBNull.Value End If If (Username Is Nothing) Then Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(1).Value = CType(Username,String) End If If (Password Is Nothing) Then Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(2).Value = CType(Password,String) 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 Me.Adapter.InsertCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.InsertCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Update(ByVal User_DetailsID As Global.System.Nullable(Of Integer), ByVal Username As String, ByVal Password As String, ByVal Original_UserID As Integer, ByVal Original_User_DetailsID As Global.System.Nullable(Of Integer)) As Integer If (User_DetailsID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(0).Value = CType(User_DetailsID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(0).Value = Global.System.DBNull.Value End If If (Username Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(1).Value = CType(Username,String) End If If (Password Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(2).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(2).Value = CType(Password,String) End If Me.Adapter.UpdateCommand.Parameters(3).Value = CType(Original_UserID,Integer) If (Original_User_DetailsID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(4).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(5).Value = CType(Original_User_DetailsID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(4).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(5).Value = Global.System.DBNull.Value 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 Me.Adapter.UpdateCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.UpdateCommand.Connection.Close End If End Try End Function End Class ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class WishlistTableAdapter Inherits Global.System.ComponentModel.Component Private WithEvents _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 _clearBeforeFill As Boolean _ Public Sub New() MyBase.New Me.ClearBeforeFill = true End Sub _ Protected Friend ReadOnly Property Adapter() As Global.System.Data.OleDb.OleDbDataAdapter Get 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 Get If (Me._connection Is Nothing) Then Me.InitConnection End If Return Me._connection End Get Set Me._connection = value If (Not (Me.Adapter.InsertCommand) Is Nothing) Then Me.Adapter.InsertCommand.Connection = value End If If (Not (Me.Adapter.DeleteCommand) Is Nothing) Then Me.Adapter.DeleteCommand.Connection = value End If If (Not (Me.Adapter.UpdateCommand) Is 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 End If i = (i + 1) Loop End Set End Property _ Friend Property Transaction() As Global.System.Data.OleDb.OleDbTransaction Get Return Me._transaction End Get Set 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 Me.Adapter.DeleteCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.InsertCommand) Is Nothing)) Then Me.Adapter.InsertCommand.Transaction = Me._transaction End If If ((Not (Me.Adapter) Is Nothing) _ AndAlso (Not (Me.Adapter.UpdateCommand) Is Nothing)) Then Me.Adapter.UpdateCommand.Transaction = Me._transaction End If End Set End Property _ Protected ReadOnly Property CommandCollection() As Global.System.Data.OleDb.OleDbCommand() Get If (Me._commandCollection Is Nothing) Then Me.InitCommandCollection End If Return Me._commandCollection End Get End Property _ Public Property ClearBeforeFill() As Boolean Get Return Me._clearBeforeFill End Get Set 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() tableMapping.SourceTable = "Table" tableMapping.DataSetTable = "Wishlist" tableMapping.ColumnMappings.Add("WishlistID", "WishlistID") tableMapping.ColumnMappings.Add("UserID", "UserID") tableMapping.ColumnMappings.Add("GameID", "GameID") 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 `Wishlist` WHERE ((`WishlistID` = ?) AND ((? = 1 AND `UserID` IS NULL"& _ ") OR (`UserID` = ?)) AND ((? = 1 AND `GameID` IS NULL) OR (`GameID` = ?)))" Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_WishlistID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "WishlistID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", 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 `Wishlist` (`UserID`, `GameID`) VALUES (?, ?)" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", 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 `Wishlist` SET `UserID` = ?, `GameID` = ? WHERE ((`WishlistID` = ?) AND (("& _ "? = 1 AND `UserID` IS NULL) OR (`UserID` = ?)) AND ((? = 1 AND `GameID` IS NULL)"& _ " OR (`GameID` = ?)))" Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Current, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_WishlistID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "WishlistID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_UserID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "UserID", Global.System.Data.DataRowVersion.Original, false, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("IsNull_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Original, true, Nothing)) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.OleDb.OleDbParameter("Original_GameID", Global.System.Data.OleDb.OleDbType.[Integer], 0, Global.System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "GameID", Global.System.Data.DataRowVersion.Original, false, Nothing)) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.OleDb.OleDbConnection() Me._connection.ConnectionString = Global.NEA.MySettings.Default.NEAConnectionString2 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 WishlistID, UserID, GameID FROM Wishlist" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text End Sub _ Public Overloads Overridable Function Fill(ByVal dataTable As NEADataSet.WishlistDataTable) As Integer Me.Adapter.SelectCommand = Me.CommandCollection(0) If (Me.ClearBeforeFill = true) Then dataTable.Clear End If Dim returnValue As Integer = Me.Adapter.Fill(dataTable) Return returnValue End Function _ Public Overloads Overridable Function GetData() As NEADataSet.WishlistDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As NEADataSet.WishlistDataTable = New NEADataSet.WishlistDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overloads Overridable Function Update(ByVal dataTable As NEADataSet.WishlistDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function _ Public Overloads Overridable Function Update(ByVal dataSet As NEADataSet) As Integer Return Me.Adapter.Update(dataSet, "Wishlist") End Function _ Public Overloads 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 Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer Return Me.Adapter.Update(dataRows) End Function _ Public Overloads Overridable Function Delete(ByVal Original_WishlistID As Integer, ByVal Original_UserID As Global.System.Nullable(Of Integer), ByVal Original_GameID As Global.System.Nullable(Of Integer)) As Integer Me.Adapter.DeleteCommand.Parameters(0).Value = CType(Original_WishlistID,Integer) If (Original_UserID.HasValue = true) Then Me.Adapter.DeleteCommand.Parameters(1).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(2).Value = CType(Original_UserID.Value,Integer) Else Me.Adapter.DeleteCommand.Parameters(1).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(2).Value = Global.System.DBNull.Value End If If (Original_GameID.HasValue = true) Then Me.Adapter.DeleteCommand.Parameters(3).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = CType(Original_GameID.Value,Integer) Else Me.Adapter.DeleteCommand.Parameters(3).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = Global.System.DBNull.Value 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 Me.Adapter.DeleteCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.DeleteCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Insert(ByVal UserID As Global.System.Nullable(Of Integer), ByVal GameID As Global.System.Nullable(Of Integer)) As Integer If (UserID.HasValue = true) Then Me.Adapter.InsertCommand.Parameters(0).Value = CType(UserID.Value,Integer) Else Me.Adapter.InsertCommand.Parameters(0).Value = Global.System.DBNull.Value End If If (GameID.HasValue = true) Then Me.Adapter.InsertCommand.Parameters(1).Value = CType(GameID.Value,Integer) Else Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value 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 Me.Adapter.InsertCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.InsertCommand.Connection.Close End If End Try End Function _ Public Overloads Overridable Function Update(ByVal UserID As Global.System.Nullable(Of Integer), ByVal GameID As Global.System.Nullable(Of Integer), ByVal Original_WishlistID As Integer, ByVal Original_UserID As Global.System.Nullable(Of Integer), ByVal Original_GameID As Global.System.Nullable(Of Integer)) As Integer If (UserID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(0).Value = CType(UserID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(0).Value = Global.System.DBNull.Value End If If (GameID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(1).Value = CType(GameID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value End If Me.Adapter.UpdateCommand.Parameters(2).Value = CType(Original_WishlistID,Integer) If (Original_UserID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(3).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(4).Value = CType(Original_UserID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(3).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(4).Value = Global.System.DBNull.Value End If If (Original_GameID.HasValue = true) Then Me.Adapter.UpdateCommand.Parameters(5).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(6).Value = CType(Original_GameID.Value,Integer) Else Me.Adapter.UpdateCommand.Parameters(5).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(6).Value = Global.System.DBNull.Value 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 Me.Adapter.UpdateCommand.Connection.Open End If Try Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery Return returnValue Finally 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 Inherits Global.System.ComponentModel.Component Private _updateOrder As UpdateOrderOption Private _achievementTableAdapter As AchievementTableAdapter Private _dOWTableAdapter As DOWTableAdapter Private _friendsTableAdapter As FriendsTableAdapter Private _gamesTableAdapter As GamesTableAdapter Private _purchasedTableAdapter As PurchasedTableAdapter Private _reviewsTableAdapter As ReviewsTableAdapter Private _tagsTableAdapter As TagsTableAdapter Private _user_DetailsTableAdapter As User_DetailsTableAdapter Private _usersTableAdapter As UsersTableAdapter Private _wishlistTableAdapter As WishlistTableAdapter Private _backupDataSetBeforeUpdate As Boolean Private _connection As Global.System.Data.IDbConnection _ Public Property UpdateOrder() As UpdateOrderOption Get Return Me._updateOrder End Get Set Me._updateOrder = value End Set End Property _ Public Property AchievementTableAdapter() As AchievementTableAdapter Get Return Me._achievementTableAdapter End Get Set Me._achievementTableAdapter = value End Set End Property _ Public Property DOWTableAdapter() As DOWTableAdapter Get Return Me._dOWTableAdapter End Get Set Me._dOWTableAdapter = value End Set End Property _ Public Property FriendsTableAdapter() As FriendsTableAdapter Get Return Me._friendsTableAdapter End Get Set Me._friendsTableAdapter = value End Set End Property _ Public Property GamesTableAdapter() As GamesTableAdapter Get Return Me._gamesTableAdapter End Get Set Me._gamesTableAdapter = value End Set End Property _ Public Property PurchasedTableAdapter() As PurchasedTableAdapter Get Return Me._purchasedTableAdapter End Get Set Me._purchasedTableAdapter = value End Set End Property _ Public Property ReviewsTableAdapter() As ReviewsTableAdapter Get Return Me._reviewsTableAdapter End Get Set Me._reviewsTableAdapter = value End Set End Property _ Public Property TagsTableAdapter() As TagsTableAdapter Get Return Me._tagsTableAdapter End Get Set Me._tagsTableAdapter = value End Set End Property _ Public Property User_DetailsTableAdapter() As User_DetailsTableAdapter Get Return Me._user_DetailsTableAdapter End Get Set Me._user_DetailsTableAdapter = value End Set End Property _ Public Property UsersTableAdapter() As UsersTableAdapter Get Return Me._usersTableAdapter End Get Set Me._usersTableAdapter = value End Set End Property _ Public Property WishlistTableAdapter() As WishlistTableAdapter Get Return Me._wishlistTableAdapter End Get Set Me._wishlistTableAdapter = value End Set End Property _ Public Property BackupDataSetBeforeUpdate() As Boolean Get Return Me._backupDataSetBeforeUpdate End Get Set Me._backupDataSetBeforeUpdate = value End Set End Property _ Public Property Connection() As Global.System.Data.IDbConnection Get If (Not (Me._connection) Is Nothing) Then Return Me._connection End If If ((Not (Me._achievementTableAdapter) Is Nothing) _ AndAlso (Not (Me._achievementTableAdapter.Connection) Is Nothing)) Then Return Me._achievementTableAdapter.Connection End If If ((Not (Me._dOWTableAdapter) Is Nothing) _ AndAlso (Not (Me._dOWTableAdapter.Connection) Is Nothing)) Then Return Me._dOWTableAdapter.Connection End If If ((Not (Me._friendsTableAdapter) Is Nothing) _ AndAlso (Not (Me._friendsTableAdapter.Connection) Is Nothing)) Then Return Me._friendsTableAdapter.Connection End If If ((Not (Me._gamesTableAdapter) Is Nothing) _ AndAlso (Not (Me._gamesTableAdapter.Connection) Is Nothing)) Then Return Me._gamesTableAdapter.Connection End If If ((Not (Me._purchasedTableAdapter) Is Nothing) _ AndAlso (Not (Me._purchasedTableAdapter.Connection) Is Nothing)) Then Return Me._purchasedTableAdapter.Connection End If If ((Not (Me._reviewsTableAdapter) Is Nothing) _ AndAlso (Not (Me._reviewsTableAdapter.Connection) Is Nothing)) Then Return Me._reviewsTableAdapter.Connection End If If ((Not (Me._tagsTableAdapter) Is Nothing) _ AndAlso (Not (Me._tagsTableAdapter.Connection) Is Nothing)) Then Return Me._tagsTableAdapter.Connection End If If ((Not (Me._user_DetailsTableAdapter) Is Nothing) _ AndAlso (Not (Me._user_DetailsTableAdapter.Connection) Is Nothing)) Then Return Me._user_DetailsTableAdapter.Connection End If If ((Not (Me._usersTableAdapter) Is Nothing) _ AndAlso (Not (Me._usersTableAdapter.Connection) Is Nothing)) Then Return Me._usersTableAdapter.Connection End If If ((Not (Me._wishlistTableAdapter) Is Nothing) _ AndAlso (Not (Me._wishlistTableAdapter.Connection) Is Nothing)) Then Return Me._wishlistTableAdapter.Connection End If Return Nothing End Get Set Me._connection = value End Set End Property _ Public ReadOnly Property TableAdapterInstanceCount() As Integer Get Dim count As Integer = 0 If (Not (Me._achievementTableAdapter) Is Nothing) Then count = (count + 1) End If If (Not (Me._dOWTableAdapter) Is Nothing) Then count = (count + 1) End If If (Not (Me._friendsTableAdapter) Is Nothing) Then count = (count + 1) End If If (Not (Me._gamesTableAdapter) Is Nothing) Then count = (count + 1) End If If (Not (Me._purchasedTableAdapter) Is Nothing) Then count = (count + 1) End If If (Not (Me._reviewsTableAdapter) Is Nothing) Then count = (count + 1) End If If (Not (Me._tagsTableAdapter) Is Nothing) Then count = (count + 1) End If If (Not (Me._user_DetailsTableAdapter) Is Nothing) Then count = (count + 1) End If If (Not (Me._usersTableAdapter) Is Nothing) Then count = (count + 1) End If If (Not (Me._wishlistTableAdapter) Is 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 NEADataSet, 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._gamesTableAdapter) Is Nothing) Then Dim updatedRows() As Global.System.Data.DataRow = dataSet.Games.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._gamesTableAdapter.Update(updatedRows)) allChangedRows.AddRange(updatedRows) End If End If If (Not (Me._user_DetailsTableAdapter) Is Nothing) Then Dim updatedRows() As Global.System.Data.DataRow = dataSet.User_Details.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._user_DetailsTableAdapter.Update(updatedRows)) allChangedRows.AddRange(updatedRows) End If End If If (Not (Me._achievementTableAdapter) Is Nothing) Then Dim updatedRows() As Global.System.Data.DataRow = dataSet.Achievement.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._achievementTableAdapter.Update(updatedRows)) allChangedRows.AddRange(updatedRows) End If End If If (Not (Me._dOWTableAdapter) Is Nothing) Then Dim updatedRows() As Global.System.Data.DataRow = dataSet.DOW.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._dOWTableAdapter.Update(updatedRows)) allChangedRows.AddRange(updatedRows) End If End If If (Not (Me._friendsTableAdapter) Is Nothing) Then Dim updatedRows() As Global.System.Data.DataRow = dataSet.Friends.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._friendsTableAdapter.Update(updatedRows)) allChangedRows.AddRange(updatedRows) End If End If If (Not (Me._purchasedTableAdapter) Is Nothing) Then Dim updatedRows() As Global.System.Data.DataRow = dataSet.Purchased.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._purchasedTableAdapter.Update(updatedRows)) allChangedRows.AddRange(updatedRows) End If End If If (Not (Me._reviewsTableAdapter) Is Nothing) Then Dim updatedRows() As Global.System.Data.DataRow = dataSet.Reviews.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._reviewsTableAdapter.Update(updatedRows)) allChangedRows.AddRange(updatedRows) End If End If If (Not (Me._tagsTableAdapter) Is Nothing) Then Dim updatedRows() As Global.System.Data.DataRow = dataSet.Tags.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._tagsTableAdapter.Update(updatedRows)) allChangedRows.AddRange(updatedRows) End If End If If (Not (Me._usersTableAdapter) Is Nothing) Then Dim updatedRows() As Global.System.Data.DataRow = dataSet.Users.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._usersTableAdapter.Update(updatedRows)) allChangedRows.AddRange(updatedRows) End If End If If (Not (Me._wishlistTableAdapter) Is Nothing) Then Dim updatedRows() As Global.System.Data.DataRow = dataSet.Wishlist.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._wishlistTableAdapter.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 NEADataSet, ByVal allAddedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)) As Integer Dim result As Integer = 0 If (Not (Me._gamesTableAdapter) Is Nothing) Then Dim addedRows() As Global.System.Data.DataRow = dataSet.Games.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) If ((Not (addedRows) Is Nothing) _ AndAlso (0 < addedRows.Length)) Then result = (result + Me._gamesTableAdapter.Update(addedRows)) allAddedRows.AddRange(addedRows) End If End If If (Not (Me._user_DetailsTableAdapter) Is Nothing) Then Dim addedRows() As Global.System.Data.DataRow = dataSet.User_Details.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) If ((Not (addedRows) Is Nothing) _ AndAlso (0 < addedRows.Length)) Then result = (result + Me._user_DetailsTableAdapter.Update(addedRows)) allAddedRows.AddRange(addedRows) End If End If If (Not (Me._achievementTableAdapter) Is Nothing) Then Dim addedRows() As Global.System.Data.DataRow = dataSet.Achievement.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) If ((Not (addedRows) Is Nothing) _ AndAlso (0 < addedRows.Length)) Then result = (result + Me._achievementTableAdapter.Update(addedRows)) allAddedRows.AddRange(addedRows) End If End If If (Not (Me._dOWTableAdapter) Is Nothing) Then Dim addedRows() As Global.System.Data.DataRow = dataSet.DOW.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) If ((Not (addedRows) Is Nothing) _ AndAlso (0 < addedRows.Length)) Then result = (result + Me._dOWTableAdapter.Update(addedRows)) allAddedRows.AddRange(addedRows) End If End If If (Not (Me._friendsTableAdapter) Is Nothing) Then Dim addedRows() As Global.System.Data.DataRow = dataSet.Friends.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) If ((Not (addedRows) Is Nothing) _ AndAlso (0 < addedRows.Length)) Then result = (result + Me._friendsTableAdapter.Update(addedRows)) allAddedRows.AddRange(addedRows) End If End If If (Not (Me._purchasedTableAdapter) Is Nothing) Then Dim addedRows() As Global.System.Data.DataRow = dataSet.Purchased.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) If ((Not (addedRows) Is Nothing) _ AndAlso (0 < addedRows.Length)) Then result = (result + Me._purchasedTableAdapter.Update(addedRows)) allAddedRows.AddRange(addedRows) End If End If If (Not (Me._reviewsTableAdapter) Is Nothing) Then Dim addedRows() As Global.System.Data.DataRow = dataSet.Reviews.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) If ((Not (addedRows) Is Nothing) _ AndAlso (0 < addedRows.Length)) Then result = (result + Me._reviewsTableAdapter.Update(addedRows)) allAddedRows.AddRange(addedRows) End If End If If (Not (Me._tagsTableAdapter) Is Nothing) Then Dim addedRows() As Global.System.Data.DataRow = dataSet.Tags.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) If ((Not (addedRows) Is Nothing) _ AndAlso (0 < addedRows.Length)) Then result = (result + Me._tagsTableAdapter.Update(addedRows)) allAddedRows.AddRange(addedRows) End If End If If (Not (Me._usersTableAdapter) Is Nothing) Then Dim addedRows() As Global.System.Data.DataRow = dataSet.Users.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) If ((Not (addedRows) Is Nothing) _ AndAlso (0 < addedRows.Length)) Then result = (result + Me._usersTableAdapter.Update(addedRows)) allAddedRows.AddRange(addedRows) End If End If If (Not (Me._wishlistTableAdapter) Is Nothing) Then Dim addedRows() As Global.System.Data.DataRow = dataSet.Wishlist.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) If ((Not (addedRows) Is Nothing) _ AndAlso (0 < addedRows.Length)) Then result = (result + Me._wishlistTableAdapter.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 NEADataSet, ByVal allChangedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)) As Integer Dim result As Integer = 0 If (Not (Me._wishlistTableAdapter) Is Nothing) Then Dim deletedRows() As Global.System.Data.DataRow = dataSet.Wishlist.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) If ((Not (deletedRows) Is Nothing) _ AndAlso (0 < deletedRows.Length)) Then result = (result + Me._wishlistTableAdapter.Update(deletedRows)) allChangedRows.AddRange(deletedRows) End If End If If (Not (Me._usersTableAdapter) Is Nothing) Then Dim deletedRows() As Global.System.Data.DataRow = dataSet.Users.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) If ((Not (deletedRows) Is Nothing) _ AndAlso (0 < deletedRows.Length)) Then result = (result + Me._usersTableAdapter.Update(deletedRows)) allChangedRows.AddRange(deletedRows) End If End If If (Not (Me._tagsTableAdapter) Is Nothing) Then Dim deletedRows() As Global.System.Data.DataRow = dataSet.Tags.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) If ((Not (deletedRows) Is Nothing) _ AndAlso (0 < deletedRows.Length)) Then result = (result + Me._tagsTableAdapter.Update(deletedRows)) allChangedRows.AddRange(deletedRows) End If End If If (Not (Me._reviewsTableAdapter) Is Nothing) Then Dim deletedRows() As Global.System.Data.DataRow = dataSet.Reviews.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) If ((Not (deletedRows) Is Nothing) _ AndAlso (0 < deletedRows.Length)) Then result = (result + Me._reviewsTableAdapter.Update(deletedRows)) allChangedRows.AddRange(deletedRows) End If End If If (Not (Me._purchasedTableAdapter) Is Nothing) Then Dim deletedRows() As Global.System.Data.DataRow = dataSet.Purchased.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) If ((Not (deletedRows) Is Nothing) _ AndAlso (0 < deletedRows.Length)) Then result = (result + Me._purchasedTableAdapter.Update(deletedRows)) allChangedRows.AddRange(deletedRows) End If End If If (Not (Me._friendsTableAdapter) Is Nothing) Then Dim deletedRows() As Global.System.Data.DataRow = dataSet.Friends.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) If ((Not (deletedRows) Is Nothing) _ AndAlso (0 < deletedRows.Length)) Then result = (result + Me._friendsTableAdapter.Update(deletedRows)) allChangedRows.AddRange(deletedRows) End If End If If (Not (Me._dOWTableAdapter) Is Nothing) Then Dim deletedRows() As Global.System.Data.DataRow = dataSet.DOW.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) If ((Not (deletedRows) Is Nothing) _ AndAlso (0 < deletedRows.Length)) Then result = (result + Me._dOWTableAdapter.Update(deletedRows)) allChangedRows.AddRange(deletedRows) End If End If If (Not (Me._achievementTableAdapter) Is Nothing) Then Dim deletedRows() As Global.System.Data.DataRow = dataSet.Achievement.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) If ((Not (deletedRows) Is Nothing) _ AndAlso (0 < deletedRows.Length)) Then result = (result + Me._achievementTableAdapter.Update(deletedRows)) allChangedRows.AddRange(deletedRows) End If End If If (Not (Me._user_DetailsTableAdapter) Is Nothing) Then Dim deletedRows() As Global.System.Data.DataRow = dataSet.User_Details.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) If ((Not (deletedRows) Is Nothing) _ AndAlso (0 < deletedRows.Length)) Then result = (result + Me._user_DetailsTableAdapter.Update(deletedRows)) allChangedRows.AddRange(deletedRows) End If End If If (Not (Me._gamesTableAdapter) Is Nothing) Then Dim deletedRows() As Global.System.Data.DataRow = dataSet.Games.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) If ((Not (deletedRows) Is Nothing) _ AndAlso (0 < deletedRows.Length)) Then result = (result + Me._gamesTableAdapter.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 Return updatedRows End If 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) Dim row As Global.System.Data.DataRow = updatedRows(i) If (allAddedRows.Contains(row) = false) Then realUpdatedRows.Add(row) End If i = (i + 1) Loop Return realUpdatedRows.ToArray End Function ''' '''Update all changes to the dataset. ''' _ Public Overridable Function UpdateAll(ByVal dataSet As NEADataSet) As Integer If (dataSet Is Nothing) Then Throw New Global.System.ArgumentNullException("dataSet") End If If (dataSet.HasChanges = false) Then Return 0 End If If ((Not (Me._achievementTableAdapter) Is Nothing) _ AndAlso (Me.MatchTableAdapterConnection(Me._achievementTableAdapter.Connection) = false)) Then Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s"& _ "tring.") End If If ((Not (Me._dOWTableAdapter) Is Nothing) _ AndAlso (Me.MatchTableAdapterConnection(Me._dOWTableAdapter.Connection) = false)) Then Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s"& _ "tring.") End If If ((Not (Me._friendsTableAdapter) Is Nothing) _ AndAlso (Me.MatchTableAdapterConnection(Me._friendsTableAdapter.Connection) = false)) Then Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s"& _ "tring.") End If If ((Not (Me._gamesTableAdapter) Is Nothing) _ AndAlso (Me.MatchTableAdapterConnection(Me._gamesTableAdapter.Connection) = false)) Then Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s"& _ "tring.") End If If ((Not (Me._purchasedTableAdapter) Is Nothing) _ AndAlso (Me.MatchTableAdapterConnection(Me._purchasedTableAdapter.Connection) = false)) Then Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s"& _ "tring.") End If If ((Not (Me._reviewsTableAdapter) Is Nothing) _ AndAlso (Me.MatchTableAdapterConnection(Me._reviewsTableAdapter.Connection) = false)) Then Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s"& _ "tring.") End If If ((Not (Me._tagsTableAdapter) Is Nothing) _ AndAlso (Me.MatchTableAdapterConnection(Me._tagsTableAdapter.Connection) = false)) Then Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s"& _ "tring.") End If If ((Not (Me._user_DetailsTableAdapter) Is Nothing) _ AndAlso (Me.MatchTableAdapterConnection(Me._user_DetailsTableAdapter.Connection) = false)) Then Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s"& _ "tring.") End If If ((Not (Me._usersTableAdapter) Is Nothing) _ AndAlso (Me.MatchTableAdapterConnection(Me._usersTableAdapter.Connection) = false)) Then Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s"& _ "tring.") End If If ((Not (Me._wishlistTableAdapter) Is Nothing) _ AndAlso (Me.MatchTableAdapterConnection(Me._wishlistTableAdapter.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.") End If Dim workConnOpened As Boolean = false 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 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.") 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)() Dim revertConnections As Global.System.Collections.Generic.Dictionary(Of Object, Global.System.Data.IDbConnection) = New Global.System.Collections.Generic.Dictionary(Of Object, Global.System.Data.IDbConnection)() Dim result As Integer = 0 Dim backupDataSet As Global.System.Data.DataSet = Nothing If Me.BackupDataSetBeforeUpdate Then backupDataSet = New Global.System.Data.DataSet() backupDataSet.Merge(dataSet) End If Try '---- Prepare for update ----------- ' If (Not (Me._achievementTableAdapter) Is Nothing) Then revertConnections.Add(Me._achievementTableAdapter, Me._achievementTableAdapter.Connection) Me._achievementTableAdapter.Connection = CType(workConnection,Global.System.Data.OleDb.OleDbConnection) Me._achievementTableAdapter.Transaction = CType(workTransaction,Global.System.Data.OleDb.OleDbTransaction) If Me._achievementTableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._achievementTableAdapter.Adapter.AcceptChangesDuringUpdate = false adaptersWithAcceptChangesDuringUpdate.Add(Me._achievementTableAdapter.Adapter) End If End If If (Not (Me._dOWTableAdapter) Is Nothing) Then revertConnections.Add(Me._dOWTableAdapter, Me._dOWTableAdapter.Connection) Me._dOWTableAdapter.Connection = CType(workConnection,Global.System.Data.OleDb.OleDbConnection) Me._dOWTableAdapter.Transaction = CType(workTransaction,Global.System.Data.OleDb.OleDbTransaction) If Me._dOWTableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._dOWTableAdapter.Adapter.AcceptChangesDuringUpdate = false adaptersWithAcceptChangesDuringUpdate.Add(Me._dOWTableAdapter.Adapter) End If End If If (Not (Me._friendsTableAdapter) Is Nothing) Then revertConnections.Add(Me._friendsTableAdapter, Me._friendsTableAdapter.Connection) Me._friendsTableAdapter.Connection = CType(workConnection,Global.System.Data.OleDb.OleDbConnection) Me._friendsTableAdapter.Transaction = CType(workTransaction,Global.System.Data.OleDb.OleDbTransaction) If Me._friendsTableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._friendsTableAdapter.Adapter.AcceptChangesDuringUpdate = false adaptersWithAcceptChangesDuringUpdate.Add(Me._friendsTableAdapter.Adapter) End If End If If (Not (Me._gamesTableAdapter) Is Nothing) Then revertConnections.Add(Me._gamesTableAdapter, Me._gamesTableAdapter.Connection) Me._gamesTableAdapter.Connection = CType(workConnection,Global.System.Data.OleDb.OleDbConnection) Me._gamesTableAdapter.Transaction = CType(workTransaction,Global.System.Data.OleDb.OleDbTransaction) If Me._gamesTableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._gamesTableAdapter.Adapter.AcceptChangesDuringUpdate = false adaptersWithAcceptChangesDuringUpdate.Add(Me._gamesTableAdapter.Adapter) End If End If If (Not (Me._purchasedTableAdapter) Is Nothing) Then revertConnections.Add(Me._purchasedTableAdapter, Me._purchasedTableAdapter.Connection) Me._purchasedTableAdapter.Connection = CType(workConnection,Global.System.Data.OleDb.OleDbConnection) Me._purchasedTableAdapter.Transaction = CType(workTransaction,Global.System.Data.OleDb.OleDbTransaction) If Me._purchasedTableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._purchasedTableAdapter.Adapter.AcceptChangesDuringUpdate = false adaptersWithAcceptChangesDuringUpdate.Add(Me._purchasedTableAdapter.Adapter) End If End If If (Not (Me._reviewsTableAdapter) Is Nothing) Then revertConnections.Add(Me._reviewsTableAdapter, Me._reviewsTableAdapter.Connection) Me._reviewsTableAdapter.Connection = CType(workConnection,Global.System.Data.OleDb.OleDbConnection) Me._reviewsTableAdapter.Transaction = CType(workTransaction,Global.System.Data.OleDb.OleDbTransaction) If Me._reviewsTableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._reviewsTableAdapter.Adapter.AcceptChangesDuringUpdate = false adaptersWithAcceptChangesDuringUpdate.Add(Me._reviewsTableAdapter.Adapter) End If End If If (Not (Me._tagsTableAdapter) Is Nothing) Then revertConnections.Add(Me._tagsTableAdapter, Me._tagsTableAdapter.Connection) Me._tagsTableAdapter.Connection = CType(workConnection,Global.System.Data.OleDb.OleDbConnection) Me._tagsTableAdapter.Transaction = CType(workTransaction,Global.System.Data.OleDb.OleDbTransaction) If Me._tagsTableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._tagsTableAdapter.Adapter.AcceptChangesDuringUpdate = false adaptersWithAcceptChangesDuringUpdate.Add(Me._tagsTableAdapter.Adapter) End If End If If (Not (Me._user_DetailsTableAdapter) Is Nothing) Then revertConnections.Add(Me._user_DetailsTableAdapter, Me._user_DetailsTableAdapter.Connection) Me._user_DetailsTableAdapter.Connection = CType(workConnection,Global.System.Data.OleDb.OleDbConnection) Me._user_DetailsTableAdapter.Transaction = CType(workTransaction,Global.System.Data.OleDb.OleDbTransaction) If Me._user_DetailsTableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._user_DetailsTableAdapter.Adapter.AcceptChangesDuringUpdate = false adaptersWithAcceptChangesDuringUpdate.Add(Me._user_DetailsTableAdapter.Adapter) End If End If If (Not (Me._usersTableAdapter) Is Nothing) Then revertConnections.Add(Me._usersTableAdapter, Me._usersTableAdapter.Connection) Me._usersTableAdapter.Connection = CType(workConnection,Global.System.Data.OleDb.OleDbConnection) Me._usersTableAdapter.Transaction = CType(workTransaction,Global.System.Data.OleDb.OleDbTransaction) If Me._usersTableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._usersTableAdapter.Adapter.AcceptChangesDuringUpdate = false adaptersWithAcceptChangesDuringUpdate.Add(Me._usersTableAdapter.Adapter) End If End If If (Not (Me._wishlistTableAdapter) Is Nothing) Then revertConnections.Add(Me._wishlistTableAdapter, Me._wishlistTableAdapter.Connection) Me._wishlistTableAdapter.Connection = CType(workConnection,Global.System.Data.OleDb.OleDbConnection) Me._wishlistTableAdapter.Transaction = CType(workTransaction,Global.System.Data.OleDb.OleDbTransaction) If Me._wishlistTableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._wishlistTableAdapter.Adapter.AcceptChangesDuringUpdate = false adaptersWithAcceptChangesDuringUpdate.Add(Me._wishlistTableAdapter.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)) Else result = (result + Me.UpdateInsertedRows(dataSet, allAddedRows)) result = (result + Me.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows)) End If 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 allAddedRows.CopyTo(rows) Dim i As Integer = 0 Do While (i < rows.Length) Dim row As Global.System.Data.DataRow = rows(i) row.AcceptChanges i = (i + 1) Loop End If If (0 < allChangedRows.Count) Then Dim rows((allChangedRows.Count) - 1) As Global.System.Data.DataRow allChangedRows.CopyTo(rows) Dim i As Integer = 0 Do While (i < rows.Length) Dim row As Global.System.Data.DataRow = rows(i) row.AcceptChanges i = (i + 1) Loop End If Catch ex As Global.System.Exception workTransaction.Rollback '---- Restore the dataset ----------- If Me.BackupDataSetBeforeUpdate Then Global.System.Diagnostics.Debug.Assert((Not (backupDataSet) Is Nothing)) dataSet.Clear dataSet.Merge(backupDataSet) Else If (0 < allAddedRows.Count) Then Dim rows((allAddedRows.Count) - 1) As Global.System.Data.DataRow allAddedRows.CopyTo(rows) Dim i As Integer = 0 Do While (i < rows.Length) Dim row As Global.System.Data.DataRow = rows(i) row.AcceptChanges row.SetAdded i = (i + 1) Loop End If End If Throw ex Finally If workConnOpened Then workConnection.Close End If If (Not (Me._achievementTableAdapter) Is Nothing) Then Me._achievementTableAdapter.Connection = CType(revertConnections(Me._achievementTableAdapter),Global.System.Data.OleDb.OleDbConnection) Me._achievementTableAdapter.Transaction = Nothing End If If (Not (Me._dOWTableAdapter) Is Nothing) Then Me._dOWTableAdapter.Connection = CType(revertConnections(Me._dOWTableAdapter),Global.System.Data.OleDb.OleDbConnection) Me._dOWTableAdapter.Transaction = Nothing End If If (Not (Me._friendsTableAdapter) Is Nothing) Then Me._friendsTableAdapter.Connection = CType(revertConnections(Me._friendsTableAdapter),Global.System.Data.OleDb.OleDbConnection) Me._friendsTableAdapter.Transaction = Nothing End If If (Not (Me._gamesTableAdapter) Is Nothing) Then Me._gamesTableAdapter.Connection = CType(revertConnections(Me._gamesTableAdapter),Global.System.Data.OleDb.OleDbConnection) Me._gamesTableAdapter.Transaction = Nothing End If If (Not (Me._purchasedTableAdapter) Is Nothing) Then Me._purchasedTableAdapter.Connection = CType(revertConnections(Me._purchasedTableAdapter),Global.System.Data.OleDb.OleDbConnection) Me._purchasedTableAdapter.Transaction = Nothing End If If (Not (Me._reviewsTableAdapter) Is Nothing) Then Me._reviewsTableAdapter.Connection = CType(revertConnections(Me._reviewsTableAdapter),Global.System.Data.OleDb.OleDbConnection) Me._reviewsTableAdapter.Transaction = Nothing End If If (Not (Me._tagsTableAdapter) Is Nothing) Then Me._tagsTableAdapter.Connection = CType(revertConnections(Me._tagsTableAdapter),Global.System.Data.OleDb.OleDbConnection) Me._tagsTableAdapter.Transaction = Nothing End If If (Not (Me._user_DetailsTableAdapter) Is Nothing) Then Me._user_DetailsTableAdapter.Connection = CType(revertConnections(Me._user_DetailsTableAdapter),Global.System.Data.OleDb.OleDbConnection) Me._user_DetailsTableAdapter.Transaction = Nothing End If If (Not (Me._usersTableAdapter) Is Nothing) Then Me._usersTableAdapter.Connection = CType(revertConnections(Me._usersTableAdapter),Global.System.Data.OleDb.OleDbConnection) Me._usersTableAdapter.Transaction = Nothing End If If (Not (Me._wishlistTableAdapter) Is Nothing) Then Me._wishlistTableAdapter.Connection = CType(revertConnections(Me._wishlistTableAdapter),Global.System.Data.OleDb.OleDbConnection) Me._wishlistTableAdapter.Transaction = Nothing End If If (0 < adaptersWithAcceptChangesDuringUpdate.Count) Then Dim adapters((adaptersWithAcceptChangesDuringUpdate.Count) - 1) As Global.System.Data.Common.DataAdapter adaptersWithAcceptChangesDuringUpdate.CopyTo(adapters) Dim i As Integer = 0 Do While (i < adapters.Length) Dim adapter As Global.System.Data.Common.DataAdapter = adapters(i) adapter.AcceptChangesDuringUpdate = true i = (i + 1) Loop 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)) End Sub _ Protected Overridable Function MatchTableAdapterConnection(ByVal inputConnection As Global.System.Data.IDbConnection) As Boolean If (Not (Me._connection) Is Nothing) Then Return true End If 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 ''' _ Public Enum UpdateOrderOption InsertUpdateDelete = 0 UpdateInsertDelete = 1 End Enum ''' '''Used to sort self-referenced table's rows ''' _ Private Class SelfReferenceComparer Inherits Object Implements Global.System.Collections.Generic.IComparer(Of Global.System.Data.DataRow) Private _relation As Global.System.Data.DataRelation 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 Else Me._childFirst = 1 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)) 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) root = parent traversedRows(parent) = parent parent = parent.GetParentRow(Me._relation, Global.System.Data.DataRowVersion.[Default]) Loop 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) root = parent traversedRows(parent) = parent parent = parent.GetParentRow(Me._relation, Global.System.Data.DataRowVersion.Original) Loop 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 Return -1 End If 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)) 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 Return -1 Else Return 1 End If End If End Function End Class End Class End Namespace