' Copyright (C) 2025 P4pillon.org ' ' This program is free software: you can redistribute it and/or modify ' it under the terms of the GNU Affero General Public License as ' published by the Free Software Foundation, either version 3 of the ' License, or (at your option) any later version. ' ' This program is distributed in the hope that it will be useful, ' but WITHOUT ANY WARRANTY; without even the implied warranty of ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ' GNU Affero General Public License for more details. ' ' You should have received a copy of the GNU Affero General Public License ' along with this program. If not, see . '------------------------------------------------------------------------------ ' ' Ce code a été généré par un outil. ' Version du runtime :4.0.30319.42000 ' ' Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si ' le code est régénéré. ' '------------------------------------------------------------------------------ Option Strict Off Option Explicit On ''' '''Represents a strongly typed in-memory cache of data. ''' _ Partial Public Class PharmaDataSet1 Inherits Global.System.Data.DataSet Private tableDP_ALERTE_PRODUIT As DP_ALERTE_PRODUITDataTable Private tableDP_Msg As DP_MsgDataTable Private tableDP_Req As DP_ReqDataTable 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("DP_ALERTE_PRODUIT")) Is Nothing) Then MyBase.Tables.Add(New DP_ALERTE_PRODUITDataTable(ds.Tables("DP_ALERTE_PRODUIT"))) End If If (Not (ds.Tables("DP_Msg")) Is Nothing) Then MyBase.Tables.Add(New DP_MsgDataTable(ds.Tables("DP_Msg"))) End If If (Not (ds.Tables("DP_Req")) Is Nothing) Then MyBase.Tables.Add(New DP_ReqDataTable(ds.Tables("DP_Req"))) 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 DP_ALERTE_PRODUIT() As DP_ALERTE_PRODUITDataTable Get Return Me.tableDP_ALERTE_PRODUIT End Get End Property _ Public ReadOnly Property DP_Msg() As DP_MsgDataTable Get Return Me.tableDP_Msg End Get End Property _ Public ReadOnly Property DP_Req() As DP_ReqDataTable Get Return Me.tableDP_Req 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 PharmaDataSet1 = CType(MyBase.Clone,PharmaDataSet1) 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("DP_ALERTE_PRODUIT")) Is Nothing) Then MyBase.Tables.Add(New DP_ALERTE_PRODUITDataTable(ds.Tables("DP_ALERTE_PRODUIT"))) End If If (Not (ds.Tables("DP_Msg")) Is Nothing) Then MyBase.Tables.Add(New DP_MsgDataTable(ds.Tables("DP_Msg"))) End If If (Not (ds.Tables("DP_Req")) Is Nothing) Then MyBase.Tables.Add(New DP_ReqDataTable(ds.Tables("DP_Req"))) 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.tableDP_ALERTE_PRODUIT = CType(MyBase.Tables("DP_ALERTE_PRODUIT"),DP_ALERTE_PRODUITDataTable) If (initTable = true) Then If (Not (Me.tableDP_ALERTE_PRODUIT) Is Nothing) Then Me.tableDP_ALERTE_PRODUIT.InitVars End If End If Me.tableDP_Msg = CType(MyBase.Tables("DP_Msg"),DP_MsgDataTable) If (initTable = true) Then If (Not (Me.tableDP_Msg) Is Nothing) Then Me.tableDP_Msg.InitVars End If End If Me.tableDP_Req = CType(MyBase.Tables("DP_Req"),DP_ReqDataTable) If (initTable = true) Then If (Not (Me.tableDP_Req) Is Nothing) Then Me.tableDP_Req.InitVars End If End If End Sub _ Private Sub InitClass() Me.DataSetName = "PharmaDataSet1" Me.Prefix = "" Me.Namespace = "http://tempuri.org/PharmaDataSet1.xsd" Me.EnforceConstraints = true Me.SchemaSerializationMode = Global.System.Data.SchemaSerializationMode.IncludeSchema Me.tableDP_ALERTE_PRODUIT = New DP_ALERTE_PRODUITDataTable() MyBase.Tables.Add(Me.tableDP_ALERTE_PRODUIT) Me.tableDP_Msg = New DP_MsgDataTable() MyBase.Tables.Add(Me.tableDP_Msg) Me.tableDP_Req = New DP_ReqDataTable() MyBase.Tables.Add(Me.tableDP_Req) End Sub _ Private Function ShouldSerializeDP_ALERTE_PRODUIT() As Boolean Return false End Function _ Private Function ShouldSerializeDP_Msg() As Boolean Return false End Function _ Private Function ShouldSerializeDP_Req() 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 PharmaDataSet1 = New PharmaDataSet1() 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 DP_ALERTE_PRODUITRowChangeEventHandler(ByVal sender As Object, ByVal e As DP_ALERTE_PRODUITRowChangeEvent) _ Public Delegate Sub DP_MsgRowChangeEventHandler(ByVal sender As Object, ByVal e As DP_MsgRowChangeEvent) _ Public Delegate Sub DP_ReqRowChangeEventHandler(ByVal sender As Object, ByVal e As DP_ReqRowChangeEvent) ''' '''Represents the strongly named DataTable class. ''' _ Partial Public Class DP_ALERTE_PRODUITDataTable Inherits Global.System.Data.TypedTableBase(Of DP_ALERTE_PRODUITRow) Private columnCIP As Global.System.Data.DataColumn Private columnMsgRef As Global.System.Data.DataColumn Private columnLots As Global.System.Data.DataColumn Private columnVue As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "DP_ALERTE_PRODUIT" 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 CIPColumn() As Global.System.Data.DataColumn Get Return Me.columnCIP End Get End Property _ Public ReadOnly Property MsgRefColumn() As Global.System.Data.DataColumn Get Return Me.columnMsgRef End Get End Property _ Public ReadOnly Property LotsColumn() As Global.System.Data.DataColumn Get Return Me.columnLots End Get End Property _ Public ReadOnly Property VueColumn() As Global.System.Data.DataColumn Get Return Me.columnVue 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 DP_ALERTE_PRODUITRow Get Return CType(Me.Rows(index),DP_ALERTE_PRODUITRow) End Get End Property _ Public Event DP_ALERTE_PRODUITRowChanging As DP_ALERTE_PRODUITRowChangeEventHandler _ Public Event DP_ALERTE_PRODUITRowChanged As DP_ALERTE_PRODUITRowChangeEventHandler _ Public Event DP_ALERTE_PRODUITRowDeleting As DP_ALERTE_PRODUITRowChangeEventHandler _ Public Event DP_ALERTE_PRODUITRowDeleted As DP_ALERTE_PRODUITRowChangeEventHandler _ Public Overloads Sub AddDP_ALERTE_PRODUITRow(ByVal row As DP_ALERTE_PRODUITRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddDP_ALERTE_PRODUITRow(ByVal CIP As String, ByVal MsgRef As String, ByVal Lots As String, ByVal Vue As Boolean) As DP_ALERTE_PRODUITRow Dim rowDP_ALERTE_PRODUITRow As DP_ALERTE_PRODUITRow = CType(Me.NewRow,DP_ALERTE_PRODUITRow) Dim columnValuesArray() As Object = New Object() {CIP, MsgRef, Lots, Vue} rowDP_ALERTE_PRODUITRow.ItemArray = columnValuesArray Me.Rows.Add(rowDP_ALERTE_PRODUITRow) Return rowDP_ALERTE_PRODUITRow End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As DP_ALERTE_PRODUITDataTable = CType(MyBase.Clone,DP_ALERTE_PRODUITDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New DP_ALERTE_PRODUITDataTable() End Function _ Friend Sub InitVars() Me.columnCIP = MyBase.Columns("CIP") Me.columnMsgRef = MyBase.Columns("MsgRef") Me.columnLots = MyBase.Columns("Lots") Me.columnVue = MyBase.Columns("Vue") End Sub _ Private Sub InitClass() Me.columnCIP = New Global.System.Data.DataColumn("CIP", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnCIP) Me.columnMsgRef = New Global.System.Data.DataColumn("MsgRef", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnMsgRef) Me.columnLots = New Global.System.Data.DataColumn("Lots", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnLots) Me.columnVue = New Global.System.Data.DataColumn("Vue", GetType(Boolean), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnVue) Me.columnCIP.MaxLength = 50 Me.columnMsgRef.MaxLength = 2147483647 Me.columnLots.MaxLength = 2147483647 End Sub _ Public Function NewDP_ALERTE_PRODUITRow() As DP_ALERTE_PRODUITRow Return CType(Me.NewRow,DP_ALERTE_PRODUITRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New DP_ALERTE_PRODUITRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(DP_ALERTE_PRODUITRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.DP_ALERTE_PRODUITRowChangedEvent) Is Nothing) Then RaiseEvent DP_ALERTE_PRODUITRowChanged(Me, New DP_ALERTE_PRODUITRowChangeEvent(CType(e.Row,DP_ALERTE_PRODUITRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.DP_ALERTE_PRODUITRowChangingEvent) Is Nothing) Then RaiseEvent DP_ALERTE_PRODUITRowChanging(Me, New DP_ALERTE_PRODUITRowChangeEvent(CType(e.Row,DP_ALERTE_PRODUITRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.DP_ALERTE_PRODUITRowDeletedEvent) Is Nothing) Then RaiseEvent DP_ALERTE_PRODUITRowDeleted(Me, New DP_ALERTE_PRODUITRowChangeEvent(CType(e.Row,DP_ALERTE_PRODUITRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.DP_ALERTE_PRODUITRowDeletingEvent) Is Nothing) Then RaiseEvent DP_ALERTE_PRODUITRowDeleting(Me, New DP_ALERTE_PRODUITRowChangeEvent(CType(e.Row,DP_ALERTE_PRODUITRow), e.Action)) End If End Sub _ Public Sub RemoveDP_ALERTE_PRODUITRow(ByVal row As DP_ALERTE_PRODUITRow) 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 PharmaDataSet1 = New PharmaDataSet1() 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 = "DP_ALERTE_PRODUITDataTable" 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 DP_MsgDataTable Inherits Global.System.Data.TypedTableBase(Of DP_MsgRow) Private columnMsgRef As Global.System.Data.DataColumn Private columnMsgTyp As Global.System.Data.DataColumn Private columnMsgLect As Global.System.Data.DataColumn Private columnMsgDate As Global.System.Data.DataColumn Private columnMsgExpi As Global.System.Data.DataColumn Private columnReader As Global.System.Data.DataColumn Private columnAR_sent As Global.System.Data.DataColumn Private columnAR_Statut As Global.System.Data.DataColumn Private columnAR_nbr_transmission As Global.System.Data.DataColumn Private columnAR_next_trans_time As Global.System.Data.DataColumn Private columnMsgEme As Global.System.Data.DataColumn Private columnMsgTit As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "DP_Msg" 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 MsgRefColumn() As Global.System.Data.DataColumn Get Return Me.columnMsgRef End Get End Property _ Public ReadOnly Property MsgTypColumn() As Global.System.Data.DataColumn Get Return Me.columnMsgTyp End Get End Property _ Public ReadOnly Property MsgLectColumn() As Global.System.Data.DataColumn Get Return Me.columnMsgLect End Get End Property _ Public ReadOnly Property MsgDateColumn() As Global.System.Data.DataColumn Get Return Me.columnMsgDate End Get End Property _ Public ReadOnly Property MsgExpiColumn() As Global.System.Data.DataColumn Get Return Me.columnMsgExpi End Get End Property _ Public ReadOnly Property ReaderColumn() As Global.System.Data.DataColumn Get Return Me.columnReader End Get End Property _ Public ReadOnly Property AR_sentColumn() As Global.System.Data.DataColumn Get Return Me.columnAR_sent End Get End Property _ Public ReadOnly Property AR_StatutColumn() As Global.System.Data.DataColumn Get Return Me.columnAR_Statut End Get End Property _ Public ReadOnly Property AR_nbr_transmissionColumn() As Global.System.Data.DataColumn Get Return Me.columnAR_nbr_transmission End Get End Property _ Public ReadOnly Property AR_next_trans_timeColumn() As Global.System.Data.DataColumn Get Return Me.columnAR_next_trans_time End Get End Property _ Public ReadOnly Property MsgEmeColumn() As Global.System.Data.DataColumn Get Return Me.columnMsgEme End Get End Property _ Public ReadOnly Property MsgTitColumn() As Global.System.Data.DataColumn Get Return Me.columnMsgTit 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 DP_MsgRow Get Return CType(Me.Rows(index),DP_MsgRow) End Get End Property _ Public Event DP_MsgRowChanging As DP_MsgRowChangeEventHandler _ Public Event DP_MsgRowChanged As DP_MsgRowChangeEventHandler _ Public Event DP_MsgRowDeleting As DP_MsgRowChangeEventHandler _ Public Event DP_MsgRowDeleted As DP_MsgRowChangeEventHandler _ Public Overloads Sub AddDP_MsgRow(ByVal row As DP_MsgRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddDP_MsgRow(ByVal MsgRef As String, ByVal MsgTyp As String, ByVal MsgLect As Date, ByVal MsgDate As Date, ByVal MsgExpi As Date, ByVal Reader As String, ByVal AR_sent As Boolean, ByVal AR_Statut As String, ByVal AR_nbr_transmission As Decimal, ByVal AR_next_trans_time As Date, ByVal MsgEme As String, ByVal MsgTit As String) As DP_MsgRow Dim rowDP_MsgRow As DP_MsgRow = CType(Me.NewRow,DP_MsgRow) Dim columnValuesArray() As Object = New Object() {MsgRef, MsgTyp, MsgLect, MsgDate, MsgExpi, Reader, AR_sent, AR_Statut, AR_nbr_transmission, AR_next_trans_time, MsgEme, MsgTit} rowDP_MsgRow.ItemArray = columnValuesArray Me.Rows.Add(rowDP_MsgRow) Return rowDP_MsgRow End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As DP_MsgDataTable = CType(MyBase.Clone,DP_MsgDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New DP_MsgDataTable() End Function _ Friend Sub InitVars() Me.columnMsgRef = MyBase.Columns("MsgRef") Me.columnMsgTyp = MyBase.Columns("MsgTyp") Me.columnMsgLect = MyBase.Columns("MsgLect") Me.columnMsgDate = MyBase.Columns("MsgDate") Me.columnMsgExpi = MyBase.Columns("MsgExpi") Me.columnReader = MyBase.Columns("Reader") Me.columnAR_sent = MyBase.Columns("AR_sent") Me.columnAR_Statut = MyBase.Columns("AR_Statut") Me.columnAR_nbr_transmission = MyBase.Columns("AR_nbr_transmission") Me.columnAR_next_trans_time = MyBase.Columns("AR_next_trans_time") Me.columnMsgEme = MyBase.Columns("MsgEme") Me.columnMsgTit = MyBase.Columns("MsgTit") End Sub _ Private Sub InitClass() Me.columnMsgRef = New Global.System.Data.DataColumn("MsgRef", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnMsgRef) Me.columnMsgTyp = New Global.System.Data.DataColumn("MsgTyp", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnMsgTyp) Me.columnMsgLect = New Global.System.Data.DataColumn("MsgLect", GetType(Date), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnMsgLect) Me.columnMsgDate = New Global.System.Data.DataColumn("MsgDate", GetType(Date), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnMsgDate) Me.columnMsgExpi = New Global.System.Data.DataColumn("MsgExpi", GetType(Date), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnMsgExpi) Me.columnReader = New Global.System.Data.DataColumn("Reader", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnReader) Me.columnAR_sent = New Global.System.Data.DataColumn("AR_sent", GetType(Boolean), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnAR_sent) Me.columnAR_Statut = New Global.System.Data.DataColumn("AR_Statut", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnAR_Statut) Me.columnAR_nbr_transmission = New Global.System.Data.DataColumn("AR_nbr_transmission", GetType(Decimal), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnAR_nbr_transmission) Me.columnAR_next_trans_time = New Global.System.Data.DataColumn("AR_next_trans_time", GetType(Date), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnAR_next_trans_time) Me.columnMsgEme = New Global.System.Data.DataColumn("MsgEme", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnMsgEme) Me.columnMsgTit = New Global.System.Data.DataColumn("MsgTit", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnMsgTit) Me.columnMsgRef.MaxLength = 50 Me.columnMsgTyp.MaxLength = 50 Me.columnReader.MaxLength = 2147483647 Me.columnAR_Statut.MaxLength = 2147483647 Me.columnMsgEme.MaxLength = 2147483647 Me.columnMsgTit.MaxLength = 2147483647 End Sub _ Public Function NewDP_MsgRow() As DP_MsgRow Return CType(Me.NewRow,DP_MsgRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New DP_MsgRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(DP_MsgRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.DP_MsgRowChangedEvent) Is Nothing) Then RaiseEvent DP_MsgRowChanged(Me, New DP_MsgRowChangeEvent(CType(e.Row,DP_MsgRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.DP_MsgRowChangingEvent) Is Nothing) Then RaiseEvent DP_MsgRowChanging(Me, New DP_MsgRowChangeEvent(CType(e.Row,DP_MsgRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.DP_MsgRowDeletedEvent) Is Nothing) Then RaiseEvent DP_MsgRowDeleted(Me, New DP_MsgRowChangeEvent(CType(e.Row,DP_MsgRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.DP_MsgRowDeletingEvent) Is Nothing) Then RaiseEvent DP_MsgRowDeleting(Me, New DP_MsgRowChangeEvent(CType(e.Row,DP_MsgRow), e.Action)) End If End Sub _ Public Sub RemoveDP_MsgRow(ByVal row As DP_MsgRow) 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 PharmaDataSet1 = New PharmaDataSet1() 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 = "DP_MsgDataTable" 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 DP_ReqDataTable Inherits Global.System.Data.TypedTableBase(Of DP_ReqRow) Private columnSequence_Number As Global.System.Data.DataColumn Private columnReqId As Global.System.Data.DataColumn Private columnStatut As Global.System.Data.DataColumn Private columnnext_trans_time As Global.System.Data.DataColumn Private columnnbr_trans As Global.System.Data.DataColumn Private columnIdentifiant_patient As Global.System.Data.DataColumn Private columnréférence_interne As Global.System.Data.DataColumn _ Public Sub New() MyBase.New Me.TableName = "DP_Req" 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 Sequence_NumberColumn() As Global.System.Data.DataColumn Get Return Me.columnSequence_Number End Get End Property _ Public ReadOnly Property ReqIdColumn() As Global.System.Data.DataColumn Get Return Me.columnReqId End Get End Property _ Public ReadOnly Property StatutColumn() As Global.System.Data.DataColumn Get Return Me.columnStatut End Get End Property _ Public ReadOnly Property next_trans_timeColumn() As Global.System.Data.DataColumn Get Return Me.columnnext_trans_time End Get End Property _ Public ReadOnly Property nbr_transColumn() As Global.System.Data.DataColumn Get Return Me.columnnbr_trans End Get End Property _ Public ReadOnly Property Identifiant_patientColumn() As Global.System.Data.DataColumn Get Return Me.columnIdentifiant_patient End Get End Property _ Public ReadOnly Property référence_interneColumn() As Global.System.Data.DataColumn Get Return Me.columnréférence_interne 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 DP_ReqRow Get Return CType(Me.Rows(index),DP_ReqRow) End Get End Property _ Public Event DP_ReqRowChanging As DP_ReqRowChangeEventHandler _ Public Event DP_ReqRowChanged As DP_ReqRowChangeEventHandler _ Public Event DP_ReqRowDeleting As DP_ReqRowChangeEventHandler _ Public Event DP_ReqRowDeleted As DP_ReqRowChangeEventHandler _ Public Overloads Sub AddDP_ReqRow(ByVal row As DP_ReqRow) Me.Rows.Add(row) End Sub _ Public Overloads Function AddDP_ReqRow(ByVal Sequence_Number As String, ByVal ReqId As String, ByVal Statut As String, ByVal next_trans_time As Date, ByVal nbr_trans As Integer, ByVal Identifiant_patient As String, ByVal référence_interne As String) As DP_ReqRow Dim rowDP_ReqRow As DP_ReqRow = CType(Me.NewRow,DP_ReqRow) Dim columnValuesArray() As Object = New Object() {Sequence_Number, ReqId, Statut, next_trans_time, nbr_trans, Identifiant_patient, référence_interne} rowDP_ReqRow.ItemArray = columnValuesArray Me.Rows.Add(rowDP_ReqRow) Return rowDP_ReqRow End Function _ Public Overrides Function Clone() As Global.System.Data.DataTable Dim cln As DP_ReqDataTable = CType(MyBase.Clone,DP_ReqDataTable) cln.InitVars Return cln End Function _ Protected Overrides Function CreateInstance() As Global.System.Data.DataTable Return New DP_ReqDataTable() End Function _ Friend Sub InitVars() Me.columnSequence_Number = MyBase.Columns("Sequence_Number") Me.columnReqId = MyBase.Columns("ReqId") Me.columnStatut = MyBase.Columns("Statut") Me.columnnext_trans_time = MyBase.Columns("next_trans_time") Me.columnnbr_trans = MyBase.Columns("nbr_trans") Me.columnIdentifiant_patient = MyBase.Columns("Identifiant_patient") Me.columnréférence_interne = MyBase.Columns("référence_interne") End Sub _ Private Sub InitClass() Me.columnSequence_Number = New Global.System.Data.DataColumn("Sequence_Number", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnSequence_Number) Me.columnReqId = New Global.System.Data.DataColumn("ReqId", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnReqId) Me.columnStatut = New Global.System.Data.DataColumn("Statut", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnStatut) Me.columnnext_trans_time = New Global.System.Data.DataColumn("next_trans_time", GetType(Date), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnnext_trans_time) Me.columnnbr_trans = New Global.System.Data.DataColumn("nbr_trans", GetType(Integer), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnnbr_trans) Me.columnIdentifiant_patient = New Global.System.Data.DataColumn("Identifiant_patient", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnIdentifiant_patient) Me.columnréférence_interne = New Global.System.Data.DataColumn("référence_interne", GetType(String), Nothing, Global.System.Data.MappingType.Element) MyBase.Columns.Add(Me.columnréférence_interne) Me.columnSequence_Number.MaxLength = 50 Me.columnReqId.MaxLength = 50 Me.columnStatut.MaxLength = 2147483647 Me.columnIdentifiant_patient.MaxLength = 2147483647 Me.columnréférence_interne.MaxLength = 2147483647 End Sub _ Public Function NewDP_ReqRow() As DP_ReqRow Return CType(Me.NewRow,DP_ReqRow) End Function _ Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow Return New DP_ReqRow(builder) End Function _ Protected Overrides Function GetRowType() As Global.System.Type Return GetType(DP_ReqRow) End Function _ Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanged(e) If (Not (Me.DP_ReqRowChangedEvent) Is Nothing) Then RaiseEvent DP_ReqRowChanged(Me, New DP_ReqRowChangeEvent(CType(e.Row,DP_ReqRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowChanging(e) If (Not (Me.DP_ReqRowChangingEvent) Is Nothing) Then RaiseEvent DP_ReqRowChanging(Me, New DP_ReqRowChangeEvent(CType(e.Row,DP_ReqRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleted(e) If (Not (Me.DP_ReqRowDeletedEvent) Is Nothing) Then RaiseEvent DP_ReqRowDeleted(Me, New DP_ReqRowChangeEvent(CType(e.Row,DP_ReqRow), e.Action)) End If End Sub _ Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs) MyBase.OnRowDeleting(e) If (Not (Me.DP_ReqRowDeletingEvent) Is Nothing) Then RaiseEvent DP_ReqRowDeleting(Me, New DP_ReqRowChangeEvent(CType(e.Row,DP_ReqRow), e.Action)) End If End Sub _ Public Sub RemoveDP_ReqRow(ByVal row As DP_ReqRow) 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 PharmaDataSet1 = New PharmaDataSet1() 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 = "DP_ReqDataTable" 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 DP_ALERTE_PRODUITRow Inherits Global.System.Data.DataRow Private tableDP_ALERTE_PRODUIT As DP_ALERTE_PRODUITDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tableDP_ALERTE_PRODUIT = CType(Me.Table,DP_ALERTE_PRODUITDataTable) End Sub _ Public Property CIP() As String Get Try Return CType(Me(Me.tableDP_ALERTE_PRODUIT.CIPColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'CIP' dans la table 'DP_ALERTE_PRODUIT' est DBNull.", e) End Try End Get Set Me(Me.tableDP_ALERTE_PRODUIT.CIPColumn) = value End Set End Property _ Public Property MsgRef() As String Get Try Return CType(Me(Me.tableDP_ALERTE_PRODUIT.MsgRefColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'MsgRef' dans la table 'DP_ALERTE_PRODUIT' est DBNull.", e) End Try End Get Set Me(Me.tableDP_ALERTE_PRODUIT.MsgRefColumn) = value End Set End Property _ Public Property Lots() As String Get Try Return CType(Me(Me.tableDP_ALERTE_PRODUIT.LotsColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'Lots' dans la table 'DP_ALERTE_PRODUIT' est DBNull.", e) End Try End Get Set Me(Me.tableDP_ALERTE_PRODUIT.LotsColumn) = value End Set End Property _ Public Property Vue() As Boolean Get Try Return CType(Me(Me.tableDP_ALERTE_PRODUIT.VueColumn),Boolean) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'Vue' dans la table 'DP_ALERTE_PRODUIT' est DBNull.", e) End Try End Get Set Me(Me.tableDP_ALERTE_PRODUIT.VueColumn) = value End Set End Property _ Public Function IsCIPNull() As Boolean Return Me.IsNull(Me.tableDP_ALERTE_PRODUIT.CIPColumn) End Function _ Public Sub SetCIPNull() Me(Me.tableDP_ALERTE_PRODUIT.CIPColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsMsgRefNull() As Boolean Return Me.IsNull(Me.tableDP_ALERTE_PRODUIT.MsgRefColumn) End Function _ Public Sub SetMsgRefNull() Me(Me.tableDP_ALERTE_PRODUIT.MsgRefColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsLotsNull() As Boolean Return Me.IsNull(Me.tableDP_ALERTE_PRODUIT.LotsColumn) End Function _ Public Sub SetLotsNull() Me(Me.tableDP_ALERTE_PRODUIT.LotsColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsVueNull() As Boolean Return Me.IsNull(Me.tableDP_ALERTE_PRODUIT.VueColumn) End Function _ Public Sub SetVueNull() Me(Me.tableDP_ALERTE_PRODUIT.VueColumn) = Global.System.Convert.DBNull End Sub End Class ''' '''Represents strongly named DataRow class. ''' Partial Public Class DP_MsgRow Inherits Global.System.Data.DataRow Private tableDP_Msg As DP_MsgDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tableDP_Msg = CType(Me.Table,DP_MsgDataTable) End Sub _ Public Property MsgRef() As String Get Try Return CType(Me(Me.tableDP_Msg.MsgRefColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'MsgRef' dans la table 'DP_Msg' est DBNull.", e) End Try End Get Set Me(Me.tableDP_Msg.MsgRefColumn) = value End Set End Property _ Public Property MsgTyp() As String Get Try Return CType(Me(Me.tableDP_Msg.MsgTypColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'MsgTyp' dans la table 'DP_Msg' est DBNull.", e) End Try End Get Set Me(Me.tableDP_Msg.MsgTypColumn) = value End Set End Property _ Public Property MsgLect() As Date Get Try Return CType(Me(Me.tableDP_Msg.MsgLectColumn),Date) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'MsgLect' dans la table 'DP_Msg' est DBNull.", e) End Try End Get Set Me(Me.tableDP_Msg.MsgLectColumn) = value End Set End Property _ Public Property MsgDate() As Date Get Try Return CType(Me(Me.tableDP_Msg.MsgDateColumn),Date) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'MsgDate' dans la table 'DP_Msg' est DBNull.", e) End Try End Get Set Me(Me.tableDP_Msg.MsgDateColumn) = value End Set End Property _ Public Property MsgExpi() As Date Get Try Return CType(Me(Me.tableDP_Msg.MsgExpiColumn),Date) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'MsgExpi' dans la table 'DP_Msg' est DBNull.", e) End Try End Get Set Me(Me.tableDP_Msg.MsgExpiColumn) = value End Set End Property _ Public Property Reader() As String Get Try Return CType(Me(Me.tableDP_Msg.ReaderColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'Reader' dans la table 'DP_Msg' est DBNull.", e) End Try End Get Set Me(Me.tableDP_Msg.ReaderColumn) = value End Set End Property _ Public Property AR_sent() As Boolean Get Try Return CType(Me(Me.tableDP_Msg.AR_sentColumn),Boolean) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'AR_sent' dans la table 'DP_Msg' est DBNull.", e) End Try End Get Set Me(Me.tableDP_Msg.AR_sentColumn) = value End Set End Property _ Public Property AR_Statut() As String Get Try Return CType(Me(Me.tableDP_Msg.AR_StatutColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'AR_Statut' dans la table 'DP_Msg' est DBNull.", e) End Try End Get Set Me(Me.tableDP_Msg.AR_StatutColumn) = value End Set End Property _ Public Property AR_nbr_transmission() As Decimal Get Try Return CType(Me(Me.tableDP_Msg.AR_nbr_transmissionColumn),Decimal) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'AR_nbr_transmission' dans la table 'DP_Msg' est DBNull"& _ ".", e) End Try End Get Set Me(Me.tableDP_Msg.AR_nbr_transmissionColumn) = value End Set End Property _ Public Property AR_next_trans_time() As Date Get Try Return CType(Me(Me.tableDP_Msg.AR_next_trans_timeColumn),Date) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'AR_next_trans_time' dans la table 'DP_Msg' est DBNull."& _ "", e) End Try End Get Set Me(Me.tableDP_Msg.AR_next_trans_timeColumn) = value End Set End Property _ Public Property MsgEme() As String Get Try Return CType(Me(Me.tableDP_Msg.MsgEmeColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'MsgEme' dans la table 'DP_Msg' est DBNull.", e) End Try End Get Set Me(Me.tableDP_Msg.MsgEmeColumn) = value End Set End Property _ Public Property MsgTit() As String Get Try Return CType(Me(Me.tableDP_Msg.MsgTitColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'MsgTit' dans la table 'DP_Msg' est DBNull.", e) End Try End Get Set Me(Me.tableDP_Msg.MsgTitColumn) = value End Set End Property _ Public Function IsMsgRefNull() As Boolean Return Me.IsNull(Me.tableDP_Msg.MsgRefColumn) End Function _ Public Sub SetMsgRefNull() Me(Me.tableDP_Msg.MsgRefColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsMsgTypNull() As Boolean Return Me.IsNull(Me.tableDP_Msg.MsgTypColumn) End Function _ Public Sub SetMsgTypNull() Me(Me.tableDP_Msg.MsgTypColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsMsgLectNull() As Boolean Return Me.IsNull(Me.tableDP_Msg.MsgLectColumn) End Function _ Public Sub SetMsgLectNull() Me(Me.tableDP_Msg.MsgLectColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsMsgDateNull() As Boolean Return Me.IsNull(Me.tableDP_Msg.MsgDateColumn) End Function _ Public Sub SetMsgDateNull() Me(Me.tableDP_Msg.MsgDateColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsMsgExpiNull() As Boolean Return Me.IsNull(Me.tableDP_Msg.MsgExpiColumn) End Function _ Public Sub SetMsgExpiNull() Me(Me.tableDP_Msg.MsgExpiColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsReaderNull() As Boolean Return Me.IsNull(Me.tableDP_Msg.ReaderColumn) End Function _ Public Sub SetReaderNull() Me(Me.tableDP_Msg.ReaderColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsAR_sentNull() As Boolean Return Me.IsNull(Me.tableDP_Msg.AR_sentColumn) End Function _ Public Sub SetAR_sentNull() Me(Me.tableDP_Msg.AR_sentColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsAR_StatutNull() As Boolean Return Me.IsNull(Me.tableDP_Msg.AR_StatutColumn) End Function _ Public Sub SetAR_StatutNull() Me(Me.tableDP_Msg.AR_StatutColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsAR_nbr_transmissionNull() As Boolean Return Me.IsNull(Me.tableDP_Msg.AR_nbr_transmissionColumn) End Function _ Public Sub SetAR_nbr_transmissionNull() Me(Me.tableDP_Msg.AR_nbr_transmissionColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsAR_next_trans_timeNull() As Boolean Return Me.IsNull(Me.tableDP_Msg.AR_next_trans_timeColumn) End Function _ Public Sub SetAR_next_trans_timeNull() Me(Me.tableDP_Msg.AR_next_trans_timeColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsMsgEmeNull() As Boolean Return Me.IsNull(Me.tableDP_Msg.MsgEmeColumn) End Function _ Public Sub SetMsgEmeNull() Me(Me.tableDP_Msg.MsgEmeColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsMsgTitNull() As Boolean Return Me.IsNull(Me.tableDP_Msg.MsgTitColumn) End Function _ Public Sub SetMsgTitNull() Me(Me.tableDP_Msg.MsgTitColumn) = Global.System.Convert.DBNull End Sub End Class ''' '''Represents strongly named DataRow class. ''' Partial Public Class DP_ReqRow Inherits Global.System.Data.DataRow Private tableDP_Req As DP_ReqDataTable _ Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder) MyBase.New(rb) Me.tableDP_Req = CType(Me.Table,DP_ReqDataTable) End Sub _ Public Property Sequence_Number() As String Get Try Return CType(Me(Me.tableDP_Req.Sequence_NumberColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'Sequence_Number' dans la table 'DP_Req' est DBNull.", e) End Try End Get Set Me(Me.tableDP_Req.Sequence_NumberColumn) = value End Set End Property _ Public Property ReqId() As String Get Try Return CType(Me(Me.tableDP_Req.ReqIdColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'ReqId' dans la table 'DP_Req' est DBNull.", e) End Try End Get Set Me(Me.tableDP_Req.ReqIdColumn) = value End Set End Property _ Public Property Statut() As String Get Try Return CType(Me(Me.tableDP_Req.StatutColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'Statut' dans la table 'DP_Req' est DBNull.", e) End Try End Get Set Me(Me.tableDP_Req.StatutColumn) = value End Set End Property _ Public Property next_trans_time() As Date Get Try Return CType(Me(Me.tableDP_Req.next_trans_timeColumn),Date) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'next_trans_time' dans la table 'DP_Req' est DBNull.", e) End Try End Get Set Me(Me.tableDP_Req.next_trans_timeColumn) = value End Set End Property _ Public Property nbr_trans() As Integer Get Try Return CType(Me(Me.tableDP_Req.nbr_transColumn),Integer) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'nbr_trans' dans la table 'DP_Req' est DBNull.", e) End Try End Get Set Me(Me.tableDP_Req.nbr_transColumn) = value End Set End Property _ Public Property Identifiant_patient() As String Get Try Return CType(Me(Me.tableDP_Req.Identifiant_patientColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'Identifiant_patient' dans la table 'DP_Req' est DBNull"& _ ".", e) End Try End Get Set Me(Me.tableDP_Req.Identifiant_patientColumn) = value End Set End Property _ Public Property référence_interne() As String Get Try Return CType(Me(Me.tableDP_Req.référence_interneColumn),String) Catch e As Global.System.InvalidCastException Throw New Global.System.Data.StrongTypingException("La valeur pour la colonne 'référence_interne' dans la table 'DP_Req' est DBNull.", e) End Try End Get Set Me(Me.tableDP_Req.référence_interneColumn) = value End Set End Property _ Public Function IsSequence_NumberNull() As Boolean Return Me.IsNull(Me.tableDP_Req.Sequence_NumberColumn) End Function _ Public Sub SetSequence_NumberNull() Me(Me.tableDP_Req.Sequence_NumberColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsReqIdNull() As Boolean Return Me.IsNull(Me.tableDP_Req.ReqIdColumn) End Function _ Public Sub SetReqIdNull() Me(Me.tableDP_Req.ReqIdColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsStatutNull() As Boolean Return Me.IsNull(Me.tableDP_Req.StatutColumn) End Function _ Public Sub SetStatutNull() Me(Me.tableDP_Req.StatutColumn) = Global.System.Convert.DBNull End Sub _ Public Function Isnext_trans_timeNull() As Boolean Return Me.IsNull(Me.tableDP_Req.next_trans_timeColumn) End Function _ Public Sub Setnext_trans_timeNull() Me(Me.tableDP_Req.next_trans_timeColumn) = Global.System.Convert.DBNull End Sub _ Public Function Isnbr_transNull() As Boolean Return Me.IsNull(Me.tableDP_Req.nbr_transColumn) End Function _ Public Sub Setnbr_transNull() Me(Me.tableDP_Req.nbr_transColumn) = Global.System.Convert.DBNull End Sub _ Public Function IsIdentifiant_patientNull() As Boolean Return Me.IsNull(Me.tableDP_Req.Identifiant_patientColumn) End Function _ Public Sub SetIdentifiant_patientNull() Me(Me.tableDP_Req.Identifiant_patientColumn) = Global.System.Convert.DBNull End Sub _ Public Function Isréférence_interneNull() As Boolean Return Me.IsNull(Me.tableDP_Req.référence_interneColumn) End Function _ Public Sub Setréférence_interneNull() Me(Me.tableDP_Req.référence_interneColumn) = Global.System.Convert.DBNull End Sub End Class ''' '''Row event argument class ''' _ Public Class DP_ALERTE_PRODUITRowChangeEvent Inherits Global.System.EventArgs Private eventRow As DP_ALERTE_PRODUITRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As DP_ALERTE_PRODUITRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As DP_ALERTE_PRODUITRow 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 DP_MsgRowChangeEvent Inherits Global.System.EventArgs Private eventRow As DP_MsgRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As DP_MsgRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As DP_MsgRow 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 DP_ReqRowChangeEvent Inherits Global.System.EventArgs Private eventRow As DP_ReqRow Private eventAction As Global.System.Data.DataRowAction _ Public Sub New(ByVal row As DP_ReqRow, ByVal action As Global.System.Data.DataRowAction) MyBase.New Me.eventRow = row Me.eventAction = action End Sub _ Public ReadOnly Property Row() As DP_ReqRow 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 PharmaDataSet1TableAdapters ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class DP_ALERTE_PRODUITTableAdapter 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 = "DP_ALERTE_PRODUIT" tableMapping.ColumnMappings.Add("CIP", "CIP") tableMapping.ColumnMappings.Add("MsgRef", "MsgRef") tableMapping.ColumnMappings.Add("Lots", "Lots") tableMapping.ColumnMappings.Add("Vue", "Vue") Me._adapter.TableMappings.Add(tableMapping) Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand() Me._adapter.InsertCommand.Connection = Me.Connection Me._adapter.InsertCommand.CommandText = "INSERT INTO [dbo].[DP_ALERTE_PRODUIT] ([CIP], [MsgRef], [Lots], [Vue]) VALUES (@C"& _ "IP, @MsgRef, @Lots, @Vue)" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CIP", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CIP", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@MsgRef", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "MsgRef", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Lots", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Lots", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Vue", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Vue", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", "")) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() Me._connection.ConnectionString = Global.DP_Relay.My.MySettings.Default.PharmaConnectionString End Sub _ Private Sub InitCommandCollection() Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(1) {} Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(0).Connection = Me.Connection Me._commandCollection(0).CommandText = "SELECT CIP, MsgRef, Lots, Vue FROM dbo.DP_ALERTE_PRODUIT" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text Me._commandCollection(1) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(1).Connection = Me.Connection Me._commandCollection(1).CommandText = "SELECT CIP, MsgRef, Lots, Vue FROM DP_ALERTE_PRODUIT WHERE (CIP = @CIP) AND (MsgR" & _ "ef = @MsgRef) AND (Lots = @Lots)" Me._commandCollection(1).CommandType = Global.System.Data.CommandType.Text Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CIP", Global.System.Data.SqlDbType.NVarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "CIP", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@MsgRef", Global.System.Data.SqlDbType.NVarChar, 2147483647, Global.System.Data.ParameterDirection.Input, 0, 0, "MsgRef", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Lots", Global.System.Data.SqlDbType.NVarChar, 2147483647, Global.System.Data.ParameterDirection.Input, 0, 0, "Lots", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) End Sub _ Public Overridable Overloads Function Fill(ByVal dataTable As PharmaDataSet1.DP_ALERTE_PRODUITDataTable) 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 Overridable Overloads Function GetData() As PharmaDataSet1.DP_ALERTE_PRODUITDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As PharmaDataSet1.DP_ALERTE_PRODUITDataTable = New PharmaDataSet1.DP_ALERTE_PRODUITDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overridable Overloads Function GetData_unique(ByVal CIP As String, ByVal MsgRef As String, ByVal Lots As String) As PharmaDataSet1.DP_ALERTE_PRODUITDataTable Me.Adapter.SelectCommand = Me.CommandCollection(1) If (CIP Is Nothing) Then Me.Adapter.SelectCommand.Parameters(0).Value = Global.System.DBNull.Value Else Me.Adapter.SelectCommand.Parameters(0).Value = CType(CIP, String) End If If (MsgRef Is Nothing) Then Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.SelectCommand.Parameters(1).Value = CType(MsgRef, String) End If If (Lots Is Nothing) Then Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value Else Me.Adapter.SelectCommand.Parameters(2).Value = CType(Lots, String) End If Dim dataTable As PharmaDataSet1.DP_ALERTE_PRODUITDataTable = New PharmaDataSet1.DP_ALERTE_PRODUITDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overridable Overloads Function Update(ByVal dataTable As PharmaDataSet1.DP_ALERTE_PRODUITDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function _ Public Overridable Overloads Function Update(ByVal dataSet As PharmaDataSet1) As Integer Return Me.Adapter.Update(dataSet, "DP_ALERTE_PRODUIT") End Function _ Public Overridable Overloads Function Update(ByVal dataRow As Global.System.Data.DataRow) As Integer Return Me.Adapter.Update(New Global.System.Data.DataRow() {dataRow}) End Function _ Public Overridable Overloads Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer Return Me.Adapter.Update(dataRows) End Function _ Public Overridable Overloads Function Insert(ByVal CIP As String, ByVal MsgRef As String, ByVal Lots As String, ByVal Vue As Global.System.Nullable(Of Boolean)) As Integer If (CIP Is Nothing) Then Me.Adapter.InsertCommand.Parameters(0).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(0).Value = CType(CIP, String) End If If (MsgRef Is Nothing) Then Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(1).Value = CType(MsgRef, String) End If If (Lots Is Nothing) Then Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(2).Value = CType(Lots, String) End If If (Vue.HasValue = True) Then Me.Adapter.InsertCommand.Parameters(3).Value = CType(Vue.Value, Boolean) Else Me.Adapter.InsertCommand.Parameters(3).Value = Global.System.DBNull.Value End If Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.InsertCommand.Connection.State If ((Me.Adapter.InsertCommand.Connection.State And Global.System.Data.ConnectionState.Open) _ <> Global.System.Data.ConnectionState.Open) Then Me.Adapter.InsertCommand.Connection.Open() End If Try Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery Return returnValue Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then Me.Adapter.InsertCommand.Connection.Close() End If End Try End Function End Class ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class DP_MsgTableAdapter 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(value As Global.System.Data.SqlClient.SqlConnection) 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(value As Global.System.Data.SqlClient.SqlTransaction) 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(value As Boolean) 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 = "DP_Msg" tableMapping.ColumnMappings.Add("MsgRef", "MsgRef") tableMapping.ColumnMappings.Add("MsgTyp", "MsgTyp") tableMapping.ColumnMappings.Add("MsgLect", "MsgLect") tableMapping.ColumnMappings.Add("MsgDate", "MsgDate") tableMapping.ColumnMappings.Add("MsgExpi", "MsgExpi") tableMapping.ColumnMappings.Add("Reader", "Reader") tableMapping.ColumnMappings.Add("AR_sent", "AR_sent") tableMapping.ColumnMappings.Add("AR_Statut", "AR_Statut") tableMapping.ColumnMappings.Add("AR_nbr_transmission", "AR_nbr_transmission") tableMapping.ColumnMappings.Add("AR_next_trans_time", "AR_next_trans_time") tableMapping.ColumnMappings.Add("MsgEme", "MsgEme") tableMapping.ColumnMappings.Add("MsgTit", "MsgTit") Me._adapter.TableMappings.Add(tableMapping) Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand() Me._adapter.InsertCommand.Connection = Me.Connection Me._adapter.InsertCommand.CommandText = "INSERT INTO [dbo].[DP_Msg] ([MsgRef], [MsgTyp], [MsgLect], [MsgDate], [MsgExpi], " & _ "[Reader], [AR_sent], [AR_Statut], [AR_nbr_transmission], [AR_next_trans_time], [" & _ "MsgEme], [MsgTit]) VALUES (@MsgRef, @MsgTyp, @MsgLect, @MsgDate, @MsgExpi, @Read" & _ "er, @AR_sent, @AR_Statut, @AR_nbr_transmission, @AR_next_trans_time, @MsgEme, @M" & _ "sgTit)" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@MsgRef", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "MsgRef", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@MsgTyp", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "MsgTyp", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@MsgLect", Global.System.Data.SqlDbType.[Date], 0, Global.System.Data.ParameterDirection.Input, 0, 0, "MsgLect", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@MsgDate", Global.System.Data.SqlDbType.[Date], 0, Global.System.Data.ParameterDirection.Input, 0, 0, "MsgDate", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@MsgExpi", Global.System.Data.SqlDbType.[Date], 0, Global.System.Data.ParameterDirection.Input, 0, 0, "MsgExpi", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Reader", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Reader", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@AR_sent", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "AR_sent", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@AR_Statut", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "AR_Statut", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@AR_nbr_transmission", Global.System.Data.SqlDbType.[Decimal], 0, Global.System.Data.ParameterDirection.Input, 18, 0, "AR_nbr_transmission", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@AR_next_trans_time", Global.System.Data.SqlDbType.DateTime, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "AR_next_trans_time", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@MsgEme", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "MsgEme", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@MsgTit", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "MsgTit", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() Me._connection.ConnectionString = Global.DP_Relay.My.MySettings.Default.PharmaConnectionString End Sub _ Private Sub InitCommandCollection() Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(3) {} Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(0).Connection = Me.Connection Me._commandCollection(0).CommandText = "SELECT MsgRef, MsgTyp, MsgLect, MsgDate, MsgExpi, Reader, AR_sent, AR_Statut, AR_" & _ "nbr_transmission, AR_next_trans_time, MsgEme, MsgTit FROM dbo.DP_Msg" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text Me._commandCollection(1) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(1).Connection = Me.Connection Me._commandCollection(1).CommandText = "SELECT MsgRef, MsgTyp, MsgLect, MsgDate, MsgExpi, Reader, AR_sent, AR_Statut, AR_" & _ "nbr_transmission, AR_next_trans_time, MsgEme, MsgTit FROM DP_Msg WHERE (Reader <" & _ "> '') AND (AR_sent = 'False') OR (AR_sent = 'True') AND (AR_next_trans_time < @n" & _ "ow) AND (AR_nbr_transmission < 3) AND (AR_Statut <> 'OK')" Me._commandCollection(1).CommandType = Global.System.Data.CommandType.Text Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@now", Global.System.Data.SqlDbType.DateTime, 8, Global.System.Data.ParameterDirection.Input, 0, 0, "AR_next_trans_time", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._commandCollection(2) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(2).Connection = Me.Connection Me._commandCollection(2).CommandText = "SELECT MsgRef, MsgTyp, MsgLect, MsgDate, MsgExpi, Reader, AR_sent, AR_Statut, AR_" & _ "nbr_transmission, AR_next_trans_time, MsgEme, MsgTit FROM DP_Msg WHERE (MsgRef =" & _ " @MsgRef)" Me._commandCollection(2).CommandType = Global.System.Data.CommandType.Text Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@MsgRef", Global.System.Data.SqlDbType.NVarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "MsgRef", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._commandCollection(3) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(3).Connection = Me.Connection Me._commandCollection(3).CommandText = "UPDATE DP_Msg" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "set Reader = @Reader, AR_sent=@AR_sent, AR_Statut=@AR_Statut, AR" & _ "_nbr_transmission=@AR_nbr_transmission,AR_next_trans_time=@AR_next_trans_time" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "w" & _ "here MsgRef=@MsgRef" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) Me._commandCollection(3).CommandType = Global.System.Data.CommandType.Text Me._commandCollection(3).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Reader", Global.System.Data.SqlDbType.NVarChar, 2147483647, Global.System.Data.ParameterDirection.Input, 0, 0, "Reader", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._commandCollection(3).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@AR_sent", Global.System.Data.SqlDbType.Bit, 1, Global.System.Data.ParameterDirection.Input, 0, 0, "AR_sent", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._commandCollection(3).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@AR_Statut", Global.System.Data.SqlDbType.NVarChar, 2147483647, Global.System.Data.ParameterDirection.Input, 0, 0, "AR_Statut", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._commandCollection(3).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@AR_nbr_transmission", Global.System.Data.SqlDbType.[Decimal], 9, Global.System.Data.ParameterDirection.Input, 18, 0, "AR_nbr_transmission", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._commandCollection(3).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@AR_next_trans_time", Global.System.Data.SqlDbType.DateTime, 8, Global.System.Data.ParameterDirection.Input, 0, 0, "AR_next_trans_time", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._commandCollection(3).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@MsgRef", Global.System.Data.SqlDbType.NVarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "MsgRef", Global.System.Data.DataRowVersion.Original, False, Nothing, "", "", "")) End Sub _ Public Overridable Overloads Function Fill(ByVal dataTable As PharmaDataSet1.DP_MsgDataTable) 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 Overridable Overloads Function GetData() As PharmaDataSet1.DP_MsgDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As PharmaDataSet1.DP_MsgDataTable = New PharmaDataSet1.DP_MsgDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overridable Overloads Function GetData_where_AR_must_be_send(ByVal now As Global.System.Nullable(Of Date)) As PharmaDataSet1.DP_MsgDataTable Me.Adapter.SelectCommand = Me.CommandCollection(1) If (now.HasValue = True) Then Me.Adapter.SelectCommand.Parameters(0).Value = CType(now.Value, Date) Else Me.Adapter.SelectCommand.Parameters(0).Value = Global.System.DBNull.Value End If Dim dataTable As PharmaDataSet1.DP_MsgDataTable = New PharmaDataSet1.DP_MsgDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overridable Overloads Function GetDataBy_MsgRef(ByVal MsgRef As String) As PharmaDataSet1.DP_MsgDataTable Me.Adapter.SelectCommand = Me.CommandCollection(2) If (MsgRef Is Nothing) Then Me.Adapter.SelectCommand.Parameters(0).Value = Global.System.DBNull.Value Else Me.Adapter.SelectCommand.Parameters(0).Value = CType(MsgRef, String) End If Dim dataTable As PharmaDataSet1.DP_MsgDataTable = New PharmaDataSet1.DP_MsgDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overridable Overloads Function Update(ByVal dataTable As PharmaDataSet1.DP_MsgDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function _ Public Overridable Overloads Function Update(ByVal dataSet As PharmaDataSet1) As Integer Return Me.Adapter.Update(dataSet, "DP_Msg") End Function _ Public Overridable Overloads Function Update(ByVal dataRow As Global.System.Data.DataRow) As Integer Return Me.Adapter.Update(New Global.System.Data.DataRow() {dataRow}) End Function _ Public Overridable Overloads Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer Return Me.Adapter.Update(dataRows) End Function _ Public Overridable Overloads Function Insert(ByVal MsgRef As String, ByVal MsgTyp As String, ByVal MsgLect As Global.System.Nullable(Of Date), ByVal MsgDate As Global.System.Nullable(Of Date), ByVal MsgExpi As Global.System.Nullable(Of Date), ByVal Reader As String, ByVal AR_sent As Global.System.Nullable(Of Boolean), ByVal AR_Statut As String, ByVal AR_nbr_transmission As Global.System.Nullable(Of Decimal), ByVal AR_next_trans_time As Global.System.Nullable(Of Date), ByVal MsgEme As String, ByVal MsgTit As String) As Integer If (MsgRef Is Nothing) Then Me.Adapter.InsertCommand.Parameters(0).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(0).Value = CType(MsgRef, String) End If If (MsgTyp Is Nothing) Then Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(1).Value = CType(MsgTyp, String) End If If (MsgLect.HasValue = True) Then Me.Adapter.InsertCommand.Parameters(2).Value = CType(MsgLect.Value, Date) Else Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value End If If (MsgDate.HasValue = True) Then Me.Adapter.InsertCommand.Parameters(3).Value = CType(MsgDate.Value, Date) Else Me.Adapter.InsertCommand.Parameters(3).Value = Global.System.DBNull.Value End If If (MsgExpi.HasValue = True) Then Me.Adapter.InsertCommand.Parameters(4).Value = CType(MsgExpi.Value, Date) Else Me.Adapter.InsertCommand.Parameters(4).Value = Global.System.DBNull.Value End If If (Reader Is Nothing) Then Me.Adapter.InsertCommand.Parameters(5).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(5).Value = CType(Reader, String) End If If (AR_sent.HasValue = True) Then Me.Adapter.InsertCommand.Parameters(6).Value = CType(AR_sent.Value, Boolean) Else Me.Adapter.InsertCommand.Parameters(6).Value = Global.System.DBNull.Value End If If (AR_Statut Is Nothing) Then Me.Adapter.InsertCommand.Parameters(7).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(7).Value = CType(AR_Statut, String) End If If (AR_nbr_transmission.HasValue = True) Then Me.Adapter.InsertCommand.Parameters(8).Value = CType(AR_nbr_transmission.Value, Decimal) Else Me.Adapter.InsertCommand.Parameters(8).Value = Global.System.DBNull.Value End If If (AR_next_trans_time.HasValue = True) Then Me.Adapter.InsertCommand.Parameters(9).Value = CType(AR_next_trans_time.Value, Date) Else Me.Adapter.InsertCommand.Parameters(9).Value = Global.System.DBNull.Value End If If (MsgEme Is Nothing) Then Me.Adapter.InsertCommand.Parameters(10).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(10).Value = CType(MsgEme, String) End If If (MsgTit Is Nothing) Then Me.Adapter.InsertCommand.Parameters(11).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(11).Value = CType(MsgTit, 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 Overridable Overloads Function Update_by_MsgRef(ByVal Reader As String, ByVal AR_sent As Global.System.Nullable(Of Boolean), ByVal AR_Statut As String, ByVal AR_nbr_transmission As Global.System.Nullable(Of Decimal), ByVal AR_next_trans_time As Global.System.Nullable(Of Date), ByVal MsgRef As String) As Integer Dim command As Global.System.Data.SqlClient.SqlCommand = Me.CommandCollection(3) If (Reader Is Nothing) Then command.Parameters(0).Value = Global.System.DBNull.Value Else command.Parameters(0).Value = CType(Reader, String) End If If (AR_sent.HasValue = True) Then command.Parameters(1).Value = CType(AR_sent.Value, Boolean) Else command.Parameters(1).Value = Global.System.DBNull.Value End If If (AR_Statut Is Nothing) Then command.Parameters(2).Value = Global.System.DBNull.Value Else command.Parameters(2).Value = CType(AR_Statut, String) End If If (AR_nbr_transmission.HasValue = True) Then command.Parameters(3).Value = CType(AR_nbr_transmission.Value, Decimal) Else command.Parameters(3).Value = Global.System.DBNull.Value End If If (AR_next_trans_time.HasValue = True) Then command.Parameters(4).Value = CType(AR_next_trans_time.Value, Date) Else command.Parameters(4).Value = Global.System.DBNull.Value End If If (MsgRef Is Nothing) Then command.Parameters(5).Value = Global.System.DBNull.Value Else command.Parameters(5).Value = CType(MsgRef, String) End If Dim previousConnectionState As Global.System.Data.ConnectionState = command.Connection.State If ((command.Connection.State And Global.System.Data.ConnectionState.Open) _ <> Global.System.Data.ConnectionState.Open) Then command.Connection.Open() End If Dim returnValue As Integer Try returnValue = command.ExecuteNonQuery Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then command.Connection.Close() End If End Try Return returnValue End Function End Class ''' '''Represents the connection and commands used to retrieve and save data. ''' _ Partial Public Class DP_ReqTableAdapter 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(value As Global.System.Data.SqlClient.SqlConnection) 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(value As Global.System.Data.SqlClient.SqlTransaction) 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(value As Boolean) 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 = "DP_Req" tableMapping.ColumnMappings.Add("Sequence_Number", "Sequence_Number") tableMapping.ColumnMappings.Add("ReqId", "ReqId") tableMapping.ColumnMappings.Add("Statut", "Statut") tableMapping.ColumnMappings.Add("next_trans_time", "next_trans_time") tableMapping.ColumnMappings.Add("nbr_trans", "nbr_trans") tableMapping.ColumnMappings.Add("Identifiant_patient", "Identifiant_patient") tableMapping.ColumnMappings.Add("référence_interne", "référence_interne") Me._adapter.TableMappings.Add(tableMapping) Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand() Me._adapter.InsertCommand.Connection = Me.Connection Me._adapter.InsertCommand.CommandText = "INSERT INTO [dbo].[DP_Req] ([Sequence_Number], [ReqId], [Statut], [next_trans_tim" & _ "e], [nbr_trans], [Identifiant_patient], [référence_interne]) VALUES (@Sequence_N" & _ "umber, @ReqId, @Statut, @next_trans_time, @nbr_trans, @Identifiant_patient, @réf" & _ "érence_interne)" Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Sequence_Number", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Sequence_Number", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@ReqId", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ReqId", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Statut", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Statut", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@next_trans_time", Global.System.Data.SqlDbType.DateTime, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "next_trans_time", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@nbr_trans", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "nbr_trans", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Identifiant_patient", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Identifiant_patient", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@référence_interne", Global.System.Data.SqlDbType.NVarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "référence_interne", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() Me._connection.ConnectionString = Global.DP_Relay.My.MySettings.Default.PharmaConnectionString End Sub _ Private Sub InitCommandCollection() Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(7) {} Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(0).Connection = Me.Connection Me._commandCollection(0).CommandText = "SELECT Sequence_Number, ReqId, Statut, next_trans_time, nbr_trans, Identifiant_pa" & _ "tient, référence_interne FROM dbo.DP_Req" Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text Me._commandCollection(1) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(1).Connection = Me.Connection Me._commandCollection(1).CommandText = "DELETE" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "FROM dbo.DP_Req" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "where ReqId=@ReqId" Me._commandCollection(1).CommandType = Global.System.Data.CommandType.Text Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@ReqId", Global.System.Data.SqlDbType.NVarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "ReqId", Global.System.Data.DataRowVersion.Original, False, Nothing, "", "", "")) Me._commandCollection(2) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(2).Connection = Me.Connection Me._commandCollection(2).CommandText = "SELECT Sequence_Number, ReqId, Statut, nbr_trans, next_trans_time, Identifiant_pa" & _ "tient, référence_interne FROM DP_Req WHERE (Statut = 'A_REEMETTRE') AND (Identif" & _ "iant_patient <> 'IAM') OR (Statut = 'ERREUR_TECHNIQUE') AND (Identifiant_patient" & _ " <> 'IAM') AND (next_trans_time < @now) AND (nbr_trans < 4)" Me._commandCollection(2).CommandType = Global.System.Data.CommandType.Text Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@now", Global.System.Data.SqlDbType.DateTime, 8, Global.System.Data.ParameterDirection.Input, 0, 0, "next_trans_time", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._commandCollection(3) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(3).Connection = Me.Connection Me._commandCollection(3).CommandText = "SELECT Sequence_Number, ReqId, Statut, nbr_trans, next_trans_time, Identifiant_pa" & _ "tient, référence_interne FROM DP_Req WHERE ((Statut = 'A_REEMETTRE') AND (Identi" & _ "fiant_patient = 'IAM') OR (Statut = 'ERREUR_TECHNIQUE') AND (Identifiant_patient" & _ " = 'IAM')) AND (next_trans_time < getdate()) AND (nbr_trans < 2)" Me._commandCollection(3).CommandType = Global.System.Data.CommandType.Text Me._commandCollection(4) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(4).Connection = Me.Connection Me._commandCollection(4).CommandText = "SELECT Sequence_Number, ReqId, Statut, next_trans_time, nbr_trans, Identifiant_pa" & _ "tient, référence_interne FROM dbo.DP_Req" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "where ReqId=@ReqId" Me._commandCollection(4).CommandType = Global.System.Data.CommandType.Text Me._commandCollection(4).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@ReqId", Global.System.Data.SqlDbType.NVarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "ReqId", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._commandCollection(5) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(5).Connection = Me.Connection Me._commandCollection(5).CommandText = "SELECT Sequence_Number, ReqId, Statut, nbr_trans, next_trans_time, Identifiant_pa" & _ "tient, référence_interne FROM DP_Req WHERE (Sequence_Number = @Sequence_Number)" Me._commandCollection(5).CommandType = Global.System.Data.CommandType.Text Me._commandCollection(5).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Sequence_Number", Global.System.Data.SqlDbType.NVarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Sequence_Number", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._commandCollection(6) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(6).Connection = Me.Connection Me._commandCollection(6).CommandText = "update DP_Req set Sequence_Number=@Sequence_Number, Statut=@Statut, nbr_trans=@nb" & _ "r_trans, next_trans_time=@next_trans_time, Identifiant_patient=@Identifiant_pati" & _ "ent, référence_interne=@référence_interne where ReqId =@ReqId " Me._commandCollection(6).CommandType = Global.System.Data.CommandType.Text Me._commandCollection(6).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Sequence_Number", Global.System.Data.SqlDbType.NVarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Sequence_Number", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._commandCollection(6).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Statut", Global.System.Data.SqlDbType.NVarChar, 2147483647, Global.System.Data.ParameterDirection.Input, 0, 0, "Statut", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._commandCollection(6).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@nbr_trans", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 0, 0, "nbr_trans", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._commandCollection(6).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@next_trans_time", Global.System.Data.SqlDbType.DateTime, 8, Global.System.Data.ParameterDirection.Input, 0, 0, "next_trans_time", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._commandCollection(6).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Identifiant_patient", Global.System.Data.SqlDbType.NVarChar, 2147483647, Global.System.Data.ParameterDirection.Input, 0, 0, "Identifiant_patient", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._commandCollection(6).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@référence_interne", Global.System.Data.SqlDbType.NVarChar, 2147483647, Global.System.Data.ParameterDirection.Input, 0, 0, "référence_interne", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", "")) Me._commandCollection(6).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@ReqId", Global.System.Data.SqlDbType.NVarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "ReqId", Global.System.Data.DataRowVersion.Original, False, Nothing, "", "", "")) Me._commandCollection(7) = New Global.System.Data.SqlClient.SqlCommand() Me._commandCollection(7).Connection = Me.Connection Me._commandCollection(7).CommandText = "UPDATE DP_Req set Statut='DELAI_EXPIRE' where (Statut = 'A_REEMETTRE') AND (nex" & _ "t_trans_time < @DateLimite)" Me._commandCollection(7).CommandType = Global.System.Data.CommandType.Text Me._commandCollection(7).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@DateLimite", Global.System.Data.SqlDbType.DateTime, 8, Global.System.Data.ParameterDirection.Input, 0, 0, "next_trans_time", Global.System.Data.DataRowVersion.Original, False, Nothing, "", "", "")) End Sub _ Public Overridable Overloads Function Fill(ByVal dataTable As PharmaDataSet1.DP_ReqDataTable) 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 Overridable Overloads Function GetData() As PharmaDataSet1.DP_ReqDataTable Me.Adapter.SelectCommand = Me.CommandCollection(0) Dim dataTable As PharmaDataSet1.DP_ReqDataTable = New PharmaDataSet1.DP_ReqDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overridable Overloads Function GetData_Queue(ByVal now As Global.System.Nullable(Of Date)) As PharmaDataSet1.DP_ReqDataTable Me.Adapter.SelectCommand = Me.CommandCollection(2) If (now.HasValue = True) Then Me.Adapter.SelectCommand.Parameters(0).Value = CType(now.Value, Date) Else Me.Adapter.SelectCommand.Parameters(0).Value = Global.System.DBNull.Value End If Dim dataTable As PharmaDataSet1.DP_ReqDataTable = New PharmaDataSet1.DP_ReqDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overridable Overloads Function GetData_Queue_IAM() As PharmaDataSet1.DP_ReqDataTable Me.Adapter.SelectCommand = Me.CommandCollection(3) Dim dataTable As PharmaDataSet1.DP_ReqDataTable = New PharmaDataSet1.DP_ReqDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overridable Overloads Function GetDataBy_ReqId(ByVal ReqId As String) As PharmaDataSet1.DP_ReqDataTable Me.Adapter.SelectCommand = Me.CommandCollection(4) If (ReqId Is Nothing) Then Me.Adapter.SelectCommand.Parameters(0).Value = Global.System.DBNull.Value Else Me.Adapter.SelectCommand.Parameters(0).Value = CType(ReqId, String) End If Dim dataTable As PharmaDataSet1.DP_ReqDataTable = New PharmaDataSet1.DP_ReqDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overridable Overloads Function GetDataBy_Sequence_Number(ByVal Sequence_Number As String) As PharmaDataSet1.DP_ReqDataTable Me.Adapter.SelectCommand = Me.CommandCollection(5) If (Sequence_Number Is Nothing) Then Me.Adapter.SelectCommand.Parameters(0).Value = Global.System.DBNull.Value Else Me.Adapter.SelectCommand.Parameters(0).Value = CType(Sequence_Number, String) End If Dim dataTable As PharmaDataSet1.DP_ReqDataTable = New PharmaDataSet1.DP_ReqDataTable() Me.Adapter.Fill(dataTable) Return dataTable End Function _ Public Overridable Overloads Function Update(ByVal dataTable As PharmaDataSet1.DP_ReqDataTable) As Integer Return Me.Adapter.Update(dataTable) End Function _ Public Overridable Overloads Function Update(ByVal dataSet As PharmaDataSet1) As Integer Return Me.Adapter.Update(dataSet, "DP_Req") End Function _ Public Overridable Overloads Function Update(ByVal dataRow As Global.System.Data.DataRow) As Integer Return Me.Adapter.Update(New Global.System.Data.DataRow() {dataRow}) End Function _ Public Overridable Overloads Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer Return Me.Adapter.Update(dataRows) End Function _ Public Overridable Overloads Function Insert(ByVal Sequence_Number As String, ByVal ReqId As String, ByVal Statut As String, ByVal next_trans_time As Global.System.Nullable(Of Date), ByVal nbr_trans As Global.System.Nullable(Of Integer), ByVal Identifiant_patient As String, ByVal référence_interne As String) As Integer If (Sequence_Number Is Nothing) Then Me.Adapter.InsertCommand.Parameters(0).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(0).Value = CType(Sequence_Number, String) End If If (ReqId Is Nothing) Then Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(1).Value = CType(ReqId, String) End If If (Statut Is Nothing) Then Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(2).Value = CType(Statut, String) End If If (next_trans_time.HasValue = True) Then Me.Adapter.InsertCommand.Parameters(3).Value = CType(next_trans_time.Value, Date) Else Me.Adapter.InsertCommand.Parameters(3).Value = Global.System.DBNull.Value End If If (nbr_trans.HasValue = True) Then Me.Adapter.InsertCommand.Parameters(4).Value = CType(nbr_trans.Value, Integer) Else Me.Adapter.InsertCommand.Parameters(4).Value = Global.System.DBNull.Value End If If (Identifiant_patient Is Nothing) Then Me.Adapter.InsertCommand.Parameters(5).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(5).Value = CType(Identifiant_patient, String) End If If (référence_interne Is Nothing) Then Me.Adapter.InsertCommand.Parameters(6).Value = Global.System.DBNull.Value Else Me.Adapter.InsertCommand.Parameters(6).Value = CType(référence_interne, 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 Overridable Overloads Function DeleteBy_ReqId(ByVal ReqId As String) As Integer Dim command As Global.System.Data.SqlClient.SqlCommand = Me.CommandCollection(1) If (ReqId Is Nothing) Then command.Parameters(0).Value = Global.System.DBNull.Value Else command.Parameters(0).Value = CType(ReqId, String) End If Dim previousConnectionState As Global.System.Data.ConnectionState = command.Connection.State If ((command.Connection.State And Global.System.Data.ConnectionState.Open) _ <> Global.System.Data.ConnectionState.Open) Then command.Connection.Open() End If Dim returnValue As Integer Try returnValue = command.ExecuteNonQuery Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then command.Connection.Close() End If End Try Return returnValue End Function _ Public Overridable Overloads Function Update_byReqId(ByVal Sequence_Number As String, ByVal Statut As String, ByVal nbr_trans As Global.System.Nullable(Of Integer), ByVal next_trans_time As Global.System.Nullable(Of Date), ByVal Identifiant_patient As String, ByVal référence_interne As String, ByVal ReqId As String) As Integer Dim command As Global.System.Data.SqlClient.SqlCommand = Me.CommandCollection(6) If (Sequence_Number Is Nothing) Then command.Parameters(0).Value = Global.System.DBNull.Value Else command.Parameters(0).Value = CType(Sequence_Number, String) End If If (Statut Is Nothing) Then command.Parameters(1).Value = Global.System.DBNull.Value Else command.Parameters(1).Value = CType(Statut, String) End If If (nbr_trans.HasValue = True) Then command.Parameters(2).Value = CType(nbr_trans.Value, Integer) Else command.Parameters(2).Value = Global.System.DBNull.Value End If If (next_trans_time.HasValue = True) Then command.Parameters(3).Value = CType(next_trans_time.Value, Date) Else command.Parameters(3).Value = Global.System.DBNull.Value End If If (Identifiant_patient Is Nothing) Then command.Parameters(4).Value = Global.System.DBNull.Value Else command.Parameters(4).Value = CType(Identifiant_patient, String) End If If (référence_interne Is Nothing) Then command.Parameters(5).Value = Global.System.DBNull.Value Else command.Parameters(5).Value = CType(référence_interne, String) End If If (ReqId Is Nothing) Then command.Parameters(6).Value = Global.System.DBNull.Value Else command.Parameters(6).Value = CType(ReqId, String) End If Dim previousConnectionState As Global.System.Data.ConnectionState = command.Connection.State If ((command.Connection.State And Global.System.Data.ConnectionState.Open) _ <> Global.System.Data.ConnectionState.Open) Then command.Connection.Open() End If Dim returnValue As Integer Try returnValue = command.ExecuteNonQuery Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then command.Connection.Close() End If End Try Return returnValue End Function _ Public Overridable Overloads Function Update_Requetes_Perimées(ByVal DateLimite As Global.System.Nullable(Of Date)) As Integer Dim command As Global.System.Data.SqlClient.SqlCommand = Me.CommandCollection(7) If (DateLimite.HasValue = True) Then command.Parameters(0).Value = CType(DateLimite.Value, Date) Else command.Parameters(0).Value = Global.System.DBNull.Value End If Dim previousConnectionState As Global.System.Data.ConnectionState = command.Connection.State If ((command.Connection.State And Global.System.Data.ConnectionState.Open) _ <> Global.System.Data.ConnectionState.Open) Then command.Connection.Open() End If Dim returnValue As Integer Try returnValue = command.ExecuteNonQuery Finally If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then command.Connection.Close() End If End Try Return returnValue 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 _dP_ALERTE_PRODUITTableAdapter As DP_ALERTE_PRODUITTableAdapter Private _dP_MsgTableAdapter As DP_MsgTableAdapter Private _dP_ReqTableAdapter As DP_ReqTableAdapter 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 DP_ALERTE_PRODUITTableAdapter() As DP_ALERTE_PRODUITTableAdapter Get Return Me._dP_ALERTE_PRODUITTableAdapter End Get Set Me._dP_ALERTE_PRODUITTableAdapter = value End Set End Property _ Public Property DP_MsgTableAdapter() As DP_MsgTableAdapter Get Return Me._dP_MsgTableAdapter End Get Set Me._dP_MsgTableAdapter = value End Set End Property _ Public Property DP_ReqTableAdapter() As DP_ReqTableAdapter Get Return Me._dP_ReqTableAdapter End Get Set Me._dP_ReqTableAdapter = 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._dP_ALERTE_PRODUITTableAdapter) Is Nothing) _ AndAlso (Not (Me._dP_ALERTE_PRODUITTableAdapter.Connection) Is Nothing)) Then Return Me._dP_ALERTE_PRODUITTableAdapter.Connection End If If ((Not (Me._dP_MsgTableAdapter) Is Nothing) _ AndAlso (Not (Me._dP_MsgTableAdapter.Connection) Is Nothing)) Then Return Me._dP_MsgTableAdapter.Connection End If If ((Not (Me._dP_ReqTableAdapter) Is Nothing) _ AndAlso (Not (Me._dP_ReqTableAdapter.Connection) Is Nothing)) Then Return Me._dP_ReqTableAdapter.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._dP_ALERTE_PRODUITTableAdapter) Is Nothing) Then count = (count + 1) End If If (Not (Me._dP_MsgTableAdapter) Is Nothing) Then count = (count + 1) End If If (Not (Me._dP_ReqTableAdapter) 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 PharmaDataSet1, 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._dP_ALERTE_PRODUITTableAdapter) Is Nothing) Then Dim updatedRows() As Global.System.Data.DataRow = dataSet.DP_ALERTE_PRODUIT.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._dP_ALERTE_PRODUITTableAdapter.Update(updatedRows)) allChangedRows.AddRange(updatedRows) End If End If If (Not (Me._dP_MsgTableAdapter) Is Nothing) Then Dim updatedRows() As Global.System.Data.DataRow = dataSet.DP_Msg.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._dP_MsgTableAdapter.Update(updatedRows)) allChangedRows.AddRange(updatedRows) End If End If If (Not (Me._dP_ReqTableAdapter) Is Nothing) Then Dim updatedRows() As Global.System.Data.DataRow = dataSet.DP_Req.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._dP_ReqTableAdapter.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 PharmaDataSet1, ByVal allAddedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)) As Integer Dim result As Integer = 0 If (Not (Me._dP_ALERTE_PRODUITTableAdapter) Is Nothing) Then Dim addedRows() As Global.System.Data.DataRow = dataSet.DP_ALERTE_PRODUIT.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) If ((Not (addedRows) Is Nothing) _ AndAlso (0 < addedRows.Length)) Then result = (result + Me._dP_ALERTE_PRODUITTableAdapter.Update(addedRows)) allAddedRows.AddRange(addedRows) End If End If If (Not (Me._dP_MsgTableAdapter) Is Nothing) Then Dim addedRows() As Global.System.Data.DataRow = dataSet.DP_Msg.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) If ((Not (addedRows) Is Nothing) _ AndAlso (0 < addedRows.Length)) Then result = (result + Me._dP_MsgTableAdapter.Update(addedRows)) allAddedRows.AddRange(addedRows) End If End If If (Not (Me._dP_ReqTableAdapter) Is Nothing) Then Dim addedRows() As Global.System.Data.DataRow = dataSet.DP_Req.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added) If ((Not (addedRows) Is Nothing) _ AndAlso (0 < addedRows.Length)) Then result = (result + Me._dP_ReqTableAdapter.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 PharmaDataSet1, ByVal allChangedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)) As Integer Dim result As Integer = 0 If (Not (Me._dP_ReqTableAdapter) Is Nothing) Then Dim deletedRows() As Global.System.Data.DataRow = dataSet.DP_Req.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) If ((Not (deletedRows) Is Nothing) _ AndAlso (0 < deletedRows.Length)) Then result = (result + Me._dP_ReqTableAdapter.Update(deletedRows)) allChangedRows.AddRange(deletedRows) End If End If If (Not (Me._dP_MsgTableAdapter) Is Nothing) Then Dim deletedRows() As Global.System.Data.DataRow = dataSet.DP_Msg.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) If ((Not (deletedRows) Is Nothing) _ AndAlso (0 < deletedRows.Length)) Then result = (result + Me._dP_MsgTableAdapter.Update(deletedRows)) allChangedRows.AddRange(deletedRows) End If End If If (Not (Me._dP_ALERTE_PRODUITTableAdapter) Is Nothing) Then Dim deletedRows() As Global.System.Data.DataRow = dataSet.DP_ALERTE_PRODUIT.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted) If ((Not (deletedRows) Is Nothing) _ AndAlso (0 < deletedRows.Length)) Then result = (result + Me._dP_ALERTE_PRODUITTableAdapter.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 PharmaDataSet1) 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._dP_ALERTE_PRODUITTableAdapter) Is Nothing) _ AndAlso (Me.MatchTableAdapterConnection(Me._dP_ALERTE_PRODUITTableAdapter.Connection) = false)) Then Throw New Global.System.ArgumentException("Tous les TableAdapters managés par un TableAdapterManager doivent utiliser la mêm"& _ "e chaîne de connexion.") End If If ((Not (Me._dP_MsgTableAdapter) Is Nothing) _ AndAlso (Me.MatchTableAdapterConnection(Me._dP_MsgTableAdapter.Connection) = false)) Then Throw New Global.System.ArgumentException("Tous les TableAdapters managés par un TableAdapterManager doivent utiliser la mêm"& _ "e chaîne de connexion.") End If If ((Not (Me._dP_ReqTableAdapter) Is Nothing) _ AndAlso (Me.MatchTableAdapterConnection(Me._dP_ReqTableAdapter.Connection) = false)) Then Throw New Global.System.ArgumentException("Tous les TableAdapters managés par un TableAdapterManager doivent utiliser la mêm"& _ "e chaîne de connexion.") End If Dim workConnection As Global.System.Data.IDbConnection = Me.Connection If (workConnection Is Nothing) Then Throw New Global.System.ApplicationException("TableAdapterManager ne contient pas d'informations de connexion. Définissez chaqu"& _ "e propriété TableAdapterManager TableAdapter à une instance valide de TableAdapt"& _ "er.") 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 transaction ne peut pas commencer. La connexion de données actuelle ne prend p"& _ "as en charge les transactions ou l'état actuel n'autorise pas le début de la tra"& _ "nsaction.") 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._dP_ALERTE_PRODUITTableAdapter) Is Nothing) Then revertConnections.Add(Me._dP_ALERTE_PRODUITTableAdapter, Me._dP_ALERTE_PRODUITTableAdapter.Connection) Me._dP_ALERTE_PRODUITTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection) Me._dP_ALERTE_PRODUITTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction) If Me._dP_ALERTE_PRODUITTableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._dP_ALERTE_PRODUITTableAdapter.Adapter.AcceptChangesDuringUpdate = false adaptersWithAcceptChangesDuringUpdate.Add(Me._dP_ALERTE_PRODUITTableAdapter.Adapter) End If End If If (Not (Me._dP_MsgTableAdapter) Is Nothing) Then revertConnections.Add(Me._dP_MsgTableAdapter, Me._dP_MsgTableAdapter.Connection) Me._dP_MsgTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection) Me._dP_MsgTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction) If Me._dP_MsgTableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._dP_MsgTableAdapter.Adapter.AcceptChangesDuringUpdate = false adaptersWithAcceptChangesDuringUpdate.Add(Me._dP_MsgTableAdapter.Adapter) End If End If If (Not (Me._dP_ReqTableAdapter) Is Nothing) Then revertConnections.Add(Me._dP_ReqTableAdapter, Me._dP_ReqTableAdapter.Connection) Me._dP_ReqTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection) Me._dP_ReqTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction) If Me._dP_ReqTableAdapter.Adapter.AcceptChangesDuringUpdate Then Me._dP_ReqTableAdapter.Adapter.AcceptChangesDuringUpdate = false adaptersWithAcceptChangesDuringUpdate.Add(Me._dP_ReqTableAdapter.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._dP_ALERTE_PRODUITTableAdapter) Is Nothing) Then Me._dP_ALERTE_PRODUITTableAdapter.Connection = CType(revertConnections(Me._dP_ALERTE_PRODUITTableAdapter),Global.System.Data.SqlClient.SqlConnection) Me._dP_ALERTE_PRODUITTableAdapter.Transaction = Nothing End If If (Not (Me._dP_MsgTableAdapter) Is Nothing) Then Me._dP_MsgTableAdapter.Connection = CType(revertConnections(Me._dP_MsgTableAdapter),Global.System.Data.SqlClient.SqlConnection) Me._dP_MsgTableAdapter.Transaction = Nothing End If If (Not (Me._dP_ReqTableAdapter) Is Nothing) Then Me._dP_ReqTableAdapter.Connection = CType(revertConnections(Me._dP_ReqTableAdapter),Global.System.Data.SqlClient.SqlConnection) Me._dP_ReqTableAdapter.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