'------------------------------------------------------------------------------ ' ' Este código fue generado por una herramienta. ' Versión de runtime:4.0.30319.42000 ' ' Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si ' se vuelve a generar el código. ' '------------------------------------------------------------------------------ Option Strict Off Option Explicit On ''' '''Represents a strongly typed in-memory cache of data. ''' _ Partial Public Class dsInversiones Inherits Global.System.Data.DataSet Private tableECALRI As ECALRIDataTable Private tableEMIS As EMISDataTable Private tableEMPR As EMPRDataTable Private tableINFI As INFIDataTable Private tablePAIS As PAISDataTable Private tableSP_InventarioMaster As SP_InventarioMasterDataTable 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("ECALRI")) Is Nothing) Then MyBase.Tables.Add(New ECALRIDataTable(ds.Tables("ECALRI"))) End If If (Not (ds.Tables("EMIS")) Is Nothing) Then MyBase.Tables.Add(New EMISDataTable(ds.Tables("EMIS"))) End If If (Not (ds.Tables("EMPR")) Is Nothing) Then MyBase.Tables.Add(New EMPRDataTable(ds.Tables("EMPR"))) End If If (Not (ds.Tables("INFI")) Is Nothing) Then MyBase.Tables.Add(New INFIDataTable(ds.Tables("INFI"))) End If If (Not (ds.Tables("PAIS")) Is Nothing) Then MyBase.Tables.Add(New PAISDataTable(ds.Tables("PAIS"))) End If If (Not (ds.Tables("SP_InventarioMaster")) Is Nothing) Then MyBase.Tables.Add(New SP_InventarioMasterDataTable(ds.Tables("SP_InventarioMaster"))) 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 ECALRI() As ECALRIDataTable Get Return Me.tableECALRI End Get End Property _ Public ReadOnly Property EMIS() As EMISDataTable Get Return Me.tableEMIS End Get End Property _ Public ReadOnly Property EMPR() As EMPRDataTable Get Return Me.tableEMPR End Get End Property _ Public ReadOnly Property INFI() As INFIDataTable Get Return Me.tableINFI End Get End Property _ Public ReadOnly Property PAIS() As PAISDataTable Get Return Me.tablePAIS End Get End Property _ Public ReadOnly Property SP_InventarioMaster() As SP_InventarioMasterDataTable Get Return Me.tableSP_InventarioMaster 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 dsInversiones = CType(MyBase.Clone,dsInversiones) 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("ECALRI")) Is Nothing) Then MyBase.Tables.Add(New ECALRIDataTable(ds.Tables("ECALRI"))) End If If (Not (ds.Tables("EMIS")) Is Nothing) Then MyBase.Tables.Add(New EMISDataTable(ds.Tables("EMIS"))) End If If (Not (ds.Tables("EMPR")) Is Nothing) Then MyBase.Tables.Add(New EMPRDataTable(ds.Tables("EMPR"))) End If If (Not (ds.Tables("INFI")) Is Nothing) Then MyBase.Tables.Add(New INFIDataTable(ds.Tables("INFI"))) End If If (Not (ds.Tables("PAIS")) Is Nothing) Then MyBase.Tables.Add(New PAISDataTable(ds.Tables("PAIS"))) End If If (Not (ds.Tables("SP_InventarioMaster")) Is Nothing) Then MyBase.Tables.Add(New SP_InventarioMasterDataTable(ds.Tables("SP_InventarioMaster"))) 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.tableECALRI = CType(MyBase.Tables("ECALRI"),ECALRIDataTable) If (initTable = true) Then If (Not (Me.tableECALRI) Is Nothing) Then Me.tableECALRI.InitVars End If End If Me.tableEMIS = CType(MyBase.Tables("EMIS"),EMISDataTable) If (initTable = true) Then If (Not (Me.tableEMIS) Is Nothing) Then Me.tableEMIS.InitVars End If End If Me.tableEMPR = CType(MyBase.Tables("EMPR"),EMPRDataTable) If (initTable = true) Then If (Not (Me.tableEMPR) Is Nothing) Then Me.tableEMPR.InitVars End If End If Me.tableINFI = CType(MyBase.Tables("INFI"),INFIDataTable) If (initTable = true) Then If (Not (Me.tableINFI) Is Nothing) Then Me.tableINFI.InitVars End If End If Me.tablePAIS = CType(MyBase.Tables("PAIS"),PAISDataTable) If (initTable = true) Then If (Not (Me.tablePAIS) Is Nothing) Then Me.tablePAIS.InitVars End If End If Me.tableSP_InventarioMaster = CType(MyBase.Tables("SP_InventarioMaster"),SP_InventarioMasterDataTable) If (initTable = true) Then If (Not (Me.tableSP_InventarioMaster) Is Nothing) Then Me.tableSP_InventarioMaster.InitVars End If End If End Sub _ Private Sub InitClass() Me.DataSetName = "dsInversiones" Me.Prefix = "" Me.Namespace = "http://tempuri.org/dsInversiones.xsd" Me.EnforceConstraints = true Me.SchemaSerializationMode = Global.System.Data.SchemaSerializationMode.IncludeSchema Me.tableECALRI = New ECALRIDataTable() MyBase.Tables.Add(Me.tableECALRI) Me.tableEMIS = New EMISDataTable() MyBase.Tables.Add(Me.tableEMIS) Me.tableEMPR = New EMPRDataTable() MyBase.Tables.Add(Me.tableEMPR) Me.tableINFI = New INFIDataTable() MyBase.Tables.Add(Me.tableINFI) Me.tablePAIS = New PAISDataTable() MyBase.Tables.Add(Me.tablePAIS) Me.tableSP_InventarioMaster = New SP_InventarioMasterDataTable() MyBase.Tables.Add(Me.tableSP_InventarioMaster) End Sub _ Private Function ShouldSerializeECALRI() As Boolean Return false End Function _ Private Function ShouldSerializeEMIS() As Boolean Return false End Function _ Private Function ShouldSerializeEMPR() As Boolean Return false End Function _ Private Function ShouldSerializeINFI() As Boolean Return false End Function _ Private Function ShouldSerializePAIS() As Boolean Return false End Function _ Private Function ShouldSerializeSP_InventarioMaster() 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 dsInversiones = New dsInversiones() 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 ECALRIRowChangeEventHandler(ByVal sender As Object, ByVal e As ECALRIRowChangeEvent) _ Public Delegate Sub EMISRowChangeEventHandler(ByVal sender As Object, ByVal e As EMISRowChangeEvent) _ Public Delegate Sub EMPRRowChangeEventHandler(ByVal sender As Object, ByVal e As EMPRRowChangeEvent) _ Public Delegate Sub INFIRowChangeEventHandler(ByVal sender As Object, ByVal e As INFIRowChangeEvent) _ Public Delegate Sub PAISRowChangeEventHandler(ByVal sender As Object, ByVal e As PAISRowChangeEvent) _ Public Delegate Sub SP_InventarioMasterRowChangeEventHandler(ByVal sender As Object, ByVal e As SP_InventarioMasterRowChangeEvent) ''' '''Represents the strongly named DataTable class. ''' _ Partial Public Class ECALRIDataTable Inherits Global.System.Data.TypedTableBase(Of ECALRIRow) Private columnCodECalRi As Global.System.Data.DataColumn Private columnDescrip As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "ECALRI" 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 CodECalRiColumn() As Global.System.Data.DataColumn Get Return Me.columnCodECalRi End Get End Property _ Public ReadOnly Property DescripColumn() As Global.System.Data.DataColumn Get Return Me.columnDescrip 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 ECALRIRow Get Return CType(Me.Rows(index),ECALRIRow) End Get End Property _ Public Event ECALRIRowChanging As ECALRIRowChangeEventHandler _ Public Event ECALRIRowChanged As ECALRIRowChangeEventHandler _ Public Event ECALRIRowDeleting As ECALRIRowChangeEventHandler _ Public Event ECALRIRowDeleted As ECALRIRowChangeEventHandler _ Public Overloads Sub AddECALRIRow(ByVal row As ECALRIRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddECALRIRow(ByVal CodECalRi As String, ByVal Descrip As String) As ECALRIRow Dim rowECALRIRow As ECALRIRow = CType(Me.NewRow,ECALRIRow) Dim columnValuesArray() As Object = New Object() {CodECalRi, Descrip} rowECALRIRow.ItemArray = columnValuesArray Me.Rows.Add(rowECALRIRow) Return rowECALRIRow End Function _ Public Function FindByCodECalRi(ByVal CodECalRi As String) As ECALRIRow Return CType(Me.Rows.Find(New Object() {CodECalRi}),ECALRIRow) End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As ECALRIDataTable = CType(MyBase.Clone,ECALRIDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New ECALRIDataTable() End Function _ Friend Sub InitVars() Me.columnCodECalRi = MyBase.Columns("CodECalRi") Me.columnDescrip = MyBase.Columns("Descrip") End Sub _ Private Sub InitClass() Me.columnCodECalRi = New Global.System.Data.DataColumn("CodECalRi", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnCodECalRi) Me.columnDescrip = New Global.System.Data.DataColumn("Descrip", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnDescrip) Me.Constraints.Add(New Global.System.Data.UniqueConstraint("Constraint1", New Global.System.Data.DataColumn() {Me.columnCodECalRi}, true)) Me.columnCodECalRi.AllowDBNull = false Me.columnCodECalRi.Unique = true Me.columnCodECalRi.MaxLength = 8 Me.columnDescrip.MaxLength = 100 End Sub _ Public Function NewECALRIRow() As ECALRIRow Return CType(Me.NewRow,ECALRIRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New ECALRIRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(ECALRIRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.ECALRIRowChangedEvent) Is Nothing) Then RaiseEvent ECALRIRowChanged(Me, New ECALRIRowChangeEvent(CType(e.Row,ECALRIRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.ECALRIRowChangingEvent) Is Nothing) Then RaiseEvent ECALRIRowChanging(Me, New ECALRIRowChangeEvent(CType(e.Row,ECALRIRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.ECALRIRowDeletedEvent) Is Nothing) Then RaiseEvent ECALRIRowDeleted(Me, New ECALRIRowChangeEvent(CType(e.Row,ECALRIRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.ECALRIRowDeletingEvent) Is Nothing) Then RaiseEvent ECALRIRowDeleting(Me, New ECALRIRowChangeEvent(CType(e.Row,ECALRIRow), e.Action)) End If End Sub _ Public Sub RemoveECALRIRow(ByVal row As ECALRIRow) 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 dsInversiones = New dsInversiones() 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 = "ECALRIDataTable" 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 EMISDataTable Inherits Global.System.Data.TypedTableBase(Of EMISRow) Private columnCodEmis As Global.System.Data.DataColumn Private columnDescrip As Global.System.Data.DataColumn Private columnEstado As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "EMIS" 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 CodEmisColumn() As Global.System.Data.DataColumn Get Return Me.columnCodEmis End Get End Property _ Public ReadOnly Property DescripColumn() As Global.System.Data.DataColumn Get Return Me.columnDescrip End Get End Property _ Public ReadOnly Property EstadoColumn() As Global.System.Data.DataColumn Get Return Me.columnEstado 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 EMISRow Get Return CType(Me.Rows(index),EMISRow) End Get End Property _ Public Event EMISRowChanging As EMISRowChangeEventHandler _ Public Event EMISRowChanged As EMISRowChangeEventHandler _ Public Event EMISRowDeleting As EMISRowChangeEventHandler _ Public Event EMISRowDeleted As EMISRowChangeEventHandler _ Public Overloads Sub AddEMISRow(ByVal row As EMISRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddEMISRow(ByVal Descrip As String, ByVal Estado As String) As EMISRow Dim rowEMISRow As EMISRow = CType(Me.NewRow,EMISRow) Dim columnValuesArray() As Object = New Object() {Nothing, Descrip, Estado} rowEMISRow.ItemArray = columnValuesArray Me.Rows.Add(rowEMISRow) Return rowEMISRow End Function _ Public Function FindByCodEmis(ByVal CodEmis As Integer) As EMISRow Return CType(Me.Rows.Find(New Object() {CodEmis}),EMISRow) End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As EMISDataTable = CType(MyBase.Clone,EMISDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New EMISDataTable() End Function _ Friend Sub InitVars() Me.columnCodEmis = MyBase.Columns("CodEmis") Me.columnDescrip = MyBase.Columns("Descrip") Me.columnEstado = MyBase.Columns("Estado") End Sub _ Private Sub InitClass() Me.columnCodEmis = New Global.System.Data.DataColumn("CodEmis", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnCodEmis) Me.columnDescrip = New Global.System.Data.DataColumn("Descrip", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnDescrip) Me.columnEstado = New Global.System.Data.DataColumn("Estado", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnEstado) Me.Constraints.Add(New Global.System.Data.UniqueConstraint("Constraint1", New Global.System.Data.DataColumn() {Me.columnCodEmis}, true)) Me.columnCodEmis.AutoIncrement = true Me.columnCodEmis.AutoIncrementSeed = -1 Me.columnCodEmis.AutoIncrementStep = -1 Me.columnCodEmis.AllowDBNull = false Me.columnCodEmis.ReadOnly = true Me.columnCodEmis.Unique = true Me.columnDescrip.MaxLength = 100 Me.columnEstado.MaxLength = 1 End Sub _ Public Function NewEMISRow() As EMISRow Return CType(Me.NewRow,EMISRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New EMISRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(EMISRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.EMISRowChangedEvent) Is Nothing) Then RaiseEvent EMISRowChanged(Me, New EMISRowChangeEvent(CType(e.Row,EMISRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.EMISRowChangingEvent) Is Nothing) Then RaiseEvent EMISRowChanging(Me, New EMISRowChangeEvent(CType(e.Row,EMISRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.EMISRowDeletedEvent) Is Nothing) Then RaiseEvent EMISRowDeleted(Me, New EMISRowChangeEvent(CType(e.Row,EMISRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.EMISRowDeletingEvent) Is Nothing) Then RaiseEvent EMISRowDeleting(Me, New EMISRowChangeEvent(CType(e.Row,EMISRow), e.Action)) End If End Sub _ Public Sub RemoveEMISRow(ByVal row As EMISRow) 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 dsInversiones = New dsInversiones() 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 = "EMISDataTable" 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 EMPRDataTable Inherits Global.System.Data.TypedTableBase(Of EMPRRow) Private columnCodEmpr As Global.System.Data.DataColumn Private columnDescrip As Global.System.Data.DataColumn Private columnSAP_BD As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "EMPR" 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 CodEmprColumn() As Global.System.Data.DataColumn Get Return Me.columnCodEmpr End Get End Property _ Public ReadOnly Property DescripColumn() As Global.System.Data.DataColumn Get Return Me.columnDescrip End Get End Property _ Public ReadOnly Property SAP_BDColumn() As Global.System.Data.DataColumn Get Return Me.columnSAP_BD 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 EMPRRow Get Return CType(Me.Rows(index),EMPRRow) End Get End Property _ Public Event EMPRRowChanging As EMPRRowChangeEventHandler _ Public Event EMPRRowChanged As EMPRRowChangeEventHandler _ Public Event EMPRRowDeleting As EMPRRowChangeEventHandler _ Public Event EMPRRowDeleted As EMPRRowChangeEventHandler _ Public Overloads Sub AddEMPRRow(ByVal row As EMPRRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddEMPRRow(ByVal CodEmpr As String, ByVal Descrip As String, ByVal SAP_BD As String) As EMPRRow Dim rowEMPRRow As EMPRRow = CType(Me.NewRow,EMPRRow) Dim columnValuesArray() As Object = New Object() {CodEmpr, Descrip, SAP_BD} rowEMPRRow.ItemArray = columnValuesArray Me.Rows.Add(rowEMPRRow) Return rowEMPRRow End Function _ Public Function FindByCodEmpr(ByVal CodEmpr As String) As EMPRRow Return CType(Me.Rows.Find(New Object() {CodEmpr}),EMPRRow) End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As EMPRDataTable = CType(MyBase.Clone,EMPRDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New EMPRDataTable() End Function _ Friend Sub InitVars() Me.columnCodEmpr = MyBase.Columns("CodEmpr") Me.columnDescrip = MyBase.Columns("Descrip") Me.columnSAP_BD = MyBase.Columns("SAP_BD") End Sub _ Private Sub InitClass() Me.columnCodEmpr = New Global.System.Data.DataColumn("CodEmpr", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnCodEmpr) Me.columnDescrip = New Global.System.Data.DataColumn("Descrip", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnDescrip) Me.columnSAP_BD = New Global.System.Data.DataColumn("SAP_BD", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnSAP_BD) Me.Constraints.Add(New Global.System.Data.UniqueConstraint("Constraint1", New Global.System.Data.DataColumn() {Me.columnCodEmpr}, true)) Me.columnCodEmpr.AllowDBNull = false Me.columnCodEmpr.Unique = true Me.columnCodEmpr.MaxLength = 10 Me.columnDescrip.MaxLength = 100 Me.columnSAP_BD.MaxLength = 50 End Sub _ Public Function NewEMPRRow() As EMPRRow Return CType(Me.NewRow,EMPRRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New EMPRRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(EMPRRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.EMPRRowChangedEvent) Is Nothing) Then RaiseEvent EMPRRowChanged(Me, New EMPRRowChangeEvent(CType(e.Row,EMPRRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.EMPRRowChangingEvent) Is Nothing) Then RaiseEvent EMPRRowChanging(Me, New EMPRRowChangeEvent(CType(e.Row,EMPRRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.EMPRRowDeletedEvent) Is Nothing) Then RaiseEvent EMPRRowDeleted(Me, New EMPRRowChangeEvent(CType(e.Row,EMPRRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.EMPRRowDeletingEvent) Is Nothing) Then RaiseEvent EMPRRowDeleting(Me, New EMPRRowChangeEvent(CType(e.Row,EMPRRow), e.Action)) End If End Sub _ Public Sub RemoveEMPRRow(ByVal row As EMPRRow) 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 dsInversiones = New dsInversiones() 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 = "EMPRDataTable" 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 INFIDataTable Inherits Global.System.Data.TypedTableBase(Of INFIRow) Private columnCodIF As Global.System.Data.DataColumn Private columnDescrip As Global.System.Data.DataColumn Private columnTipo As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "INFI" 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 CodIFColumn() As Global.System.Data.DataColumn Get Return Me.columnCodIF End Get End Property _ Public ReadOnly Property DescripColumn() As Global.System.Data.DataColumn Get Return Me.columnDescrip End Get End Property _ Public ReadOnly Property TipoColumn() As Global.System.Data.DataColumn Get Return Me.columnTipo 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 INFIRow Get Return CType(Me.Rows(index),INFIRow) End Get End Property _ Public Event INFIRowChanging As INFIRowChangeEventHandler _ Public Event INFIRowChanged As INFIRowChangeEventHandler _ Public Event INFIRowDeleting As INFIRowChangeEventHandler _ Public Event INFIRowDeleted As INFIRowChangeEventHandler _ Public Overloads Sub AddINFIRow(ByVal row As INFIRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddINFIRow(ByVal CodIF As String, ByVal Descrip As String, ByVal Tipo As String) As INFIRow Dim rowINFIRow As INFIRow = CType(Me.NewRow,INFIRow) Dim columnValuesArray() As Object = New Object() {CodIF, Descrip, Tipo} rowINFIRow.ItemArray = columnValuesArray Me.Rows.Add(rowINFIRow) Return rowINFIRow End Function _ Public Function FindByCodIF(ByVal CodIF As String) As INFIRow Return CType(Me.Rows.Find(New Object() {CodIF}),INFIRow) End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As INFIDataTable = CType(MyBase.Clone,INFIDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New INFIDataTable() End Function _ Friend Sub InitVars() Me.columnCodIF = MyBase.Columns("CodIF") Me.columnDescrip = MyBase.Columns("Descrip") Me.columnTipo = MyBase.Columns("Tipo") End Sub _ Private Sub InitClass() Me.columnCodIF = New Global.System.Data.DataColumn("CodIF", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnCodIF) Me.columnDescrip = New Global.System.Data.DataColumn("Descrip", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnDescrip) Me.columnTipo = New Global.System.Data.DataColumn("Tipo", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnTipo) Me.Constraints.Add(New Global.System.Data.UniqueConstraint("Constraint1", New Global.System.Data.DataColumn() {Me.columnCodIF}, true)) Me.columnCodIF.AllowDBNull = false Me.columnCodIF.Unique = true Me.columnCodIF.MaxLength = 10 Me.columnDescrip.MaxLength = 50 Me.columnTipo.MaxLength = 10 End Sub _ Public Function NewINFIRow() As INFIRow Return CType(Me.NewRow,INFIRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New INFIRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(INFIRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.INFIRowChangedEvent) Is Nothing) Then RaiseEvent INFIRowChanged(Me, New INFIRowChangeEvent(CType(e.Row,INFIRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.INFIRowChangingEvent) Is Nothing) Then RaiseEvent INFIRowChanging(Me, New INFIRowChangeEvent(CType(e.Row,INFIRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.INFIRowDeletedEvent) Is Nothing) Then RaiseEvent INFIRowDeleted(Me, New INFIRowChangeEvent(CType(e.Row,INFIRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.INFIRowDeletingEvent) Is Nothing) Then RaiseEvent INFIRowDeleting(Me, New INFIRowChangeEvent(CType(e.Row,INFIRow), e.Action)) End If End Sub _ Public Sub RemoveINFIRow(ByVal row As INFIRow) 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 dsInversiones = New dsInversiones() 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 = "INFIDataTable" 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 PAISDataTable Inherits Global.System.Data.TypedTableBase(Of PAISRow) Private columnCodPais As Global.System.Data.DataColumn Private columnDescrip As Global.System.Data.DataColumn Private columnRelInv As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "PAIS" 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 CodPaisColumn() As Global.System.Data.DataColumn Get Return Me.columnCodPais End Get End Property _ Public ReadOnly Property DescripColumn() As Global.System.Data.DataColumn Get Return Me.columnDescrip End Get End Property _ Public ReadOnly Property RelInvColumn() As Global.System.Data.DataColumn Get Return Me.columnRelInv 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 PAISRow Get Return CType(Me.Rows(index),PAISRow) End Get End Property _ Public Event PAISRowChanging As PAISRowChangeEventHandler _ Public Event PAISRowChanged As PAISRowChangeEventHandler _ Public Event PAISRowDeleting As PAISRowChangeEventHandler _ Public Event PAISRowDeleted As PAISRowChangeEventHandler _ Public Overloads Sub AddPAISRow(ByVal row As PAISRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddPAISRow(ByVal CodPais As String, ByVal Descrip As String, ByVal RelInv As String) As PAISRow Dim rowPAISRow As PAISRow = CType(Me.NewRow,PAISRow) Dim columnValuesArray() As Object = New Object() {CodPais, Descrip, RelInv} rowPAISRow.ItemArray = columnValuesArray Me.Rows.Add(rowPAISRow) Return rowPAISRow End Function _ Public Function FindByCodPais(ByVal CodPais As String) As PAISRow Return CType(Me.Rows.Find(New Object() {CodPais}),PAISRow) End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As PAISDataTable = CType(MyBase.Clone,PAISDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New PAISDataTable() End Function _ Friend Sub InitVars() Me.columnCodPais = MyBase.Columns("CodPais") Me.columnDescrip = MyBase.Columns("Descrip") Me.columnRelInv = MyBase.Columns("RelInv") End Sub _ Private Sub InitClass() Me.columnCodPais = New Global.System.Data.DataColumn("CodPais", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnCodPais) Me.columnDescrip = New Global.System.Data.DataColumn("Descrip", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnDescrip) Me.columnRelInv = New Global.System.Data.DataColumn("RelInv", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnRelInv) Me.Constraints.Add(New Global.System.Data.UniqueConstraint("Constraint1", New Global.System.Data.DataColumn() {Me.columnCodPais}, true)) Me.columnCodPais.AllowDBNull = false Me.columnCodPais.Unique = true Me.columnCodPais.MaxLength = 3 Me.columnDescrip.MaxLength = 50 Me.columnRelInv.MaxLength = 1 End Sub _ Public Function NewPAISRow() As PAISRow Return CType(Me.NewRow,PAISRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New PAISRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(PAISRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.PAISRowChangedEvent) Is Nothing) Then RaiseEvent PAISRowChanged(Me, New PAISRowChangeEvent(CType(e.Row,PAISRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.PAISRowChangingEvent) Is Nothing) Then RaiseEvent PAISRowChanging(Me, New PAISRowChangeEvent(CType(e.Row,PAISRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.PAISRowDeletedEvent) Is Nothing) Then RaiseEvent PAISRowDeleted(Me, New PAISRowChangeEvent(CType(e.Row,PAISRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.PAISRowDeletingEvent) Is Nothing) Then RaiseEvent PAISRowDeleting(Me, New PAISRowChangeEvent(CType(e.Row,PAISRow), e.Action)) End If End Sub _ Public Sub RemovePAISRow(ByVal row As PAISRow) 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 dsInversiones = New dsInversiones() 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 = "PAISDataTable" 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 SP_InventarioMasterDataTable Inherits Global.System.Data.TypedTableBase(Of SP_InventarioMasterRow) Private columnCodInv As Global.System.Data.DataColumn Private columnCodIF As Global.System.Data.DataColumn Private columnEstado As Global.System.Data.DataColumn Private columnCodEmpr As Global.System.Data.DataColumn Private columnNombreManIF As Global.System.Data.DataColumn Private columnCodManIF As Global.System.Data.DataColumn Private columnCodEmis As Global.System.Data.DataColumn Private columniCasaBanco As Global.System.Data.DataColumn Private columnvCasaBanco As Global.System.Data.DataColumn Private columnTipoMerc As Global.System.Data.DataColumn Private columnCodCalRi As Global.System.Data.DataColumn Private columnCodECalRi As Global.System.Data.DataColumn Private columnValorNominal As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "SP_InventarioMaster" 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 CodInvColumn() As Global.System.Data.DataColumn Get Return Me.columnCodInv End Get End Property _ Public ReadOnly Property CodIFColumn() As Global.System.Data.DataColumn Get Return Me.columnCodIF End Get End Property _ Public ReadOnly Property EstadoColumn() As Global.System.Data.DataColumn Get Return Me.columnEstado End Get End Property _ Public ReadOnly Property CodEmprColumn() As Global.System.Data.DataColumn Get Return Me.columnCodEmpr End Get End Property _ Public ReadOnly Property NombreManIFColumn() As Global.System.Data.DataColumn Get Return Me.columnNombreManIF End Get End Property _ Public ReadOnly Property CodManIFColumn() As Global.System.Data.DataColumn Get Return Me.columnCodManIF End Get End Property _ Public ReadOnly Property CodEmisColumn() As Global.System.Data.DataColumn Get Return Me.columnCodEmis End Get End Property _ Public ReadOnly Property iCasaBancoColumn() As Global.System.Data.DataColumn Get Return Me.columniCasaBanco End Get End Property _ Public ReadOnly Property vCasaBancoColumn() As Global.System.Data.DataColumn Get Return Me.columnvCasaBanco End Get End Property _ Public ReadOnly Property TipoMercColumn() As Global.System.Data.DataColumn Get Return Me.columnTipoMerc End Get End Property _ Public ReadOnly Property CodCalRiColumn() As Global.System.Data.DataColumn Get Return Me.columnCodCalRi End Get End Property _ Public ReadOnly Property CodECalRiColumn() As Global.System.Data.DataColumn Get Return Me.columnCodECalRi End Get End Property _ Public ReadOnly Property ValorNominalColumn() As Global.System.Data.DataColumn Get Return Me.columnValorNominal 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 SP_InventarioMasterRow Get Return CType(Me.Rows(index),SP_InventarioMasterRow) End Get End Property _ Public Event SP_InventarioMasterRowChanging As SP_InventarioMasterRowChangeEventHandler _ Public Event SP_InventarioMasterRowChanged As SP_InventarioMasterRowChangeEventHandler _ Public Event SP_InventarioMasterRowDeleting As SP_InventarioMasterRowChangeEventHandler _ Public Event SP_InventarioMasterRowDeleted As SP_InventarioMasterRowChangeEventHandler _ Public Overloads Sub AddSP_InventarioMasterRow(ByVal row As SP_InventarioMasterRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddSP_InventarioMasterRow(ByVal CodInv As String, ByVal CodIF As String, ByVal Estado As String, ByVal CodEmpr As String, ByVal NombreManIF As String, ByVal CodManIF As String, ByVal CodEmis As Integer, ByVal iCasaBanco As String, ByVal vCasaBanco As String, ByVal TipoMerc As String, ByVal CodCalRi As String, ByVal CodECalRi As String, ByVal ValorNominal As Decimal) As SP_InventarioMasterRow Dim rowSP_InventarioMasterRow As SP_InventarioMasterRow = CType(Me.NewRow,SP_InventarioMasterRow) Dim columnValuesArray() As Object = New Object() {CodInv, CodIF, Estado, CodEmpr, NombreManIF, CodManIF, CodEmis, iCasaBanco, vCasaBanco, TipoMerc, CodCalRi, CodECalRi, ValorNominal} rowSP_InventarioMasterRow.ItemArray = columnValuesArray Me.Rows.Add(rowSP_InventarioMasterRow) Return rowSP_InventarioMasterRow End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As SP_InventarioMasterDataTable = CType(MyBase.Clone,SP_InventarioMasterDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New SP_InventarioMasterDataTable() End Function _ Friend Sub InitVars() Me.columnCodInv = MyBase.Columns("CodInv") Me.columnCodIF = MyBase.Columns("CodIF") Me.columnEstado = MyBase.Columns("Estado") Me.columnCodEmpr = MyBase.Columns("CodEmpr") Me.columnNombreManIF = MyBase.Columns("NombreManIF") Me.columnCodManIF = MyBase.Columns("CodManIF") Me.columnCodEmis = MyBase.Columns("CodEmis") Me.columniCasaBanco = MyBase.Columns("iCasaBanco") Me.columnvCasaBanco = MyBase.Columns("vCasaBanco") Me.columnTipoMerc = MyBase.Columns("TipoMerc") Me.columnCodCalRi = MyBase.Columns("CodCalRi") Me.columnCodECalRi = MyBase.Columns("CodECalRi") Me.columnValorNominal = MyBase.Columns("ValorNominal") End Sub _ Private Sub InitClass() Me.columnCodInv = New Global.System.Data.DataColumn("CodInv", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnCodInv) Me.columnCodIF = New Global.System.Data.DataColumn("CodIF", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnCodIF) Me.columnEstado = New Global.System.Data.DataColumn("Estado", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnEstado) Me.columnCodEmpr = New Global.System.Data.DataColumn("CodEmpr", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnCodEmpr) Me.columnNombreManIF = New Global.System.Data.DataColumn("NombreManIF", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnNombreManIF) Me.columnCodManIF = New Global.System.Data.DataColumn("CodManIF", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnCodManIF) Me.columnCodEmis = New Global.System.Data.DataColumn("CodEmis", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnCodEmis) Me.columniCasaBanco = New Global.System.Data.DataColumn("iCasaBanco", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columniCasaBanco) Me.columnvCasaBanco = New Global.System.Data.DataColumn("vCasaBanco", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnvCasaBanco) Me.columnTipoMerc = New Global.System.Data.DataColumn("TipoMerc", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnTipoMerc) Me.columnCodCalRi = New Global.System.Data.DataColumn("CodCalRi", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnCodCalRi) Me.columnCodECalRi = New Global.System.Data.DataColumn("CodECalRi", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnCodECalRi) Me.columnValorNominal = New Global.System.Data.DataColumn("ValorNominal", GetType(Decimal), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnValorNominal) Me.columnCodInv.MaxLength = 20 Me.columnCodIF.MaxLength = 10 Me.columnEstado.MaxLength = 4 Me.columnCodEmpr.MaxLength = 10 Me.columnNombreManIF.MaxLength = 50 Me.columnCodManIF.MaxLength = 50 Me.columniCasaBanco.MaxLength = 1 Me.columnvCasaBanco.MaxLength = 10 Me.columnTipoMerc.MaxLength = 4 Me.columnCodCalRi.MaxLength = 8 Me.columnCodECalRi.MaxLength = 8 End Sub _ Public Function NewSP_InventarioMasterRow() As SP_InventarioMasterRow Return CType(Me.NewRow,SP_InventarioMasterRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New SP_InventarioMasterRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(SP_InventarioMasterRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.SP_InventarioMasterRowChangedEvent) Is Nothing) Then RaiseEvent SP_InventarioMasterRowChanged(Me, New SP_InventarioMasterRowChangeEvent(CType(e.Row,SP_InventarioMasterRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.SP_InventarioMasterRowChangingEvent) Is Nothing) Then RaiseEvent SP_InventarioMasterRowChanging(Me, New SP_InventarioMasterRowChangeEvent(CType(e.Row,SP_InventarioMasterRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.SP_InventarioMasterRowDeletedEvent) Is Nothing) Then RaiseEvent SP_InventarioMasterRowDeleted(Me, New SP_InventarioMasterRowChangeEvent(CType(e.Row,SP_InventarioMasterRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.SP_InventarioMasterRowDeletingEvent) Is Nothing) Then RaiseEvent SP_InventarioMasterRowDeleting(Me, New SP_InventarioMasterRowChangeEvent(CType(e.Row,SP_InventarioMasterRow), e.Action)) End If End Sub _ Public Sub RemoveSP_InventarioMasterRow(ByVal row As SP_InventarioMasterRow) 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 dsInversiones = New dsInversiones() 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 = "SP_InventarioMasterDataTable" 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 ECALRIRow Inherits Global.System.Data.DataRow Private tableECALRI As ECALRIDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tableECALRI = CType(Me.Table,ECALRIDataTable) End Sub _ Public Property CodECalRi() As String Get Return CType(Me(Me.tableECALRI.CodECalRiColumn),String) End Get Set Me(Me.tableECALRI.CodECalRiColumn) = value End Set End Property _ Public Property Descrip() As String Get Try Return CType(Me(Me.tableECALRI.DescripColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'Descrip' de la tabla 'ECALRI' es DBNull.", e) End Try End Get Set Me(Me.tableECALRI.DescripColumn) = value End Set End Property _ Public Function IsDescripNull() As Boolean Return Me.IsNull(Me.tableECALRI.DescripColumn) End Function _ Public Sub SetDescripNull() Me(Me.tableECALRI.DescripColumn) = Global.System.Convert.DBNull End Sub End Class ''' '''Represents strongly named DataRow class. ''' Partial Public Class EMISRow Inherits Global.System.Data.DataRow Private tableEMIS As EMISDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tableEMIS = CType(Me.Table,EMISDataTable) End Sub _ Public Property CodEmis() As Integer Get Return CType(Me(Me.tableEMIS.CodEmisColumn),Integer) End Get Set Me(Me.tableEMIS.CodEmisColumn) = value End Set End Property _ Public Property Descrip() As String Get Try Return CType(Me(Me.tableEMIS.DescripColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'Descrip' de la tabla 'EMIS' es DBNull.", e) End Try End Get Set Me(Me.tableEMIS.DescripColumn) = value End Set End Property _ Public Property Estado() As String Get Try Return CType(Me(Me.tableEMIS.EstadoColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'Estado' de la tabla 'EMIS' es DBNull.", e) End Try End Get Set Me(Me.tableEMIS.EstadoColumn) = value End Set End Property _ Public Function IsDescripNull() As Boolean Return Me.IsNull(Me.tableEMIS.DescripColumn) End Function _ Public Sub SetDescripNull() Me(Me.tableEMIS.DescripColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsEstadoNull() As Boolean Return Me.IsNull(Me.tableEMIS.EstadoColumn) End Function _ Public Sub SetEstadoNull() Me(Me.tableEMIS.EstadoColumn) = Global.System.Convert.DBNull End Sub End Class ''' '''Represents strongly named DataRow class. ''' Partial Public Class EMPRRow Inherits Global.System.Data.DataRow Private tableEMPR As EMPRDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tableEMPR = CType(Me.Table,EMPRDataTable) End Sub _ Public Property CodEmpr() As String Get Return CType(Me(Me.tableEMPR.CodEmprColumn),String) End Get Set Me(Me.tableEMPR.CodEmprColumn) = value End Set End Property _ Public Property Descrip() As String Get Try Return CType(Me(Me.tableEMPR.DescripColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'Descrip' de la tabla 'EMPR' es DBNull.", e) End Try End Get Set Me(Me.tableEMPR.DescripColumn) = value End Set End Property _ Public Property SAP_BD() As String Get Try Return CType(Me(Me.tableEMPR.SAP_BDColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'SAP_BD' de la tabla 'EMPR' es DBNull.", e) End Try End Get Set Me(Me.tableEMPR.SAP_BDColumn) = value End Set End Property _ Public Function IsDescripNull() As Boolean Return Me.IsNull(Me.tableEMPR.DescripColumn) End Function _ Public Sub SetDescripNull() Me(Me.tableEMPR.DescripColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsSAP_BDNull() As Boolean Return Me.IsNull(Me.tableEMPR.SAP_BDColumn) End Function _ Public Sub SetSAP_BDNull() Me(Me.tableEMPR.SAP_BDColumn) = Global.System.Convert.DBNull End Sub End Class ''' '''Represents strongly named DataRow class. ''' Partial Public Class INFIRow Inherits Global.System.Data.DataRow Private tableINFI As INFIDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tableINFI = CType(Me.Table,INFIDataTable) End Sub _ Public Property CodIF() As String Get Return CType(Me(Me.tableINFI.CodIFColumn),String) End Get Set Me(Me.tableINFI.CodIFColumn) = value End Set End Property _ Public Property Descrip() As String Get Try Return CType(Me(Me.tableINFI.DescripColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'Descrip' de la tabla 'INFI' es DBNull.", e) End Try End Get Set Me(Me.tableINFI.DescripColumn) = value End Set End Property _ Public Property Tipo() As String Get Try Return CType(Me(Me.tableINFI.TipoColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'Tipo' de la tabla 'INFI' es DBNull.", e) End Try End Get Set Me(Me.tableINFI.TipoColumn) = value End Set End Property _ Public Function IsDescripNull() As Boolean Return Me.IsNull(Me.tableINFI.DescripColumn) End Function _ Public Sub SetDescripNull() Me(Me.tableINFI.DescripColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsTipoNull() As Boolean Return Me.IsNull(Me.tableINFI.TipoColumn) End Function _ Public Sub SetTipoNull() Me(Me.tableINFI.TipoColumn) = Global.System.Convert.DBNull End Sub End Class ''' '''Represents strongly named DataRow class. ''' Partial Public Class PAISRow Inherits Global.System.Data.DataRow Private tablePAIS As PAISDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tablePAIS = CType(Me.Table,PAISDataTable) End Sub _ Public Property CodPais() As String Get Return CType(Me(Me.tablePAIS.CodPaisColumn),String) End Get Set Me(Me.tablePAIS.CodPaisColumn) = value End Set End Property _ Public Property Descrip() As String Get Try Return CType(Me(Me.tablePAIS.DescripColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'Descrip' de la tabla 'PAIS' es DBNull.", e) End Try End Get Set Me(Me.tablePAIS.DescripColumn) = value End Set End Property _ Public Property RelInv() As String Get Try Return CType(Me(Me.tablePAIS.RelInvColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'RelInv' de la tabla 'PAIS' es DBNull.", e) End Try End Get Set Me(Me.tablePAIS.RelInvColumn) = value End Set End Property _ Public Function IsDescripNull() As Boolean Return Me.IsNull(Me.tablePAIS.DescripColumn) End Function _ Public Sub SetDescripNull() Me(Me.tablePAIS.DescripColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsRelInvNull() As Boolean Return Me.IsNull(Me.tablePAIS.RelInvColumn) End Function _ Public Sub SetRelInvNull() Me(Me.tablePAIS.RelInvColumn) = Global.System.Convert.DBNull End Sub End Class ''' '''Represents strongly named DataRow class. ''' Partial Public Class SP_InventarioMasterRow Inherits Global.System.Data.DataRow Private tableSP_InventarioMaster As SP_InventarioMasterDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tableSP_InventarioMaster = CType(Me.Table,SP_InventarioMasterDataTable) End Sub _ Public Property CodInv() As String Get Try Return CType(Me(Me.tableSP_InventarioMaster.CodInvColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'CodInv' de la tabla 'SP_InventarioMaster' es DBNull.", e) End Try End Get Set Me(Me.tableSP_InventarioMaster.CodInvColumn) = value End Set End Property _ Public Property CodIF() As String Get Try Return CType(Me(Me.tableSP_InventarioMaster.CodIFColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'CodIF' de la tabla 'SP_InventarioMaster' es DBNull.", e) End Try End Get Set Me(Me.tableSP_InventarioMaster.CodIFColumn) = value End Set End Property _ Public Property Estado() As String Get Try Return CType(Me(Me.tableSP_InventarioMaster.EstadoColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'Estado' de la tabla 'SP_InventarioMaster' es DBNull.", e) End Try End Get Set Me(Me.tableSP_InventarioMaster.EstadoColumn) = value End Set End Property _ Public Property CodEmpr() As String Get Try Return CType(Me(Me.tableSP_InventarioMaster.CodEmprColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'CodEmpr' de la tabla 'SP_InventarioMaster' es DBNull.", e) End Try End Get Set Me(Me.tableSP_InventarioMaster.CodEmprColumn) = value End Set End Property _ Public Property NombreManIF() As String Get Try Return CType(Me(Me.tableSP_InventarioMaster.NombreManIFColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'NombreManIF' de la tabla 'SP_InventarioMaster' es DBNull."& _ "", e) End Try End Get Set Me(Me.tableSP_InventarioMaster.NombreManIFColumn) = value End Set End Property _ Public Property CodManIF() As String Get Try Return CType(Me(Me.tableSP_InventarioMaster.CodManIFColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'CodManIF' de la tabla 'SP_InventarioMaster' es DBNull.", e) End Try End Get Set Me(Me.tableSP_InventarioMaster.CodManIFColumn) = value End Set End Property _ Public Property CodEmis() As Integer Get Try Return CType(Me(Me.tableSP_InventarioMaster.CodEmisColumn),Integer) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'CodEmis' de la tabla 'SP_InventarioMaster' es DBNull.", e) End Try End Get Set Me(Me.tableSP_InventarioMaster.CodEmisColumn) = value End Set End Property _ Public Property iCasaBanco() As String Get Try Return CType(Me(Me.tableSP_InventarioMaster.iCasaBancoColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'iCasaBanco' de la tabla 'SP_InventarioMaster' es DBNull.", e) End Try End Get Set Me(Me.tableSP_InventarioMaster.iCasaBancoColumn) = value End Set End Property _ Public Property vCasaBanco() As String Get Try Return CType(Me(Me.tableSP_InventarioMaster.vCasaBancoColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'vCasaBanco' de la tabla 'SP_InventarioMaster' es DBNull.", e) End Try End Get Set Me(Me.tableSP_InventarioMaster.vCasaBancoColumn) = value End Set End Property _ Public Property TipoMerc() As String Get Try Return CType(Me(Me.tableSP_InventarioMaster.TipoMercColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'TipoMerc' de la tabla 'SP_InventarioMaster' es DBNull.", e) End Try End Get Set Me(Me.tableSP_InventarioMaster.TipoMercColumn) = value End Set End Property _ Public Property CodCalRi() As String Get Try Return CType(Me(Me.tableSP_InventarioMaster.CodCalRiColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'CodCalRi' de la tabla 'SP_InventarioMaster' es DBNull.", e) End Try End Get Set Me(Me.tableSP_InventarioMaster.CodCalRiColumn) = value End Set End Property _ Public Property CodECalRi() As String Get Try Return CType(Me(Me.tableSP_InventarioMaster.CodECalRiColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'CodECalRi' de la tabla 'SP_InventarioMaster' es DBNull.", e) End Try End Get Set Me(Me.tableSP_InventarioMaster.CodECalRiColumn) = value End Set End Property _ Public Property ValorNominal() As Decimal Get Try Return CType(Me(Me.tableSP_InventarioMaster.ValorNominalColumn),Decimal) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("El valor de la columna 'ValorNominal' de la tabla 'SP_InventarioMaster' es DBNull"& _ ".", e) End Try End Get Set Me(Me.tableSP_InventarioMaster.ValorNominalColumn) = value End Set End Property _ Public Function IsCodInvNull() As Boolean Return Me.IsNull(Me.tableSP_InventarioMaster.CodInvColumn) End Function _ Public Sub SetCodInvNull() Me(Me.tableSP_InventarioMaster.CodInvColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsCodIFNull() As Boolean Return Me.IsNull(Me.tableSP_InventarioMaster.CodIFColumn) End Function _ Public Sub SetCodIFNull() Me(Me.tableSP_InventarioMaster.CodIFColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsEstadoNull() As Boolean Return Me.IsNull(Me.tableSP_InventarioMaster.EstadoColumn) End Function _ Public Sub SetEstadoNull() Me(Me.tableSP_InventarioMaster.EstadoColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsCodEmprNull() As Boolean Return Me.IsNull(Me.tableSP_InventarioMaster.CodEmprColumn) End Function _ Public Sub SetCodEmprNull() Me(Me.tableSP_InventarioMaster.CodEmprColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsNombreManIFNull() As Boolean Return Me.IsNull(Me.tableSP_InventarioMaster.NombreManIFColumn) End Function _ Public Sub SetNombreManIFNull() Me(Me.tableSP_InventarioMaster.NombreManIFColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsCodManIFNull() As Boolean Return Me.IsNull(Me.tableSP_InventarioMaster.CodManIFColumn) End Function _ Public Sub SetCodManIFNull() Me(Me.tableSP_InventarioMaster.CodManIFColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsCodEmisNull() As Boolean Return Me.IsNull(Me.tableSP_InventarioMaster.CodEmisColumn) End Function _ Public Sub SetCodEmisNull() Me(Me.tableSP_InventarioMaster.CodEmisColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsiCasaBancoNull() As Boolean Return Me.IsNull(Me.tableSP_InventarioMaster.iCasaBancoColumn) End Function _ Public Sub SetiCasaBancoNull() Me(Me.tableSP_InventarioMaster.iCasaBancoColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsvCasaBancoNull() As Boolean Return Me.IsNull(Me.tableSP_InventarioMaster.vCasaBancoColumn) End Function _ Public Sub SetvCasaBancoNull() Me(Me.tableSP_InventarioMaster.vCasaBancoColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsTipoMercNull() As Boolean Return Me.IsNull(Me.tableSP_InventarioMaster.TipoMercColumn) End Function _ Public Sub SetTipoMercNull() Me(Me.tableSP_InventarioMaster.TipoMercColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsCodCalRiNull() As Boolean Return Me.IsNull(Me.tableSP_InventarioMaster.CodCalRiColumn) End Function _ Public Sub SetCodCalRiNull() Me(Me.tableSP_InventarioMaster.CodCalRiColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsCodECalRiNull() As Boolean Return Me.IsNull(Me.tableSP_InventarioMaster.CodECalRiColumn) End Function _ Public Sub SetCodECalRiNull() Me(Me.tableSP_InventarioMaster.CodECalRiColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsValorNominalNull() As Boolean Return Me.IsNull(Me.tableSP_InventarioMaster.ValorNominalColumn) End Function _ Public Sub SetValorNominalNull() Me(Me.tableSP_InventarioMaster.ValorNominalColumn) = Global.System.Convert.DBNull End Sub End Class ''' '''Row event argument class ''' _ Public Class ECALRIRowChangeEvent Inherits Global.System.EventArgs Private eventRow As ECALRIRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As ECALRIRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As ECALRIRow 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 EMISRowChangeEvent Inherits Global.System.EventArgs Private eventRow As EMISRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As EMISRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As EMISRow 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 EMPRRowChangeEvent Inherits Global.System.EventArgs Private eventRow As EMPRRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As EMPRRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As EMPRRow 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 INFIRowChangeEvent Inherits Global.System.EventArgs Private eventRow As INFIRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As INFIRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As INFIRow 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 PAISRowChangeEvent Inherits Global.System.EventArgs Private eventRow As PAISRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As PAISRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As PAISRow 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 SP_InventarioMasterRowChangeEvent Inherits Global.System.EventArgs Private eventRow As SP_InventarioMasterRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As SP_InventarioMasterRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As SP_InventarioMasterRow 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 dsInversionesTableAdapters ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class ECALRITableAdapter Inherits Global.System.ComponentModel.Component Private WithEvents _adapter As Global.System.Data.SqlClient.SqlDataAdapter Private _connection As Global.System.Data.SqlClient.SqlConnection Private _transaction As Global.System.Data.SqlClient.SqlTransaction Private _commandCollection() As Global.System.Data.SqlClient.SqlCommand Private _clearBeforeFill As Boolean _ Public Sub New() MyBase.New Me.ClearBeforeFill = true End Sub _ Protected Friend ReadOnly Property Adapter() As Global.System.Data.SqlClient.SqlDataAdapter 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.SqlClient.SqlConnection 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.SqlClient.SqlCommand).Connection = value End If i = (i + 1) Loop End Set End Property _ Friend Property Transaction() As Global.System.Data.SqlClient.SqlTransaction 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.SqlClient.SqlCommand() 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.SqlClient.SqlDataAdapter() Dim tableMapping As Global.System.Data.Common.DataTableMapping = New Global.System.Data.Common.DataTableMapping() tableMapping.SourceTable = "Table" tableMapping.DataSetTable = "ECALRI" tableMapping.ColumnMappings.Add("CodECalRi", "CodECalRi") tableMapping.ColumnMappings.Add("Descrip", "Descrip") Me._adapter.TableMappings.Add(tableMapping) Me._adapter.DeleteCommand = New Global.System.Data.SqlClient.SqlCommand() Me._adapter.DeleteCommand.Connection = Me.Connection Me._adapter.DeleteCommand.CommandText = "DELETE FROM [dbo].[ECALRI] WHERE (([CodECalRi] = @Original_CodECalRi) AND ((@IsNu"& _ "ll_Descrip = 1 AND [Descrip] IS NULL) OR ([Descrip] = @Original_Descrip)))" Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_CodECalRi", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CodECalRi", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_Descrip", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", "")) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand() Me._adapter.InsertCommand.Connection = Me.Connection Me._adapter.InsertCommand.CommandText = "INSERT INTO [dbo].[ECALRI] ([CodECalRi], [Descrip]) VALUES (@CodECalRi, @Descrip)"& _ ";"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"SELECT CodECalRi, Descrip FROM ECALRI WHERE (CodECalRi = @CodECalRi)" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CodECalRi", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CodECalRi", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.UpdateCommand = New Global.System.Data.SqlClient.SqlCommand() Me._adapter.UpdateCommand.Connection = Me.Connection Me._adapter.UpdateCommand.CommandText = "UPDATE [dbo].[ECALRI] SET [CodECalRi] = @CodECalRi, [Descrip] = @Descrip WHERE (("& _ "[CodECalRi] = @Original_CodECalRi) AND ((@IsNull_Descrip = 1 AND [Descrip] IS NU"& _ "LL) OR ([Descrip] = @Original_Descrip)));"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"SELECT CodECalRi, Descrip FROM ECALRI"& _ " WHERE (CodECalRi = @CodECalRi)" Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CodECalRi", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CodECalRi", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_CodECalRi", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CodECalRi", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_Descrip", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() Me._connection.ConnectionString = "Data Source=XOMBRA\SQL2014;Initial Catalog=Inversiones_20190620;Integrated Securi"& _ "ty=True" End Sub _ Private Sub InitCommandCollection() Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(0) {} Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(0).Connection = Me.Connection Me._commandCollection(0).CommandText = "SELECT CodECalRi, Descrip FROM dbo.ECALRI" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text End Sub _ Public Overloads Overridable Function Fill(ByVal dataTable As dsInversiones.ECALRIDataTable) 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 dsInversiones.ECALRIDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As dsInversiones.ECALRIDataTable = New dsInversiones.ECALRIDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overloads Overridable Function Update(ByVal dataTable As dsInversiones.ECALRIDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function _ Public Overloads Overridable Function Update(ByVal dataSet As dsInversiones) As Integer Return Me.Adapter.Update(dataSet, "ECALRI") 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_CodECalRi As String, ByVal Original_Descrip As String) As Integer If (Original_CodECalRi Is Nothing) Then Throw New Global.System.ArgumentNullException("Original_CodECalRi") Else Me.Adapter.DeleteCommand.Parameters(0).Value = CType(Original_CodECalRi,String) End If If (Original_Descrip 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_Descrip,String) 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 CodECalRi As String, ByVal Descrip As String) As Integer If (CodECalRi Is Nothing) Then Throw New Global.System.ArgumentNullException("CodECalRi") Else Me.Adapter.InsertCommand.Parameters(0).Value = CType(CodECalRi,String) End If If (Descrip Is Nothing) Then Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(1).Value = CType(Descrip,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 CodECalRi As String, ByVal Descrip As String, ByVal Original_CodECalRi As String, ByVal Original_Descrip As String) As Integer If (CodECalRi Is Nothing) Then Throw New Global.System.ArgumentNullException("CodECalRi") Else Me.Adapter.UpdateCommand.Parameters(0).Value = CType(CodECalRi,String) End If If (Descrip Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(1).Value = CType(Descrip,String) End If If (Original_CodECalRi Is Nothing) Then Throw New Global.System.ArgumentNullException("Original_CodECalRi") Else Me.Adapter.UpdateCommand.Parameters(2).Value = CType(Original_CodECalRi,String) End If If (Original_Descrip Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(3).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(4).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(3).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(4).Value = CType(Original_Descrip,String) 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 _ Public Overloads Overridable Function Update(ByVal Descrip As String, ByVal Original_CodECalRi As String, ByVal Original_Descrip As String) As Integer Return Me.Update(Original_CodECalRi, Descrip, Original_CodECalRi, Original_Descrip) End Function End Class ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class EMISTableAdapter Inherits Global.System.ComponentModel.Component Private WithEvents _adapter As Global.System.Data.SqlClient.SqlDataAdapter Private _connection As Global.System.Data.SqlClient.SqlConnection Private _transaction As Global.System.Data.SqlClient.SqlTransaction Private _commandCollection() As Global.System.Data.SqlClient.SqlCommand Private _clearBeforeFill As Boolean _ Public Sub New() MyBase.New Me.ClearBeforeFill = true End Sub _ Protected Friend ReadOnly Property Adapter() As Global.System.Data.SqlClient.SqlDataAdapter 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.SqlClient.SqlConnection 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.SqlClient.SqlCommand).Connection = value End If i = (i + 1) Loop End Set End Property _ Friend Property Transaction() As Global.System.Data.SqlClient.SqlTransaction 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.SqlClient.SqlCommand() 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.SqlClient.SqlDataAdapter() Dim tableMapping As Global.System.Data.Common.DataTableMapping = New Global.System.Data.Common.DataTableMapping() tableMapping.SourceTable = "Table" tableMapping.DataSetTable = "EMIS" tableMapping.ColumnMappings.Add("CodEmis", "CodEmis") tableMapping.ColumnMappings.Add("Descrip", "Descrip") tableMapping.ColumnMappings.Add("Estado", "Estado") Me._adapter.TableMappings.Add(tableMapping) Me._adapter.DeleteCommand = New Global.System.Data.SqlClient.SqlCommand() Me._adapter.DeleteCommand.Connection = Me.Connection Me._adapter.DeleteCommand.CommandText = "DELETE FROM [dbo].[EMIS] WHERE (([CodEmis] = @Original_CodEmis) AND ((@IsNull_Des"& _ "crip = 1 AND [Descrip] IS NULL) OR ([Descrip] = @Original_Descrip)) AND ((@IsNul"& _ "l_Estado = 1 AND [Estado] IS NULL) OR ([Estado] = @Original_Estado)))" Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_CodEmis", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CodEmis", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_Descrip", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", "")) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_Estado", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Estado", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", "")) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Estado", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Estado", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand() Me._adapter.InsertCommand.Connection = Me.Connection Me._adapter.InsertCommand.CommandText = "INSERT INTO [dbo].[EMIS] ([Descrip], [Estado]) VALUES (@Descrip, @Estado);"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"SELEC"& _ "T CodEmis, Descrip, Estado FROM EMIS WHERE (CodEmis = SCOPE_IDENTITY())" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Estado", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Estado", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.UpdateCommand = New Global.System.Data.SqlClient.SqlCommand() Me._adapter.UpdateCommand.Connection = Me.Connection Me._adapter.UpdateCommand.CommandText = "UPDATE [dbo].[EMIS] SET [Descrip] = @Descrip, [Estado] = @Estado WHERE (([CodEmis"& _ "] = @Original_CodEmis) AND ((@IsNull_Descrip = 1 AND [Descrip] IS NULL) OR ([Des"& _ "crip] = @Original_Descrip)) AND ((@IsNull_Estado = 1 AND [Estado] IS NULL) OR (["& _ "Estado] = @Original_Estado)));"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"SELECT CodEmis, Descrip, Estado FROM EMIS WHERE "& _ "(CodEmis = @CodEmis)" Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Estado", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Estado", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_CodEmis", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CodEmis", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_Descrip", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_Estado", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Estado", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Estado", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Estado", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CodEmis", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 0, 0, "CodEmis", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() Me._connection.ConnectionString = "Data Source=XOMBRA\SQL2014;Initial Catalog=Inversiones_20190620;Integrated Securi"& _ "ty=True" End Sub _ Private Sub InitCommandCollection() Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(0) {} Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(0).Connection = Me.Connection Me._commandCollection(0).CommandText = "SELECT CodEmis, Descrip, Estado FROM dbo.EMIS" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text End Sub _ Public Overloads Overridable Function Fill(ByVal dataTable As dsInversiones.EMISDataTable) 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 dsInversiones.EMISDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As dsInversiones.EMISDataTable = New dsInversiones.EMISDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overloads Overridable Function Update(ByVal dataTable As dsInversiones.EMISDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function _ Public Overloads Overridable Function Update(ByVal dataSet As dsInversiones) As Integer Return Me.Adapter.Update(dataSet, "EMIS") 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_CodEmis As Integer, ByVal Original_Descrip As String, ByVal Original_Estado As String) As Integer Me.Adapter.DeleteCommand.Parameters(0).Value = CType(Original_CodEmis,Integer) If (Original_Descrip 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_Descrip,String) End If If (Original_Estado Is Nothing) Then Me.Adapter.DeleteCommand.Parameters(3).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = Global.System.DBNull.Value Else Me.Adapter.DeleteCommand.Parameters(3).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = CType(Original_Estado,String) 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 Descrip As String, ByVal Estado As String) As Integer If (Descrip Is Nothing) Then Me.Adapter.InsertCommand.Parameters(0).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(0).Value = CType(Descrip,String) End If If (Estado Is Nothing) Then Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(1).Value = CType(Estado,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 Descrip As String, ByVal Estado As String, ByVal Original_CodEmis As Integer, ByVal Original_Descrip As String, ByVal Original_Estado As String, ByVal CodEmis As Integer) As Integer If (Descrip Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(0).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(0).Value = CType(Descrip,String) End If If (Estado Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(1).Value = CType(Estado,String) End If Me.Adapter.UpdateCommand.Parameters(2).Value = CType(Original_CodEmis,Integer) If (Original_Descrip Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(3).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(4).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(3).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(4).Value = CType(Original_Descrip,String) End If If (Original_Estado Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(5).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(6).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(5).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(6).Value = CType(Original_Estado,String) End If Me.Adapter.UpdateCommand.Parameters(7).Value = CType(CodEmis,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 _ Public Overloads Overridable Function Update(ByVal Descrip As String, ByVal Estado As String, ByVal Original_CodEmis As Integer, ByVal Original_Descrip As String, ByVal Original_Estado As String) As Integer Return Me.Update(Descrip, Estado, Original_CodEmis, Original_Descrip, Original_Estado, Original_CodEmis) End Function End Class ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class EMPRTableAdapter Inherits Global.System.ComponentModel.Component Private WithEvents _adapter As Global.System.Data.SqlClient.SqlDataAdapter Private _connection As Global.System.Data.SqlClient.SqlConnection Private _transaction As Global.System.Data.SqlClient.SqlTransaction Private _commandCollection() As Global.System.Data.SqlClient.SqlCommand Private _clearBeforeFill As Boolean _ Public Sub New() MyBase.New Me.ClearBeforeFill = true End Sub _ Protected Friend ReadOnly Property Adapter() As Global.System.Data.SqlClient.SqlDataAdapter 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.SqlClient.SqlConnection 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.SqlClient.SqlCommand).Connection = value End If i = (i + 1) Loop End Set End Property _ Friend Property Transaction() As Global.System.Data.SqlClient.SqlTransaction 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.SqlClient.SqlCommand() 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.SqlClient.SqlDataAdapter() Dim tableMapping As Global.System.Data.Common.DataTableMapping = New Global.System.Data.Common.DataTableMapping() tableMapping.SourceTable = "Table" tableMapping.DataSetTable = "EMPR" tableMapping.ColumnMappings.Add("CodEmpr", "CodEmpr") tableMapping.ColumnMappings.Add("Descrip", "Descrip") tableMapping.ColumnMappings.Add("SAP_BD", "SAP_BD") Me._adapter.TableMappings.Add(tableMapping) Me._adapter.DeleteCommand = New Global.System.Data.SqlClient.SqlCommand() Me._adapter.DeleteCommand.Connection = Me.Connection Me._adapter.DeleteCommand.CommandText = "DELETE FROM [dbo].[EMPR] WHERE (([CodEmpr] = @Original_CodEmpr) AND ((@IsNull_Des"& _ "crip = 1 AND [Descrip] IS NULL) OR ([Descrip] = @Original_Descrip)) AND ((@IsNul"& _ "l_SAP_BD = 1 AND [SAP_BD] IS NULL) OR ([SAP_BD] = @Original_SAP_BD)))" Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_CodEmpr", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CodEmpr", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_Descrip", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", "")) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_SAP_BD", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "SAP_BD", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", "")) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_SAP_BD", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "SAP_BD", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand() Me._adapter.InsertCommand.Connection = Me.Connection Me._adapter.InsertCommand.CommandText = "INSERT INTO [dbo].[EMPR] ([CodEmpr], [Descrip], [SAP_BD]) VALUES (@CodEmpr, @Desc"& _ "rip, @SAP_BD);"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"SELECT CodEmpr, Descrip, SAP_BD FROM EMPR WHERE (CodEmpr = @CodE"& _ "mpr)" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CodEmpr", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CodEmpr", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@SAP_BD", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "SAP_BD", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.UpdateCommand = New Global.System.Data.SqlClient.SqlCommand() Me._adapter.UpdateCommand.Connection = Me.Connection Me._adapter.UpdateCommand.CommandText = "UPDATE [dbo].[EMPR] SET [CodEmpr] = @CodEmpr, [Descrip] = @Descrip, [SAP_BD] = @S"& _ "AP_BD WHERE (([CodEmpr] = @Original_CodEmpr) AND ((@IsNull_Descrip = 1 AND [Desc"& _ "rip] IS NULL) OR ([Descrip] = @Original_Descrip)) AND ((@IsNull_SAP_BD = 1 AND ["& _ "SAP_BD] IS NULL) OR ([SAP_BD] = @Original_SAP_BD)));"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"SELECT CodEmpr, Descrip, S"& _ "AP_BD FROM EMPR WHERE (CodEmpr = @CodEmpr)" Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CodEmpr", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CodEmpr", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@SAP_BD", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "SAP_BD", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_CodEmpr", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CodEmpr", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_Descrip", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_SAP_BD", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "SAP_BD", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_SAP_BD", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "SAP_BD", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() Me._connection.ConnectionString = "Data Source=XOMBRA\SQL2014;Initial Catalog=Inversiones_20190620;Integrated Securi"& _ "ty=True" End Sub _ Private Sub InitCommandCollection() Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(0) {} Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(0).Connection = Me.Connection Me._commandCollection(0).CommandText = "SELECT CodEmpr, Descrip, SAP_BD FROM dbo.EMPR" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text End Sub _ Public Overloads Overridable Function Fill(ByVal dataTable As dsInversiones.EMPRDataTable) 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 dsInversiones.EMPRDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As dsInversiones.EMPRDataTable = New dsInversiones.EMPRDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overloads Overridable Function Update(ByVal dataTable As dsInversiones.EMPRDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function _ Public Overloads Overridable Function Update(ByVal dataSet As dsInversiones) As Integer Return Me.Adapter.Update(dataSet, "EMPR") 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_CodEmpr As String, ByVal Original_Descrip As String, ByVal Original_SAP_BD As String) As Integer If (Original_CodEmpr Is Nothing) Then Throw New Global.System.ArgumentNullException("Original_CodEmpr") Else Me.Adapter.DeleteCommand.Parameters(0).Value = CType(Original_CodEmpr,String) End If If (Original_Descrip 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_Descrip,String) End If If (Original_SAP_BD Is Nothing) Then Me.Adapter.DeleteCommand.Parameters(3).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = Global.System.DBNull.Value Else Me.Adapter.DeleteCommand.Parameters(3).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = CType(Original_SAP_BD,String) 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 CodEmpr As String, ByVal Descrip As String, ByVal SAP_BD As String) As Integer If (CodEmpr Is Nothing) Then Throw New Global.System.ArgumentNullException("CodEmpr") Else Me.Adapter.InsertCommand.Parameters(0).Value = CType(CodEmpr,String) End If If (Descrip Is Nothing) Then Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(1).Value = CType(Descrip,String) End If If (SAP_BD Is Nothing) Then Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(2).Value = CType(SAP_BD,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 CodEmpr As String, ByVal Descrip As String, ByVal SAP_BD As String, ByVal Original_CodEmpr As String, ByVal Original_Descrip As String, ByVal Original_SAP_BD As String) As Integer If (CodEmpr Is Nothing) Then Throw New Global.System.ArgumentNullException("CodEmpr") Else Me.Adapter.UpdateCommand.Parameters(0).Value = CType(CodEmpr,String) End If If (Descrip Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(1).Value = CType(Descrip,String) End If If (SAP_BD Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(2).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(2).Value = CType(SAP_BD,String) End If If (Original_CodEmpr Is Nothing) Then Throw New Global.System.ArgumentNullException("Original_CodEmpr") Else Me.Adapter.UpdateCommand.Parameters(3).Value = CType(Original_CodEmpr,String) End If If (Original_Descrip Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(4).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(5).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(4).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(5).Value = CType(Original_Descrip,String) End If If (Original_SAP_BD Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(6).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(7).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(6).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(7).Value = CType(Original_SAP_BD,String) 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 _ Public Overloads Overridable Function Update(ByVal Descrip As String, ByVal SAP_BD As String, ByVal Original_CodEmpr As String, ByVal Original_Descrip As String, ByVal Original_SAP_BD As String) As Integer Return Me.Update(Original_CodEmpr, Descrip, SAP_BD, Original_CodEmpr, Original_Descrip, Original_SAP_BD) End Function End Class ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class INFITableAdapter Inherits Global.System.ComponentModel.Component Private WithEvents _adapter As Global.System.Data.SqlClient.SqlDataAdapter Private _connection As Global.System.Data.SqlClient.SqlConnection Private _transaction As Global.System.Data.SqlClient.SqlTransaction Private _commandCollection() As Global.System.Data.SqlClient.SqlCommand Private _clearBeforeFill As Boolean _ Public Sub New() MyBase.New Me.ClearBeforeFill = true End Sub _ Protected Friend ReadOnly Property Adapter() As Global.System.Data.SqlClient.SqlDataAdapter 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.SqlClient.SqlConnection 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.SqlClient.SqlCommand).Connection = value End If i = (i + 1) Loop End Set End Property _ Friend Property Transaction() As Global.System.Data.SqlClient.SqlTransaction 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.SqlClient.SqlCommand() 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.SqlClient.SqlDataAdapter() Dim tableMapping As Global.System.Data.Common.DataTableMapping = New Global.System.Data.Common.DataTableMapping() tableMapping.SourceTable = "Table" tableMapping.DataSetTable = "INFI" tableMapping.ColumnMappings.Add("CodIF", "CodIF") tableMapping.ColumnMappings.Add("Descrip", "Descrip") tableMapping.ColumnMappings.Add("Tipo", "Tipo") Me._adapter.TableMappings.Add(tableMapping) Me._adapter.DeleteCommand = New Global.System.Data.SqlClient.SqlCommand() Me._adapter.DeleteCommand.Connection = Me.Connection Me._adapter.DeleteCommand.CommandText = "DELETE FROM [dbo].[INFI] WHERE (([CodIF] = @Original_CodIF) AND ((@IsNull_Descrip"& _ " = 1 AND [Descrip] IS NULL) OR ([Descrip] = @Original_Descrip)) AND ((@IsNull_Ti"& _ "po = 1 AND [Tipo] IS NULL) OR ([Tipo] = @Original_Tipo)))" Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_CodIF", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CodIF", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_Descrip", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", "")) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_Tipo", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Tipo", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", "")) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Tipo", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Tipo", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand() Me._adapter.InsertCommand.Connection = Me.Connection Me._adapter.InsertCommand.CommandText = "INSERT INTO [dbo].[INFI] ([CodIF], [Descrip], [Tipo]) VALUES (@CodIF, @Descrip, @"& _ "Tipo);"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"SELECT CodIF, Descrip, Tipo FROM INFI WHERE (CodIF = @CodIF)" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CodIF", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CodIF", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Tipo", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Tipo", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.UpdateCommand = New Global.System.Data.SqlClient.SqlCommand() Me._adapter.UpdateCommand.Connection = Me.Connection Me._adapter.UpdateCommand.CommandText = "UPDATE [dbo].[INFI] SET [CodIF] = @CodIF, [Descrip] = @Descrip, [Tipo] = @Tipo WH"& _ "ERE (([CodIF] = @Original_CodIF) AND ((@IsNull_Descrip = 1 AND [Descrip] IS NULL"& _ ") OR ([Descrip] = @Original_Descrip)) AND ((@IsNull_Tipo = 1 AND [Tipo] IS NULL)"& _ " OR ([Tipo] = @Original_Tipo)));"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"SELECT CodIF, Descrip, Tipo FROM INFI WHERE (C"& _ "odIF = @CodIF)" Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CodIF", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CodIF", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Tipo", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Tipo", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_CodIF", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CodIF", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_Descrip", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_Tipo", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Tipo", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Tipo", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Tipo", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() Me._connection.ConnectionString = "Data Source=XOMBRA\SQL2014;Initial Catalog=Inversiones_20190620;Integrated Securi"& _ "ty=True" End Sub _ Private Sub InitCommandCollection() Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(0) {} Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(0).Connection = Me.Connection Me._commandCollection(0).CommandText = "SELECT CodIF, Descrip, Tipo FROM dbo.INFI" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text End Sub _ Public Overloads Overridable Function Fill(ByVal dataTable As dsInversiones.INFIDataTable) 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 dsInversiones.INFIDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As dsInversiones.INFIDataTable = New dsInversiones.INFIDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overloads Overridable Function Update(ByVal dataTable As dsInversiones.INFIDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function _ Public Overloads Overridable Function Update(ByVal dataSet As dsInversiones) As Integer Return Me.Adapter.Update(dataSet, "INFI") 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_CodIF As String, ByVal Original_Descrip As String, ByVal Original_Tipo As String) As Integer If (Original_CodIF Is Nothing) Then Throw New Global.System.ArgumentNullException("Original_CodIF") Else Me.Adapter.DeleteCommand.Parameters(0).Value = CType(Original_CodIF,String) End If If (Original_Descrip 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_Descrip,String) End If If (Original_Tipo Is Nothing) Then Me.Adapter.DeleteCommand.Parameters(3).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = Global.System.DBNull.Value Else Me.Adapter.DeleteCommand.Parameters(3).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = CType(Original_Tipo,String) 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 CodIF As String, ByVal Descrip As String, ByVal Tipo As String) As Integer If (CodIF Is Nothing) Then Throw New Global.System.ArgumentNullException("CodIF") Else Me.Adapter.InsertCommand.Parameters(0).Value = CType(CodIF,String) End If If (Descrip Is Nothing) Then Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(1).Value = CType(Descrip,String) End If If (Tipo Is Nothing) Then Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(2).Value = CType(Tipo,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 CodIF As String, ByVal Descrip As String, ByVal Tipo As String, ByVal Original_CodIF As String, ByVal Original_Descrip As String, ByVal Original_Tipo As String) As Integer If (CodIF Is Nothing) Then Throw New Global.System.ArgumentNullException("CodIF") Else Me.Adapter.UpdateCommand.Parameters(0).Value = CType(CodIF,String) End If If (Descrip Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(1).Value = CType(Descrip,String) End If If (Tipo Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(2).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(2).Value = CType(Tipo,String) End If If (Original_CodIF Is Nothing) Then Throw New Global.System.ArgumentNullException("Original_CodIF") Else Me.Adapter.UpdateCommand.Parameters(3).Value = CType(Original_CodIF,String) End If If (Original_Descrip Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(4).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(5).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(4).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(5).Value = CType(Original_Descrip,String) End If If (Original_Tipo Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(6).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(7).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(6).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(7).Value = CType(Original_Tipo,String) 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 _ Public Overloads Overridable Function Update(ByVal Descrip As String, ByVal Tipo As String, ByVal Original_CodIF As String, ByVal Original_Descrip As String, ByVal Original_Tipo As String) As Integer Return Me.Update(Original_CodIF, Descrip, Tipo, Original_CodIF, Original_Descrip, Original_Tipo) End Function End Class ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class PAISTableAdapter Inherits Global.System.ComponentModel.Component Private WithEvents _adapter As Global.System.Data.SqlClient.SqlDataAdapter Private _connection As Global.System.Data.SqlClient.SqlConnection Private _transaction As Global.System.Data.SqlClient.SqlTransaction Private _commandCollection() As Global.System.Data.SqlClient.SqlCommand Private _clearBeforeFill As Boolean _ Public Sub New() MyBase.New Me.ClearBeforeFill = true End Sub _ Protected Friend ReadOnly Property Adapter() As Global.System.Data.SqlClient.SqlDataAdapter 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.SqlClient.SqlConnection 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.SqlClient.SqlCommand).Connection = value End If i = (i + 1) Loop End Set End Property _ Friend Property Transaction() As Global.System.Data.SqlClient.SqlTransaction 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.SqlClient.SqlCommand() 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.SqlClient.SqlDataAdapter() Dim tableMapping As Global.System.Data.Common.DataTableMapping = New Global.System.Data.Common.DataTableMapping() tableMapping.SourceTable = "Table" tableMapping.DataSetTable = "PAIS" tableMapping.ColumnMappings.Add("CodPais", "CodPais") tableMapping.ColumnMappings.Add("Descrip", "Descrip") tableMapping.ColumnMappings.Add("RelInv", "RelInv") Me._adapter.TableMappings.Add(tableMapping) Me._adapter.DeleteCommand = New Global.System.Data.SqlClient.SqlCommand() Me._adapter.DeleteCommand.Connection = Me.Connection Me._adapter.DeleteCommand.CommandText = "DELETE FROM [dbo].[PAIS] WHERE (([CodPais] = @Original_CodPais) AND ((@IsNull_Des"& _ "crip = 1 AND [Descrip] IS NULL) OR ([Descrip] = @Original_Descrip)) AND ((@IsNul"& _ "l_RelInv = 1 AND [RelInv] IS NULL) OR ([RelInv] = @Original_RelInv)))" Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_CodPais", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CodPais", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_Descrip", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", "")) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_RelInv", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "RelInv", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", "")) Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_RelInv", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "RelInv", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand() Me._adapter.InsertCommand.Connection = Me.Connection Me._adapter.InsertCommand.CommandText = "INSERT INTO [dbo].[PAIS] ([CodPais], [Descrip], [RelInv]) VALUES (@CodPais, @Desc"& _ "rip, @RelInv);"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"SELECT CodPais, Descrip, RelInv FROM PAIS WHERE (CodPais = @CodP"& _ "ais)" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CodPais", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CodPais", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RelInv", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "RelInv", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.UpdateCommand = New Global.System.Data.SqlClient.SqlCommand() Me._adapter.UpdateCommand.Connection = Me.Connection Me._adapter.UpdateCommand.CommandText = "UPDATE [dbo].[PAIS] SET [CodPais] = @CodPais, [Descrip] = @Descrip, [RelInv] = @R"& _ "elInv WHERE (([CodPais] = @Original_CodPais) AND ((@IsNull_Descrip = 1 AND [Desc"& _ "rip] IS NULL) OR ([Descrip] = @Original_Descrip)) AND ((@IsNull_RelInv = 1 AND ["& _ "RelInv] IS NULL) OR ([RelInv] = @Original_RelInv)));"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"SELECT CodPais, Descrip, R"& _ "elInv FROM PAIS WHERE (CodPais = @CodPais)" Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CodPais", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CodPais", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RelInv", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "RelInv", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_CodPais", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CodPais", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_Descrip", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Descrip", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Descrip", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_RelInv", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "RelInv", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", "")) Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_RelInv", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "RelInv", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", "")) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() Me._connection.ConnectionString = "Data Source=XOMBRA\SQL2014;Initial Catalog=Inversiones_20190620;Integrated Securi"& _ "ty=True" End Sub _ Private Sub InitCommandCollection() Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(0) {} Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(0).Connection = Me.Connection Me._commandCollection(0).CommandText = "SELECT CodPais, Descrip, RelInv FROM dbo.PAIS" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text End Sub _ Public Overloads Overridable Function Fill(ByVal dataTable As dsInversiones.PAISDataTable) 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 dsInversiones.PAISDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As dsInversiones.PAISDataTable = New dsInversiones.PAISDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overloads Overridable Function Update(ByVal dataTable As dsInversiones.PAISDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function _ Public Overloads Overridable Function Update(ByVal dataSet As dsInversiones) As Integer Return Me.Adapter.Update(dataSet, "PAIS") 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_CodPais As String, ByVal Original_Descrip As String, ByVal Original_RelInv As String) As Integer If (Original_CodPais Is Nothing) Then Throw New Global.System.ArgumentNullException("Original_CodPais") Else Me.Adapter.DeleteCommand.Parameters(0).Value = CType(Original_CodPais,String) End If If (Original_Descrip 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_Descrip,String) End If If (Original_RelInv Is Nothing) Then Me.Adapter.DeleteCommand.Parameters(3).Value = CType(1,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = Global.System.DBNull.Value Else Me.Adapter.DeleteCommand.Parameters(3).Value = CType(0,Object) Me.Adapter.DeleteCommand.Parameters(4).Value = CType(Original_RelInv,String) 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 CodPais As String, ByVal Descrip As String, ByVal RelInv As String) As Integer If (CodPais Is Nothing) Then Throw New Global.System.ArgumentNullException("CodPais") Else Me.Adapter.InsertCommand.Parameters(0).Value = CType(CodPais,String) End If If (Descrip Is Nothing) Then Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(1).Value = CType(Descrip,String) End If If (RelInv Is Nothing) Then Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(2).Value = CType(RelInv,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 CodPais As String, ByVal Descrip As String, ByVal RelInv As String, ByVal Original_CodPais As String, ByVal Original_Descrip As String, ByVal Original_RelInv As String) As Integer If (CodPais Is Nothing) Then Throw New Global.System.ArgumentNullException("CodPais") Else Me.Adapter.UpdateCommand.Parameters(0).Value = CType(CodPais,String) End If If (Descrip Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(1).Value = CType(Descrip,String) End If If (RelInv Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(2).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(2).Value = CType(RelInv,String) End If If (Original_CodPais Is Nothing) Then Throw New Global.System.ArgumentNullException("Original_CodPais") Else Me.Adapter.UpdateCommand.Parameters(3).Value = CType(Original_CodPais,String) End If If (Original_Descrip Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(4).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(5).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(4).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(5).Value = CType(Original_Descrip,String) End If If (Original_RelInv Is Nothing) Then Me.Adapter.UpdateCommand.Parameters(6).Value = CType(1,Object) Me.Adapter.UpdateCommand.Parameters(7).Value = Global.System.DBNull.Value Else Me.Adapter.UpdateCommand.Parameters(6).Value = CType(0,Object) Me.Adapter.UpdateCommand.Parameters(7).Value = CType(Original_RelInv,String) 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 _ Public Overloads Overridable Function Update(ByVal Descrip As String, ByVal RelInv As String, ByVal Original_CodPais As String, ByVal Original_Descrip As String, ByVal Original_RelInv As String) As Integer Return Me.Update(Original_CodPais, Descrip, RelInv, Original_CodPais, Original_Descrip, Original_RelInv) End Function End Class ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class SP_InventarioMasterTableAdapter Inherits Global.System.ComponentModel.Component Private WithEvents _adapter As Global.System.Data.SqlClient.SqlDataAdapter Private _connection As Global.System.Data.SqlClient.SqlConnection Private _transaction As Global.System.Data.SqlClient.SqlTransaction Private _commandCollection() As Global.System.Data.SqlClient.SqlCommand Private _clearBeforeFill As Boolean _ Public Sub New() MyBase.New Me.ClearBeforeFill = true End Sub _ Protected Friend ReadOnly Property Adapter() As Global.System.Data.SqlClient.SqlDataAdapter 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.SqlClient.SqlConnection 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.SqlClient.SqlCommand).Connection = value End If i = (i + 1) Loop End Set End Property _ Friend Property Transaction() As Global.System.Data.SqlClient.SqlTransaction 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.SqlClient.SqlCommand() 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.SqlClient.SqlDataAdapter() Dim tableMapping As Global.System.Data.Common.DataTableMapping = New Global.System.Data.Common.DataTableMapping() tableMapping.SourceTable = "Table" tableMapping.DataSetTable = "SP_InventarioMaster" tableMapping.ColumnMappings.Add("CodInv", "CodInv") tableMapping.ColumnMappings.Add("CodIF", "CodIF") tableMapping.ColumnMappings.Add("Estado", "Estado") tableMapping.ColumnMappings.Add("CodEmpr", "CodEmpr") tableMapping.ColumnMappings.Add("NombreManIF", "NombreManIF") tableMapping.ColumnMappings.Add("CodManIF", "CodManIF") tableMapping.ColumnMappings.Add("CodEmis", "CodEmis") tableMapping.ColumnMappings.Add("iCasaBanco", "iCasaBanco") tableMapping.ColumnMappings.Add("vCasaBanco", "vCasaBanco") tableMapping.ColumnMappings.Add("TipoMerc", "TipoMerc") tableMapping.ColumnMappings.Add("CodCalRi", "CodCalRi") tableMapping.ColumnMappings.Add("CodECalRi", "CodECalRi") tableMapping.ColumnMappings.Add("ValorNominal", "ValorNominal") Me._adapter.TableMappings.Add(tableMapping) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() Me._connection.ConnectionString = "Data Source=XOMBRA\SQL2014;Initial Catalog=Inversiones_20190620;Integrated Securi"& _ "ty=True" End Sub _ Private Sub InitCommandCollection() Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(0) {} Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(0).Connection = Me.Connection Me._commandCollection(0).CommandText = "dbo.SP_InventarioMaster" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.StoredProcedure Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) End Sub _ Public Overloads Overridable Function Fill(ByVal dataTable As dsInversiones.SP_InventarioMasterDataTable) 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 dsInversiones.SP_InventarioMasterDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As dsInversiones.SP_InventarioMasterDataTable = New dsInversiones.SP_InventarioMasterDataTable() Me.Adapter.Fill(dataTable) Return dataTable 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 _eCALRITableAdapter As ECALRITableAdapter Private _eMISTableAdapter As EMISTableAdapter Private _eMPRTableAdapter As EMPRTableAdapter Private _iNFITableAdapter As INFITableAdapter Private _pAISTableAdapter As PAISTableAdapter 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 ECALRITableAdapter() As ECALRITableAdapter Get Return Me._eCALRITableAdapter End Get Set Me._eCALRITableAdapter = value End Set End Property _ Public Property EMISTableAdapter() As EMISTableAdapter Get Return Me._eMISTableAdapter End Get Set Me._eMISTableAdapter = value End Set End Property _ Public Property EMPRTableAdapter() As EMPRTableAdapter Get Return Me._eMPRTableAdapter End Get Set Me._eMPRTableAdapter = value End Set End Property _ Public Property INFITableAdapter() As INFITableAdapter Get Return Me._iNFITableAdapter End Get Set Me._iNFITableAdapter = value End Set End Property _ Public Property PAISTableAdapter() As PAISTableAdapter Get Return Me._pAISTableAdapter End Get Set Me._pAISTableAdapter = 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._eCALRITableAdapter) Is Nothing) _ AndAlso (Not (Me._eCALRITableAdapter.Connection) Is Nothing)) Then Return Me._eCALRITableAdapter.Connection End If If ((Not (Me._eMISTableAdapter) Is Nothing) _ AndAlso (Not (Me._eMISTableAdapter.Connection) Is Nothing)) Then Return Me._eMISTableAdapter.Connection End If If ((Not (Me._eMPRTableAdapter) Is Nothing) _ AndAlso (Not (Me._eMPRTableAdapter.Connection) Is Nothing)) Then Return Me._eMPRTableAdapter.Connection End If If ((Not (Me._iNFITableAdapter) Is Nothing) _ AndAlso (Not (Me._iNFITableAdapter.Connection) Is Nothing)) Then Return Me._iNFITableAdapter.Connection End If If ((Not (Me._pAISTableAdapter) Is Nothing) _ AndAlso (Not (Me._pAISTableAdapter.Connection) Is Nothing)) Then Return Me._pAISTableAdapter.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._eCALRITableAdapter) Is Nothing) Then count = (count + 1) End If If (Not (Me._eMISTableAdapter) Is Nothing) Then count = (count + 1) End If If (Not (Me._eMPRTableAdapter) Is Nothing) Then count = (count + 1) End If If (Not (Me._iNFITableAdapter) Is Nothing) Then count = (count + 1) End If If (Not (Me._pAISTableAdapter) 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 dsInversiones, 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._eCALRITableAdapter) Is Nothing) Then Dim updatedRows() As Global.System.Data.DataRow = dataSet.ECALRI.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._eCALRITableAdapter.Update(updatedRows)) allChangedRows.AddRange(updatedRows) End If End If If (Not (Me._eMISTableAdapter) Is Nothing) Then Dim updatedRows() As Global.System.Data.DataRow = dataSet.EMIS.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._eMISTableAdapter.Update(updatedRows)) allChangedRows.AddRange(updatedRows) End If End If If (Not (Me._eMPRTableAdapter) Is Nothing) Then Dim updatedRows() As Global.System.Data.DataRow = dataSet.EMPR.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._eMPRTableAdapter.Update(updatedRows)) allChangedRows.AddRange(updatedRows) End If End If If (Not (Me._iNFITableAdapter) Is Nothing) Then Dim updatedRows() As Global.System.Data.DataRow = dataSet.INFI.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._iNFITableAdapter.Update(updatedRows)) allChangedRows.AddRange(updatedRows) End If End If If (Not (Me._pAISTableAdapter) Is Nothing) Then Dim updatedRows() As Global.System.Data.DataRow = dataSet.PAIS.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._pAISTableAdapter.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 dsInversiones, ByVal allAddedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)) As Integer Dim result As Integer = 0 If (Not (Me._eCALRITableAdapter) Is Nothing) Then Dim addedRows() As Global.System.Data.DataRow = dataSet.ECALRI.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) If ((Not (addedRows) Is Nothing) _ AndAlso (0 < addedRows.Length)) Then result = (result + Me._eCALRITableAdapter.Update(addedRows)) allAddedRows.AddRange(addedRows) End If End If If (Not (Me._eMISTableAdapter) Is Nothing) Then Dim addedRows() As Global.System.Data.DataRow = dataSet.EMIS.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) If ((Not (addedRows) Is Nothing) _ AndAlso (0 < addedRows.Length)) Then result = (result + Me._eMISTableAdapter.Update(addedRows)) allAddedRows.AddRange(addedRows) End If End If If (Not (Me._eMPRTableAdapter) Is Nothing) Then Dim addedRows() As Global.System.Data.DataRow = dataSet.EMPR.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) If ((Not (addedRows) Is Nothing) _ AndAlso (0 < addedRows.Length)) Then result = (result + Me._eMPRTableAdapter.Update(addedRows)) allAddedRows.AddRange(addedRows) End If End If If (Not (Me._iNFITableAdapter) Is Nothing) Then Dim addedRows() As Global.System.Data.DataRow = dataSet.INFI.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) If ((Not (addedRows) Is Nothing) _ AndAlso (0 < addedRows.Length)) Then result = (result + Me._iNFITableAdapter.Update(addedRows)) allAddedRows.AddRange(addedRows) End If End If If (Not (Me._pAISTableAdapter) Is Nothing) Then Dim addedRows() As Global.System.Data.DataRow = dataSet.PAIS.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) If ((Not (addedRows) Is Nothing) _ AndAlso (0 < addedRows.Length)) Then result = (result + Me._pAISTableAdapter.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 dsInversiones, ByVal allChangedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)) As Integer Dim result As Integer = 0 If (Not (Me._pAISTableAdapter) Is Nothing) Then Dim deletedRows() As Global.System.Data.DataRow = dataSet.PAIS.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) If ((Not (deletedRows) Is Nothing) _ AndAlso (0 < deletedRows.Length)) Then result = (result + Me._pAISTableAdapter.Update(deletedRows)) allChangedRows.AddRange(deletedRows) End If End If If (Not (Me._iNFITableAdapter) Is Nothing) Then Dim deletedRows() As Global.System.Data.DataRow = dataSet.INFI.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) If ((Not (deletedRows) Is Nothing) _ AndAlso (0 < deletedRows.Length)) Then result = (result + Me._iNFITableAdapter.Update(deletedRows)) allChangedRows.AddRange(deletedRows) End If End If If (Not (Me._eMPRTableAdapter) Is Nothing) Then Dim deletedRows() As Global.System.Data.DataRow = dataSet.EMPR.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) If ((Not (deletedRows) Is Nothing) _ AndAlso (0 < deletedRows.Length)) Then result = (result + Me._eMPRTableAdapter.Update(deletedRows)) allChangedRows.AddRange(deletedRows) End If End If If (Not (Me._eMISTableAdapter) Is Nothing) Then Dim deletedRows() As Global.System.Data.DataRow = dataSet.EMIS.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) If ((Not (deletedRows) Is Nothing) _ AndAlso (0 < deletedRows.Length)) Then result = (result + Me._eMISTableAdapter.Update(deletedRows)) allChangedRows.AddRange(deletedRows) End If End If If (Not (Me._eCALRITableAdapter) Is Nothing) Then Dim deletedRows() As Global.System.Data.DataRow = dataSet.ECALRI.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) If ((Not (deletedRows) Is Nothing) _ AndAlso (0 < deletedRows.Length)) Then result = (result + Me._eCALRITableAdapter.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 dsInversiones) 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._eCALRITableAdapter) Is Nothing) _ AndAlso (Me.MatchTableAdapterConnection(Me._eCALRITableAdapter.Connection) = false)) Then Throw New Global.System.ArgumentException("Todos los TableAdapters administrados por un TableAdapterManager deben usar la mi"& _ "sma cadena de conexión.") End If If ((Not (Me._eMISTableAdapter) Is Nothing) _ AndAlso (Me.MatchTableAdapterConnection(Me._eMISTableAdapter.Connection) = false)) Then Throw New Global.System.ArgumentException("Todos los TableAdapters administrados por un TableAdapterManager deben usar la mi"& _ "sma cadena de conexión.") End If If ((Not (Me._eMPRTableAdapter) Is Nothing) _ AndAlso (Me.MatchTableAdapterConnection(Me._eMPRTableAdapter.Connection) = false)) Then Throw New Global.System.ArgumentException("Todos los TableAdapters administrados por un TableAdapterManager deben usar la mi"& _ "sma cadena de conexión.") End If If ((Not (Me._iNFITableAdapter) Is Nothing) _ AndAlso (Me.MatchTableAdapterConnection(Me._iNFITableAdapter.Connection) = false)) Then Throw New Global.System.ArgumentException("Todos los TableAdapters administrados por un TableAdapterManager deben usar la mi"& _ "sma cadena de conexión.") End If If ((Not (Me._pAISTableAdapter) Is Nothing) _ AndAlso (Me.MatchTableAdapterConnection(Me._pAISTableAdapter.Connection) = false)) Then Throw New Global.System.ArgumentException("Todos los TableAdapters administrados por un TableAdapterManager deben usar la mi"& _ "sma cadena de conexión.") End If Dim workConnection As Global.System.Data.IDbConnection = Me.Connection If (workConnection Is Nothing) Then Throw New Global.System.ApplicationException("TableAdapterManager no contiene información de conexión. Establezca cada propieda"& _ "d TableAdapterManager TableAdapter en una instancia TableAdapter válida.") 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("La transacción no puede comenzar. La conexión de datos actual no es compatible co"& _ "n las transacciones o el estado actual no permite que comience la transacción.") 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._eCALRITableAdapter) Is Nothing) Then revertConnections.Add(Me._eCALRITableAdapter, Me._eCALRITableAdapter.Connection) Me._eCALRITableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection) Me._eCALRITableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction) If Me._eCALRITableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._eCALRITableAdapter.Adapter.AcceptChangesDuringUpdate = false adaptersWithAcceptChangesDuringUpdate.Add(Me._eCALRITableAdapter.Adapter) End If End If If (Not (Me._eMISTableAdapter) Is Nothing) Then revertConnections.Add(Me._eMISTableAdapter, Me._eMISTableAdapter.Connection) Me._eMISTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection) Me._eMISTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction) If Me._eMISTableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._eMISTableAdapter.Adapter.AcceptChangesDuringUpdate = false adaptersWithAcceptChangesDuringUpdate.Add(Me._eMISTableAdapter.Adapter) End If End If If (Not (Me._eMPRTableAdapter) Is Nothing) Then revertConnections.Add(Me._eMPRTableAdapter, Me._eMPRTableAdapter.Connection) Me._eMPRTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection) Me._eMPRTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction) If Me._eMPRTableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._eMPRTableAdapter.Adapter.AcceptChangesDuringUpdate = false adaptersWithAcceptChangesDuringUpdate.Add(Me._eMPRTableAdapter.Adapter) End If End If If (Not (Me._iNFITableAdapter) Is Nothing) Then revertConnections.Add(Me._iNFITableAdapter, Me._iNFITableAdapter.Connection) Me._iNFITableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection) Me._iNFITableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction) If Me._iNFITableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._iNFITableAdapter.Adapter.AcceptChangesDuringUpdate = false adaptersWithAcceptChangesDuringUpdate.Add(Me._iNFITableAdapter.Adapter) End If End If If (Not (Me._pAISTableAdapter) Is Nothing) Then revertConnections.Add(Me._pAISTableAdapter, Me._pAISTableAdapter.Connection) Me._pAISTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection) Me._pAISTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction) If Me._pAISTableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._pAISTableAdapter.Adapter.AcceptChangesDuringUpdate = false adaptersWithAcceptChangesDuringUpdate.Add(Me._pAISTableAdapter.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._eCALRITableAdapter) Is Nothing) Then Me._eCALRITableAdapter.Connection = CType(revertConnections(Me._eCALRITableAdapter),Global.System.Data.SqlClient.SqlConnection) Me._eCALRITableAdapter.Transaction = Nothing End If If (Not (Me._eMISTableAdapter) Is Nothing) Then Me._eMISTableAdapter.Connection = CType(revertConnections(Me._eMISTableAdapter),Global.System.Data.SqlClient.SqlConnection) Me._eMISTableAdapter.Transaction = Nothing End If If (Not (Me._eMPRTableAdapter) Is Nothing) Then Me._eMPRTableAdapter.Connection = CType(revertConnections(Me._eMPRTableAdapter),Global.System.Data.SqlClient.SqlConnection) Me._eMPRTableAdapter.Transaction = Nothing End If If (Not (Me._iNFITableAdapter) Is Nothing) Then Me._iNFITableAdapter.Connection = CType(revertConnections(Me._iNFITableAdapter),Global.System.Data.SqlClient.SqlConnection) Me._iNFITableAdapter.Transaction = Nothing End If If (Not (Me._pAISTableAdapter) Is Nothing) Then Me._pAISTableAdapter.Connection = CType(revertConnections(Me._pAISTableAdapter),Global.System.Data.SqlClient.SqlConnection) Me._pAISTableAdapter.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