'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'     Runtime Version:2.0.50727.3643
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On


'
' This file contains the generated TableAdapter classes. 
' The strongly-typed dataset class is in the EntitiesLayer project.
'
Namespace RecipeHolderDatabaseDataSetTableAdapters
    
    '''<summary>
    '''Represents the connection and commands used to retrieve and save data.
    '''</summary>
    <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"),  _
     Global.System.ComponentModel.DesignerCategoryAttribute("code"),  _
     Global.System.ComponentModel.ToolboxItem(true),  _
     Global.System.ComponentModel.DataObjectAttribute(true),  _
     Global.System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner"& _ 
        ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),  _
     Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
    Partial Public Class CoursesTableAdapter
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub New()
            MyBase.New
            Me.ClearBeforeFill = true
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property ClearBeforeFill() As Boolean
            Get
                Return Me._clearBeforeFill
            End Get
            Set
                Me._clearBeforeFill = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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 = "Courses"
            tableMapping.ColumnMappings.Add("CourseTypeID", "CourseTypeID")
            tableMapping.ColumnMappings.Add("Name", "Name")
            Me._adapter.TableMappings.Add(tableMapping)
            Me._adapter.DeleteCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.DeleteCommand.Connection = Me.Connection
            Me._adapter.DeleteCommand.CommandText = "dbo.DeleteCourse"
            Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_CourseTypeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "CourseTypeID", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Name", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.InsertCommand.Connection = Me.Connection
            Me._adapter.InsertCommand.CommandText = "dbo.InsertCourse"
            Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@courseTypesName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Identity", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.InputOutput, 10, 0, "CourseTypeID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.UpdateCommand.Connection = Me.Connection
            Me._adapter.UpdateCommand.CommandText = "dbo.UpdateCourse"
            Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_CourseTypeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "CourseTypeID", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Name", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CourseTypesName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitConnection()
            Me._connection = New Global.System.Data.SqlClient.SqlConnection
            Me._connection.ConnectionString = Global.DataAccess.My.MySettings.Default.RecipeHolderDatabaseConnectionString
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitCommandCollection()
            Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(2) {}
            Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(0).Connection = Me.Connection
            Me._commandCollection(0).CommandText = "dbo.RetrieveAllCourses"
            Me._commandCollection(0).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(1).Connection = Me.Connection
            Me._commandCollection(1).CommandText = "dbo.RetrieveCourseById"
            Me._commandCollection(1).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@courseId", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, 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 = "dbo.SearchForCourseType"
            Me._commandCollection(2).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@idToSearch", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@nameToSearch", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, true)>  _
        Public Overloads Overridable Function Fill(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.CoursesDataTable) 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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], true)>  _
        Public Overloads Overridable Function GetData() As EntitiesLayer.RecipeHolderDatabaseDataSet.CoursesDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.CoursesDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.CoursesDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)>  _
        Public Overloads Overridable Function FillByCourseId(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.CoursesDataTable, ByVal courseId As Global.System.Nullable(Of Integer)) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (courseId.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(courseId.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], false)>  _
        Public Overloads Overridable Function GetDataByCourseId(ByVal courseId As Global.System.Nullable(Of Integer)) As EntitiesLayer.RecipeHolderDatabaseDataSet.CoursesDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (courseId.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(courseId.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.CoursesDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.CoursesDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)>  _
        Public Overloads Overridable Function FillBySearch(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.CoursesDataTable, ByVal idToSearch As Global.System.Nullable(Of Integer), ByVal nameToSearch As String) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(2)
            If (idToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(idToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (nameToSearch Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(2).Value = CType(nameToSearch,String)
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], false)>  _
        Public Overloads Overridable Function GetDataBySearch(ByVal idToSearch As Global.System.Nullable(Of Integer), ByVal nameToSearch As String) As EntitiesLayer.RecipeHolderDatabaseDataSet.CoursesDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(2)
            If (idToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(idToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (nameToSearch Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(2).Value = CType(nameToSearch,String)
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.CoursesDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.CoursesDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.CoursesDataTable) As Integer
            Return Me.Adapter.Update(dataTable)
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataSet As EntitiesLayer.RecipeHolderDatabaseDataSet) As Integer
            Return Me.Adapter.Update(dataSet, "Courses")
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataRow As Global.System.Data.DataRow) As Integer
            Return Me.Adapter.Update(New Global.System.Data.DataRow() {dataRow})
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer
            Return Me.Adapter.Update(dataRows)
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Delete, true)>  _
        Public Overloads Overridable Function Delete(ByVal Original_CourseTypeID As Global.System.Nullable(Of Integer), ByVal Original_Name As String) As Integer
            If (Original_CourseTypeID.HasValue = true) Then
                Me.Adapter.DeleteCommand.Parameters(1).Value = CType(Original_CourseTypeID.Value,Integer)
            Else
                Me.Adapter.DeleteCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (Original_Name Is Nothing) Then
                Me.Adapter.DeleteCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.DeleteCommand.Parameters(2).Value = CType(Original_Name,String)
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.DeleteCommand.Connection.State
            If ((Me.Adapter.DeleteCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.DeleteCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.DeleteCommand.Connection.Close
                End If
            End Try
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Insert, true)>  _
        Public Overloads Overridable Function Insert(ByVal courseTypesName As String, ByRef Identity As Global.System.Nullable(Of Integer)) As Integer
            If (courseTypesName Is Nothing) Then
                Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.InsertCommand.Parameters(1).Value = CType(courseTypesName,String)
            End If
            If (Identity.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(2).Value = CType(Identity.Value,Integer)
            Else
                Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.InsertCommand.Connection.State
            If ((Me.Adapter.InsertCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.InsertCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery
                If ((Me.Adapter.InsertCommand.Parameters(2).Value Is Nothing)  _
                            OrElse (Me.Adapter.InsertCommand.Parameters(2).Value.GetType Is GetType(Global.System.DBNull))) Then
                    Identity = New Global.System.Nullable(Of Integer)
                Else
                    Identity = New Global.System.Nullable(Of Integer)(CType(Me.Adapter.InsertCommand.Parameters(2).Value,Integer))
                End If
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.InsertCommand.Connection.Close
                End If
            End Try
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Update, true)>  _
        Public Overloads Overridable Function Update(ByVal Original_CourseTypeID As Global.System.Nullable(Of Integer), ByVal Original_Name As String, ByVal CourseTypesName As String) As Integer
            If (Original_CourseTypeID.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(1).Value = CType(Original_CourseTypeID.Value,Integer)
            Else
                Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (Original_Name Is Nothing) Then
                Me.Adapter.UpdateCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.UpdateCommand.Parameters(2).Value = CType(Original_Name,String)
            End If
            If (CourseTypesName Is Nothing) Then
                Me.Adapter.UpdateCommand.Parameters(3).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.UpdateCommand.Parameters(3).Value = CType(CourseTypesName,String)
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.UpdateCommand.Connection.State
            If ((Me.Adapter.UpdateCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.UpdateCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.UpdateCommand.Connection.Close
                End If
            End Try
        End Function
    End Class
    
    '''<summary>
    '''Represents the connection and commands used to retrieve and save data.
    '''</summary>
    <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"),  _
     Global.System.ComponentModel.DesignerCategoryAttribute("code"),  _
     Global.System.ComponentModel.ToolboxItem(true),  _
     Global.System.ComponentModel.DataObjectAttribute(true),  _
     Global.System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner"& _ 
        ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),  _
     Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
    Partial Public Class CuisineTypesTableAdapter
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub New()
            MyBase.New
            Me.ClearBeforeFill = true
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property ClearBeforeFill() As Boolean
            Get
                Return Me._clearBeforeFill
            End Get
            Set
                Me._clearBeforeFill = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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 = "CuisineTypes"
            tableMapping.ColumnMappings.Add("CuisineTypeID", "CuisineTypeID")
            tableMapping.ColumnMappings.Add("Name", "Name")
            Me._adapter.TableMappings.Add(tableMapping)
            Me._adapter.DeleteCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.DeleteCommand.Connection = Me.Connection
            Me._adapter.DeleteCommand.CommandText = "dbo.DeleteCuisine"
            Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_CuisineTypeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "CuisineTypeID", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Name", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.InsertCommand.Connection = Me.Connection
            Me._adapter.InsertCommand.CommandText = "dbo.InsertCuisine"
            Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@cuisineTypeName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Identity", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.InputOutput, 10, 0, "CuisineTypeID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.UpdateCommand.Connection = Me.Connection
            Me._adapter.UpdateCommand.CommandText = "dbo.UpdateCuisine"
            Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@updatedName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_CuisineTypeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "CuisineTypeID", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Name", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitConnection()
            Me._connection = New Global.System.Data.SqlClient.SqlConnection
            Me._connection.ConnectionString = Global.DataAccess.My.MySettings.Default.RecipeHolderDatabaseConnectionString
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitCommandCollection()
            Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(2) {}
            Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(0).Connection = Me.Connection
            Me._commandCollection(0).CommandText = "dbo.RetrieveAllCuisines"
            Me._commandCollection(0).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(1).Connection = Me.Connection
            Me._commandCollection(1).CommandText = "dbo.RetrieveCuisineById"
            Me._commandCollection(1).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@cuisineIdToSearch", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, 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 = "dbo.SearchForCuisine"
            Me._commandCollection(2).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@idToSearch", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@nameToSearch", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, true)>  _
        Public Overloads Overridable Function Fill(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.CuisineTypesDataTable) 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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], true)>  _
        Public Overloads Overridable Function GetData() As EntitiesLayer.RecipeHolderDatabaseDataSet.CuisineTypesDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.CuisineTypesDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.CuisineTypesDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)>  _
        Public Overloads Overridable Function FillByCuisineId(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.CuisineTypesDataTable, ByVal cuisineIdToSearch As Global.System.Nullable(Of Integer)) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (cuisineIdToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(cuisineIdToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], false)>  _
        Public Overloads Overridable Function GetDataByCuisineId(ByVal cuisineIdToSearch As Global.System.Nullable(Of Integer)) As EntitiesLayer.RecipeHolderDatabaseDataSet.CuisineTypesDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (cuisineIdToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(cuisineIdToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.CuisineTypesDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.CuisineTypesDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)>  _
        Public Overloads Overridable Function FillBySearch(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.CuisineTypesDataTable, ByVal idToSearch As Global.System.Nullable(Of Integer), ByVal nameToSearch As String) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(2)
            If (idToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(idToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (nameToSearch Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(2).Value = CType(nameToSearch,String)
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], false)>  _
        Public Overloads Overridable Function GetDataBySearch(ByVal idToSearch As Global.System.Nullable(Of Integer), ByVal nameToSearch As String) As EntitiesLayer.RecipeHolderDatabaseDataSet.CuisineTypesDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(2)
            If (idToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(idToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (nameToSearch Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(2).Value = CType(nameToSearch,String)
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.CuisineTypesDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.CuisineTypesDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.CuisineTypesDataTable) As Integer
            Return Me.Adapter.Update(dataTable)
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataSet As EntitiesLayer.RecipeHolderDatabaseDataSet) As Integer
            Return Me.Adapter.Update(dataSet, "CuisineTypes")
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataRow As Global.System.Data.DataRow) As Integer
            Return Me.Adapter.Update(New Global.System.Data.DataRow() {dataRow})
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer
            Return Me.Adapter.Update(dataRows)
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Delete, true)>  _
        Public Overloads Overridable Function Delete(ByVal Original_CuisineTypeID As Global.System.Nullable(Of Integer), ByVal Original_Name As String) As Integer
            If (Original_CuisineTypeID.HasValue = true) Then
                Me.Adapter.DeleteCommand.Parameters(1).Value = CType(Original_CuisineTypeID.Value,Integer)
            Else
                Me.Adapter.DeleteCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (Original_Name Is Nothing) Then
                Me.Adapter.DeleteCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.DeleteCommand.Parameters(2).Value = CType(Original_Name,String)
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.DeleteCommand.Connection.State
            If ((Me.Adapter.DeleteCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.DeleteCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.DeleteCommand.Connection.Close
                End If
            End Try
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Insert, true)>  _
        Public Overloads Overridable Function Insert(ByVal cuisineTypeName As String, ByRef Identity As Global.System.Nullable(Of Integer)) As Integer
            If (cuisineTypeName Is Nothing) Then
                Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.InsertCommand.Parameters(1).Value = CType(cuisineTypeName,String)
            End If
            If (Identity.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(2).Value = CType(Identity.Value,Integer)
            Else
                Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.InsertCommand.Connection.State
            If ((Me.Adapter.InsertCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.InsertCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery
                If ((Me.Adapter.InsertCommand.Parameters(2).Value Is Nothing)  _
                            OrElse (Me.Adapter.InsertCommand.Parameters(2).Value.GetType Is GetType(Global.System.DBNull))) Then
                    Identity = New Global.System.Nullable(Of Integer)
                Else
                    Identity = New Global.System.Nullable(Of Integer)(CType(Me.Adapter.InsertCommand.Parameters(2).Value,Integer))
                End If
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.InsertCommand.Connection.Close
                End If
            End Try
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Update, true)>  _
        Public Overloads Overridable Function Update(ByVal updatedName As String, ByVal Original_CuisineTypeID As Global.System.Nullable(Of Integer), ByVal Original_Name As String) As Integer
            If (updatedName Is Nothing) Then
                Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.UpdateCommand.Parameters(1).Value = CType(updatedName,String)
            End If
            If (Original_CuisineTypeID.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(2).Value = CType(Original_CuisineTypeID.Value,Integer)
            Else
                Me.Adapter.UpdateCommand.Parameters(2).Value = Global.System.DBNull.Value
            End If
            If (Original_Name Is Nothing) Then
                Me.Adapter.UpdateCommand.Parameters(3).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.UpdateCommand.Parameters(3).Value = CType(Original_Name,String)
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.UpdateCommand.Connection.State
            If ((Me.Adapter.UpdateCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.UpdateCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.UpdateCommand.Connection.Close
                End If
            End Try
        End Function
    End Class
    
    '''<summary>
    '''Represents the connection and commands used to retrieve and save data.
    '''</summary>
    <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"),  _
     Global.System.ComponentModel.DesignerCategoryAttribute("code"),  _
     Global.System.ComponentModel.ToolboxItem(true),  _
     Global.System.ComponentModel.DataObjectAttribute(true),  _
     Global.System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner"& _ 
        ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),  _
     Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
    Partial Public Class FoodTypesTableAdapter
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub New()
            MyBase.New
            Me.ClearBeforeFill = true
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property ClearBeforeFill() As Boolean
            Get
                Return Me._clearBeforeFill
            End Get
            Set
                Me._clearBeforeFill = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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 = "FoodTypes"
            tableMapping.ColumnMappings.Add("FoodTypeID", "FoodTypeID")
            tableMapping.ColumnMappings.Add("Name", "Name")
            Me._adapter.TableMappings.Add(tableMapping)
            Me._adapter.DeleteCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.DeleteCommand.Connection = Me.Connection
            Me._adapter.DeleteCommand.CommandText = "dbo.DeleteFoodType"
            Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_FoodTypeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "FoodTypeID", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Name", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.InsertCommand.Connection = Me.Connection
            Me._adapter.InsertCommand.CommandText = "dbo.InsertFoodType"
            Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@foodTypeToInsert", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Identity", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.InputOutput, 10, 0, "FoodTypeID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.UpdateCommand.Connection = Me.Connection
            Me._adapter.UpdateCommand.CommandText = "dbo.UpdateFoodType"
            Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@updatedName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_FoodTypesID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "FoodTypeID", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Name", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitConnection()
            Me._connection = New Global.System.Data.SqlClient.SqlConnection
            Me._connection.ConnectionString = Global.DataAccess.My.MySettings.Default.RecipeHolderDatabaseConnectionString
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitCommandCollection()
            Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(2) {}
            Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(0).Connection = Me.Connection
            Me._commandCollection(0).CommandText = "dbo.RetrieveAllFoodTypes"
            Me._commandCollection(0).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(1).Connection = Me.Connection
            Me._commandCollection(1).CommandText = "dbo.RetrieveFoodTypeById"
            Me._commandCollection(1).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@FoodTypeIdToSearch", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, 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 = "dbo.SearchForFoodType"
            Me._commandCollection(2).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@idToSearch", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@nameToSearch", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, true)>  _
        Public Overloads Overridable Function Fill(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.FoodTypesDataTable) 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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], true)>  _
        Public Overloads Overridable Function GetData() As EntitiesLayer.RecipeHolderDatabaseDataSet.FoodTypesDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.FoodTypesDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.FoodTypesDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)>  _
        Public Overloads Overridable Function FillByFoodTypeId(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.FoodTypesDataTable, ByVal FoodTypeIdToSearch As Global.System.Nullable(Of Integer)) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (FoodTypeIdToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(FoodTypeIdToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], false)>  _
        Public Overloads Overridable Function GetDataByFoodTypeId(ByVal FoodTypeIdToSearch As Global.System.Nullable(Of Integer)) As EntitiesLayer.RecipeHolderDatabaseDataSet.FoodTypesDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (FoodTypeIdToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(FoodTypeIdToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.FoodTypesDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.FoodTypesDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)>  _
        Public Overloads Overridable Function FillBySearch(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.FoodTypesDataTable, ByVal idToSearch As Global.System.Nullable(Of Integer), ByVal nameToSearch As String) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(2)
            If (idToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(idToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (nameToSearch Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(2).Value = CType(nameToSearch,String)
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], false)>  _
        Public Overloads Overridable Function GetDataBySearch(ByVal idToSearch As Global.System.Nullable(Of Integer), ByVal nameToSearch As String) As EntitiesLayer.RecipeHolderDatabaseDataSet.FoodTypesDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(2)
            If (idToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(idToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (nameToSearch Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(2).Value = CType(nameToSearch,String)
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.FoodTypesDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.FoodTypesDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.FoodTypesDataTable) As Integer
            Return Me.Adapter.Update(dataTable)
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataSet As EntitiesLayer.RecipeHolderDatabaseDataSet) As Integer
            Return Me.Adapter.Update(dataSet, "FoodTypes")
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataRow As Global.System.Data.DataRow) As Integer
            Return Me.Adapter.Update(New Global.System.Data.DataRow() {dataRow})
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer
            Return Me.Adapter.Update(dataRows)
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Delete, true)>  _
        Public Overloads Overridable Function Delete(ByVal Original_FoodTypeID As Global.System.Nullable(Of Integer), ByVal Original_Name As String) As Integer
            If (Original_FoodTypeID.HasValue = true) Then
                Me.Adapter.DeleteCommand.Parameters(1).Value = CType(Original_FoodTypeID.Value,Integer)
            Else
                Me.Adapter.DeleteCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (Original_Name Is Nothing) Then
                Me.Adapter.DeleteCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.DeleteCommand.Parameters(2).Value = CType(Original_Name,String)
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.DeleteCommand.Connection.State
            If ((Me.Adapter.DeleteCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.DeleteCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.DeleteCommand.Connection.Close
                End If
            End Try
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Insert, true)>  _
        Public Overloads Overridable Function Insert(ByVal foodTypeToInsert As String, ByRef Identity As Global.System.Nullable(Of Integer)) As Integer
            If (foodTypeToInsert Is Nothing) Then
                Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.InsertCommand.Parameters(1).Value = CType(foodTypeToInsert,String)
            End If
            If (Identity.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(2).Value = CType(Identity.Value,Integer)
            Else
                Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.InsertCommand.Connection.State
            If ((Me.Adapter.InsertCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.InsertCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery
                If ((Me.Adapter.InsertCommand.Parameters(2).Value Is Nothing)  _
                            OrElse (Me.Adapter.InsertCommand.Parameters(2).Value.GetType Is GetType(Global.System.DBNull))) Then
                    Identity = New Global.System.Nullable(Of Integer)
                Else
                    Identity = New Global.System.Nullable(Of Integer)(CType(Me.Adapter.InsertCommand.Parameters(2).Value,Integer))
                End If
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.InsertCommand.Connection.Close
                End If
            End Try
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Update, true)>  _
        Public Overloads Overridable Function Update(ByVal updatedName As String, ByVal Original_FoodTypesID As Global.System.Nullable(Of Integer), ByVal Original_Name As String) As Integer
            If (updatedName Is Nothing) Then
                Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.UpdateCommand.Parameters(1).Value = CType(updatedName,String)
            End If
            If (Original_FoodTypesID.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(2).Value = CType(Original_FoodTypesID.Value,Integer)
            Else
                Me.Adapter.UpdateCommand.Parameters(2).Value = Global.System.DBNull.Value
            End If
            If (Original_Name Is Nothing) Then
                Me.Adapter.UpdateCommand.Parameters(3).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.UpdateCommand.Parameters(3).Value = CType(Original_Name,String)
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.UpdateCommand.Connection.State
            If ((Me.Adapter.UpdateCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.UpdateCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.UpdateCommand.Connection.Close
                End If
            End Try
        End Function
    End Class
    
    '''<summary>
    '''Represents the connection and commands used to retrieve and save data.
    '''</summary>
    <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"),  _
     Global.System.ComponentModel.DesignerCategoryAttribute("code"),  _
     Global.System.ComponentModel.ToolboxItem(true),  _
     Global.System.ComponentModel.DataObjectAttribute(true),  _
     Global.System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner"& _ 
        ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),  _
     Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
    Partial Public Class IngredientsTableAdapter
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub New()
            MyBase.New
            Me.ClearBeforeFill = true
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property ClearBeforeFill() As Boolean
            Get
                Return Me._clearBeforeFill
            End Get
            Set
                Me._clearBeforeFill = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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 = "Ingredients"
            tableMapping.ColumnMappings.Add("IngredientID", "IngredientID")
            tableMapping.ColumnMappings.Add("FoodTypeID", "FoodTypeID")
            tableMapping.ColumnMappings.Add("Name", "Name")
            Me._adapter.TableMappings.Add(tableMapping)
            Me._adapter.DeleteCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.DeleteCommand.Connection = Me.Connection
            Me._adapter.DeleteCommand.CommandText = "dbo.DeleteIngredient"
            Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_IngredientID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "IngredientID", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_FoodTypeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "FoodTypeID", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Name", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.InsertCommand.Connection = Me.Connection
            Me._adapter.InsertCommand.CommandText = "dbo.InsertIngredient"
            Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@nameToInsert", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@foodTypeIdToInsert", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "FoodTypeID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.UpdateCommand.Connection = Me.Connection
            Me._adapter.UpdateCommand.CommandText = "dbo.UpdateIngredient"
            Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Name", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@FoodTypeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "FoodTypeID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@ingredientID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "IngredientID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitConnection()
            Me._connection = New Global.System.Data.SqlClient.SqlConnection
            Me._connection.ConnectionString = Global.DataAccess.My.MySettings.Default.RecipeHolderDatabaseConnectionString
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitCommandCollection()
            Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(2) {}
            Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(0).Connection = Me.Connection
            Me._commandCollection(0).CommandText = "dbo.RetrieveAllIngredients"
            Me._commandCollection(0).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(1).Connection = Me.Connection
            Me._commandCollection(1).CommandText = "dbo.RetrieveIngredientById"
            Me._commandCollection(1).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@ingredientIdToSearch", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, 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 = "dbo.SearchForIngredient"
            Me._commandCollection(2).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@ingredientIdToSearch", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@nameToSearch", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@foodTypeIdToSearch", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, true)>  _
        Public Overloads Overridable Function Fill(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.IngredientsDataTable) 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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], true)>  _
        Public Overloads Overridable Function GetData() As EntitiesLayer.RecipeHolderDatabaseDataSet.IngredientsDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.IngredientsDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.IngredientsDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)>  _
        Public Overloads Overridable Function FillByIngredientId(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.IngredientsDataTable, ByVal ingredientIdToSearch As Global.System.Nullable(Of Integer)) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (ingredientIdToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(ingredientIdToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], false)>  _
        Public Overloads Overridable Function GetDataByIngredientId(ByVal ingredientIdToSearch As Global.System.Nullable(Of Integer)) As EntitiesLayer.RecipeHolderDatabaseDataSet.IngredientsDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (ingredientIdToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(ingredientIdToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.IngredientsDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.IngredientsDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)>  _
        Public Overloads Overridable Function FillBySearch(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.IngredientsDataTable, ByVal ingredientIdToSearch As Global.System.Nullable(Of Integer), ByVal nameToSearch As String, ByVal foodTypeIdToSearch As Global.System.Nullable(Of Integer)) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(2)
            If (ingredientIdToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(ingredientIdToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (nameToSearch Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(2).Value = CType(nameToSearch,String)
            End If
            If (foodTypeIdToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(3).Value = CType(foodTypeIdToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(3).Value = Global.System.DBNull.Value
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], false)>  _
        Public Overloads Overridable Function GetDataBySearch(ByVal ingredientIdToSearch As Global.System.Nullable(Of Integer), ByVal nameToSearch As String, ByVal foodTypeIdToSearch As Global.System.Nullable(Of Integer)) As EntitiesLayer.RecipeHolderDatabaseDataSet.IngredientsDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(2)
            If (ingredientIdToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(ingredientIdToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (nameToSearch Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(2).Value = CType(nameToSearch,String)
            End If
            If (foodTypeIdToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(3).Value = CType(foodTypeIdToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(3).Value = Global.System.DBNull.Value
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.IngredientsDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.IngredientsDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.IngredientsDataTable) As Integer
            Return Me.Adapter.Update(dataTable)
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataSet As EntitiesLayer.RecipeHolderDatabaseDataSet) As Integer
            Return Me.Adapter.Update(dataSet, "Ingredients")
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataRow As Global.System.Data.DataRow) As Integer
            Return Me.Adapter.Update(New Global.System.Data.DataRow() {dataRow})
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer
            Return Me.Adapter.Update(dataRows)
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Delete, true)>  _
        Public Overloads Overridable Function Delete(ByVal Original_IngredientID As Global.System.Nullable(Of Integer), ByVal Original_FoodTypeID As Global.System.Nullable(Of Integer), ByVal Original_Name As String) As Integer
            If (Original_IngredientID.HasValue = true) Then
                Me.Adapter.DeleteCommand.Parameters(1).Value = CType(Original_IngredientID.Value,Integer)
            Else
                Me.Adapter.DeleteCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (Original_FoodTypeID.HasValue = true) Then
                Me.Adapter.DeleteCommand.Parameters(2).Value = CType(Original_FoodTypeID.Value,Integer)
            Else
                Me.Adapter.DeleteCommand.Parameters(2).Value = Global.System.DBNull.Value
            End If
            If (Original_Name Is Nothing) Then
                Me.Adapter.DeleteCommand.Parameters(3).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.DeleteCommand.Parameters(3).Value = CType(Original_Name,String)
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.DeleteCommand.Connection.State
            If ((Me.Adapter.DeleteCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.DeleteCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.DeleteCommand.Connection.Close
                End If
            End Try
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Insert, true)>  _
        Public Overloads Overridable Function Insert(ByVal nameToInsert As String, ByVal foodTypeIdToInsert As Global.System.Nullable(Of Integer)) As Integer
            If (nameToInsert Is Nothing) Then
                Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.InsertCommand.Parameters(1).Value = CType(nameToInsert,String)
            End If
            If (foodTypeIdToInsert.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(2).Value = CType(foodTypeIdToInsert.Value,Integer)
            Else
                Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.InsertCommand.Connection.State
            If ((Me.Adapter.InsertCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.InsertCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.InsertCommand.Connection.Close
                End If
            End Try
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Update, true)>  _
        Public Overloads Overridable Function Update(ByVal Name As String, ByVal FoodTypeID As Global.System.Nullable(Of Integer), ByVal ingredientID As Global.System.Nullable(Of Integer)) As Integer
            If (Name Is Nothing) Then
                Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.UpdateCommand.Parameters(1).Value = CType(Name,String)
            End If
            If (FoodTypeID.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(2).Value = CType(FoodTypeID.Value,Integer)
            Else
                Me.Adapter.UpdateCommand.Parameters(2).Value = Global.System.DBNull.Value
            End If
            If (ingredientID.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(3).Value = CType(ingredientID.Value,Integer)
            Else
                Me.Adapter.UpdateCommand.Parameters(3).Value = Global.System.DBNull.Value
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.UpdateCommand.Connection.State
            If ((Me.Adapter.UpdateCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.UpdateCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.UpdateCommand.Connection.Close
                End If
            End Try
        End Function
    End Class
    
    '''<summary>
    '''Represents the connection and commands used to retrieve and save data.
    '''</summary>
    <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"),  _
     Global.System.ComponentModel.DesignerCategoryAttribute("code"),  _
     Global.System.ComponentModel.ToolboxItem(true),  _
     Global.System.ComponentModel.DataObjectAttribute(true),  _
     Global.System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner"& _ 
        ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),  _
     Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
    Partial Public Class NutritionDetailsTableAdapter
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub New()
            MyBase.New
            Me.ClearBeforeFill = true
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property ClearBeforeFill() As Boolean
            Get
                Return Me._clearBeforeFill
            End Get
            Set
                Me._clearBeforeFill = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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 = "NutritionDetails"
            tableMapping.ColumnMappings.Add("NutritionID", "NutritionID")
            tableMapping.ColumnMappings.Add("RecipeID", "RecipeID")
            tableMapping.ColumnMappings.Add("Calories", "Calories")
            tableMapping.ColumnMappings.Add("CaloriesFromFat", "CaloriesFromFat")
            tableMapping.ColumnMappings.Add("TotalFat", "TotalFat")
            tableMapping.ColumnMappings.Add("SaturatedFat", "SaturatedFat")
            tableMapping.ColumnMappings.Add("TransFat", "TransFat")
            tableMapping.ColumnMappings.Add("Cholesteral", "Cholesteral")
            tableMapping.ColumnMappings.Add("Sodium", "Sodium")
            tableMapping.ColumnMappings.Add("TotalCarbohydrates", "TotalCarbohydrates")
            tableMapping.ColumnMappings.Add("DietaryFiber", "DietaryFiber")
            tableMapping.ColumnMappings.Add("Sugar", "Sugar")
            tableMapping.ColumnMappings.Add("Protein", "Protein")
            tableMapping.ColumnMappings.Add("VitaminA", "VitaminA")
            tableMapping.ColumnMappings.Add("VitaminC", "VitaminC")
            tableMapping.ColumnMappings.Add("Calcium", "Calcium")
            tableMapping.ColumnMappings.Add("Iron", "Iron")
            Me._adapter.TableMappings.Add(tableMapping)
            Me._adapter.DeleteCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.DeleteCommand.Connection = Me.Connection
            Me._adapter.DeleteCommand.CommandText = "dbo.DeleteNutritionDetails"
            Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_NutritionID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "NutritionID", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.InsertCommand.Connection = Me.Connection
            Me._adapter.InsertCommand.CommandText = "dbo.InsertNutritionDetails"
            Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RecipeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "RecipeID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Calories", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "Calories", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CaloriesFromFat", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "CaloriesFromFat", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@TotalFat", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "TotalFat", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@SaturatedFat", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "SaturatedFat", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@TransFat", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "TransFat", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Cholesteral", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "Cholesteral", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Sodium", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "Sodium", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@TotalCarbohydrates", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "TotalCarbohydrates", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@DietaryFiber", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "DietaryFiber", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Sugar", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "Sugar", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Protein", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "Protein", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@VitaminA", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "VitaminA", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@VitaminC", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "VitaminC", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Calcium", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "Calcium", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Iron", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "Iron", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@newNutritionId", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.InputOutput, 10, 0, "NutritionID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.UpdateCommand.Connection = Me.Connection
            Me._adapter.UpdateCommand.CommandText = "dbo.UpdateNutritionDetails"
            Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_NutritionID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "NutritionID", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RecipeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "RecipeID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Calories", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "Calories", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CaloriesFromFat", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "CaloriesFromFat", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@TotalFat", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "TotalFat", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@SaturatedFat", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "SaturatedFat", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@TransFat", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "TransFat", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Cholesteral", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "Cholesteral", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Sodium", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "Sodium", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@TotalCarbohydrates", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "TotalCarbohydrates", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@DietaryFiber", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "DietaryFiber", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Sugar", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "Sugar", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Protein", Global.System.Data.SqlDbType.Float, 8, Global.System.Data.ParameterDirection.Input, 53, 0, "Protein", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@VitaminA", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "VitaminA", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@VitaminC", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "VitaminC", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Calcium", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "Calcium", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Iron", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "Iron", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitConnection()
            Me._connection = New Global.System.Data.SqlClient.SqlConnection
            Me._connection.ConnectionString = Global.DataAccess.My.MySettings.Default.RecipeHolderDatabaseConnectionString
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitCommandCollection()
            Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(2) {}
            Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(0).Connection = Me.Connection
            Me._commandCollection(0).CommandText = "dbo.RetrieveNutritionDetailsById"
            Me._commandCollection(0).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@recipeId", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(1).Connection = Me.Connection
            Me._commandCollection(1).CommandText = "dbo.FillNutritionDetails"
            Me._commandCollection(1).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(2) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(2).Connection = Me.Connection
            Me._commandCollection(2).CommandText = "SELECT     NutritionDetails.NutritionID, NutritionDetails.RecipeID, NutritionDeta"& _ 
                "ils.Calories, NutritionDetails.CaloriesFromFat, NutritionDetails.TotalFat, "&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"   "& _ 
                "                   NutritionDetails.SaturatedFat, NutritionDetails.TransFat, Nut"& _ 
                "ritionDetails.Cholesteral, NutritionDetails.Sodium, NutritionDetails.TotalCarboh"& _ 
                "ydrates, "&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"                      NutritionDetails.DietaryFiber, NutritionDetails"& _ 
                ".Sugar, NutritionDetails.Protein, NutritionDetails.VitaminA, NutritionDetails.Vi"& _ 
                "taminC, "&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"                      NutritionDetails.Calcium, NutritionDetails.Iron"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"FROM         NutritionDetails INNER JOIN"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"                      Recipes ON Nutr"& _ 
                "itionDetails.RecipeID = Recipes.RecipeID"
            Me._commandCollection(2).CommandType = Global.System.Data.CommandType.Text
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, true)>  _
        Public Overloads Overridable Function FillById(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.NutritionDetailsDataTable, ByVal recipeId As Global.System.Nullable(Of Integer)) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            If (recipeId.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(recipeId.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], true)>  _
        Public Overloads Overridable Function GetDataById(ByVal recipeId As Global.System.Nullable(Of Integer)) As EntitiesLayer.RecipeHolderDatabaseDataSet.NutritionDetailsDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            If (recipeId.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(recipeId.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.NutritionDetailsDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.NutritionDetailsDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)>  _
        Public Overloads Overridable Function FillBy(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.NutritionDetailsDataTable) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], false)>  _
        Public Overloads Overridable Function GetDataBy() As EntitiesLayer.RecipeHolderDatabaseDataSet.NutritionDetailsDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.NutritionDetailsDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.NutritionDetailsDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)>  _
        Public Overloads Overridable Function FillByRetrieveRecipeTable(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.NutritionDetailsDataTable) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(2)
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], false)>  _
        Public Overloads Overridable Function GetDataByRetrieveRecipeTable() As EntitiesLayer.RecipeHolderDatabaseDataSet.NutritionDetailsDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(2)
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.NutritionDetailsDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.NutritionDetailsDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.NutritionDetailsDataTable) As Integer
            Return Me.Adapter.Update(dataTable)
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataSet As EntitiesLayer.RecipeHolderDatabaseDataSet) As Integer
            Return Me.Adapter.Update(dataSet, "NutritionDetails")
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataRow As Global.System.Data.DataRow) As Integer
            Return Me.Adapter.Update(New Global.System.Data.DataRow() {dataRow})
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer
            Return Me.Adapter.Update(dataRows)
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Delete, true)>  _
        Public Overloads Overridable Function Delete(ByVal Original_NutritionID As Global.System.Nullable(Of Integer)) As Integer
            If (Original_NutritionID.HasValue = true) Then
                Me.Adapter.DeleteCommand.Parameters(1).Value = CType(Original_NutritionID.Value,Integer)
            Else
                Me.Adapter.DeleteCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.DeleteCommand.Connection.State
            If ((Me.Adapter.DeleteCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.DeleteCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.DeleteCommand.Connection.Close
                End If
            End Try
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Insert, true)>  _
        Public Overloads Overridable Function Insert( _
                    ByVal RecipeID As Global.System.Nullable(Of Integer),  _
                    ByVal Calories As Global.System.Nullable(Of Double),  _
                    ByVal CaloriesFromFat As Global.System.Nullable(Of Double),  _
                    ByVal TotalFat As Global.System.Nullable(Of Double),  _
                    ByVal SaturatedFat As Global.System.Nullable(Of Double),  _
                    ByVal TransFat As Global.System.Nullable(Of Double),  _
                    ByVal Cholesteral As Global.System.Nullable(Of Double),  _
                    ByVal Sodium As Global.System.Nullable(Of Double),  _
                    ByVal TotalCarbohydrates As Global.System.Nullable(Of Double),  _
                    ByVal DietaryFiber As Global.System.Nullable(Of Double),  _
                    ByVal Sugar As Global.System.Nullable(Of Double),  _
                    ByVal Protein As Global.System.Nullable(Of Double),  _
                    ByVal VitaminA As Global.System.Nullable(Of Integer),  _
                    ByVal VitaminC As Global.System.Nullable(Of Integer),  _
                    ByVal Calcium As Global.System.Nullable(Of Integer),  _
                    ByVal Iron As Global.System.Nullable(Of Integer),  _
                    ByRef newNutritionId As Global.System.Nullable(Of Integer)) As Integer
            If (RecipeID.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(1).Value = CType(RecipeID.Value,Integer)
            Else
                Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (Calories.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(2).Value = CType(Calories.Value,Double)
            Else
                Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value
            End If
            If (CaloriesFromFat.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(3).Value = CType(CaloriesFromFat.Value,Double)
            Else
                Me.Adapter.InsertCommand.Parameters(3).Value = Global.System.DBNull.Value
            End If
            If (TotalFat.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(4).Value = CType(TotalFat.Value,Double)
            Else
                Me.Adapter.InsertCommand.Parameters(4).Value = Global.System.DBNull.Value
            End If
            If (SaturatedFat.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(5).Value = CType(SaturatedFat.Value,Double)
            Else
                Me.Adapter.InsertCommand.Parameters(5).Value = Global.System.DBNull.Value
            End If
            If (TransFat.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(6).Value = CType(TransFat.Value,Double)
            Else
                Me.Adapter.InsertCommand.Parameters(6).Value = Global.System.DBNull.Value
            End If
            If (Cholesteral.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(7).Value = CType(Cholesteral.Value,Double)
            Else
                Me.Adapter.InsertCommand.Parameters(7).Value = Global.System.DBNull.Value
            End If
            If (Sodium.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(8).Value = CType(Sodium.Value,Double)
            Else
                Me.Adapter.InsertCommand.Parameters(8).Value = Global.System.DBNull.Value
            End If
            If (TotalCarbohydrates.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(9).Value = CType(TotalCarbohydrates.Value,Double)
            Else
                Me.Adapter.InsertCommand.Parameters(9).Value = Global.System.DBNull.Value
            End If
            If (DietaryFiber.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(10).Value = CType(DietaryFiber.Value,Double)
            Else
                Me.Adapter.InsertCommand.Parameters(10).Value = Global.System.DBNull.Value
            End If
            If (Sugar.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(11).Value = CType(Sugar.Value,Double)
            Else
                Me.Adapter.InsertCommand.Parameters(11).Value = Global.System.DBNull.Value
            End If
            If (Protein.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(12).Value = CType(Protein.Value,Double)
            Else
                Me.Adapter.InsertCommand.Parameters(12).Value = Global.System.DBNull.Value
            End If
            If (VitaminA.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(13).Value = CType(VitaminA.Value,Integer)
            Else
                Me.Adapter.InsertCommand.Parameters(13).Value = Global.System.DBNull.Value
            End If
            If (VitaminC.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(14).Value = CType(VitaminC.Value,Integer)
            Else
                Me.Adapter.InsertCommand.Parameters(14).Value = Global.System.DBNull.Value
            End If
            If (Calcium.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(15).Value = CType(Calcium.Value,Integer)
            Else
                Me.Adapter.InsertCommand.Parameters(15).Value = Global.System.DBNull.Value
            End If
            If (Iron.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(16).Value = CType(Iron.Value,Integer)
            Else
                Me.Adapter.InsertCommand.Parameters(16).Value = Global.System.DBNull.Value
            End If
            If (newNutritionId.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(17).Value = CType(newNutritionId.Value,Integer)
            Else
                Me.Adapter.InsertCommand.Parameters(17).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
                If ((Me.Adapter.InsertCommand.Parameters(17).Value Is Nothing)  _
                            OrElse (Me.Adapter.InsertCommand.Parameters(17).Value.GetType Is GetType(Global.System.DBNull))) Then
                    newNutritionId = New Global.System.Nullable(Of Integer)
                Else
                    newNutritionId = New Global.System.Nullable(Of Integer)(CType(Me.Adapter.InsertCommand.Parameters(17).Value,Integer))
                End If
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.InsertCommand.Connection.Close
                End If
            End Try
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Update, true)>  _
        Public Overloads Overridable Function Update( _
                    ByVal Original_NutritionID As Global.System.Nullable(Of Integer),  _
                    ByVal RecipeID As Global.System.Nullable(Of Integer),  _
                    ByVal Calories As Global.System.Nullable(Of Double),  _
                    ByVal CaloriesFromFat As Global.System.Nullable(Of Double),  _
                    ByVal TotalFat As Global.System.Nullable(Of Double),  _
                    ByVal SaturatedFat As Global.System.Nullable(Of Double),  _
                    ByVal TransFat As Global.System.Nullable(Of Double),  _
                    ByVal Cholesteral As Global.System.Nullable(Of Double),  _
                    ByVal Sodium As Global.System.Nullable(Of Double),  _
                    ByVal TotalCarbohydrates As Global.System.Nullable(Of Double),  _
                    ByVal DietaryFiber As Global.System.Nullable(Of Double),  _
                    ByVal Sugar As Global.System.Nullable(Of Double),  _
                    ByVal Protein As Global.System.Nullable(Of Double),  _
                    ByVal VitaminA As Global.System.Nullable(Of Integer),  _
                    ByVal VitaminC As Global.System.Nullable(Of Integer),  _
                    ByVal Calcium As Global.System.Nullable(Of Integer),  _
                    ByVal Iron As Global.System.Nullable(Of Integer)) As Integer
            If (Original_NutritionID.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(1).Value = CType(Original_NutritionID.Value,Integer)
            Else
                Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (RecipeID.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(2).Value = CType(RecipeID.Value,Integer)
            Else
                Me.Adapter.UpdateCommand.Parameters(2).Value = Global.System.DBNull.Value
            End If
            If (Calories.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(3).Value = CType(Calories.Value,Double)
            Else
                Me.Adapter.UpdateCommand.Parameters(3).Value = Global.System.DBNull.Value
            End If
            If (CaloriesFromFat.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(4).Value = CType(CaloriesFromFat.Value,Double)
            Else
                Me.Adapter.UpdateCommand.Parameters(4).Value = Global.System.DBNull.Value
            End If
            If (TotalFat.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(5).Value = CType(TotalFat.Value,Double)
            Else
                Me.Adapter.UpdateCommand.Parameters(5).Value = Global.System.DBNull.Value
            End If
            If (SaturatedFat.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(6).Value = CType(SaturatedFat.Value,Double)
            Else
                Me.Adapter.UpdateCommand.Parameters(6).Value = Global.System.DBNull.Value
            End If
            If (TransFat.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(7).Value = CType(TransFat.Value,Double)
            Else
                Me.Adapter.UpdateCommand.Parameters(7).Value = Global.System.DBNull.Value
            End If
            If (Cholesteral.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(8).Value = CType(Cholesteral.Value,Double)
            Else
                Me.Adapter.UpdateCommand.Parameters(8).Value = Global.System.DBNull.Value
            End If
            If (Sodium.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(9).Value = CType(Sodium.Value,Double)
            Else
                Me.Adapter.UpdateCommand.Parameters(9).Value = Global.System.DBNull.Value
            End If
            If (TotalCarbohydrates.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(10).Value = CType(TotalCarbohydrates.Value,Double)
            Else
                Me.Adapter.UpdateCommand.Parameters(10).Value = Global.System.DBNull.Value
            End If
            If (DietaryFiber.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(11).Value = CType(DietaryFiber.Value,Double)
            Else
                Me.Adapter.UpdateCommand.Parameters(11).Value = Global.System.DBNull.Value
            End If
            If (Sugar.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(12).Value = CType(Sugar.Value,Double)
            Else
                Me.Adapter.UpdateCommand.Parameters(12).Value = Global.System.DBNull.Value
            End If
            If (Protein.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(13).Value = CType(Protein.Value,Double)
            Else
                Me.Adapter.UpdateCommand.Parameters(13).Value = Global.System.DBNull.Value
            End If
            If (VitaminA.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(14).Value = CType(VitaminA.Value,Integer)
            Else
                Me.Adapter.UpdateCommand.Parameters(14).Value = Global.System.DBNull.Value
            End If
            If (VitaminC.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(15).Value = CType(VitaminC.Value,Integer)
            Else
                Me.Adapter.UpdateCommand.Parameters(15).Value = Global.System.DBNull.Value
            End If
            If (Calcium.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(16).Value = CType(Calcium.Value,Integer)
            Else
                Me.Adapter.UpdateCommand.Parameters(16).Value = Global.System.DBNull.Value
            End If
            If (Iron.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(17).Value = CType(Iron.Value,Integer)
            Else
                Me.Adapter.UpdateCommand.Parameters(17).Value = Global.System.DBNull.Value
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.UpdateCommand.Connection.State
            If ((Me.Adapter.UpdateCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.UpdateCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.UpdateCommand.Connection.Close
                End If
            End Try
        End Function
    End Class
    
    '''<summary>
    '''Represents the connection and commands used to retrieve and save data.
    '''</summary>
    <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"),  _
     Global.System.ComponentModel.DesignerCategoryAttribute("code"),  _
     Global.System.ComponentModel.ToolboxItem(true),  _
     Global.System.ComponentModel.DataObjectAttribute(true),  _
     Global.System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner"& _ 
        ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),  _
     Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
    Partial Public Class RecipeIngredientTableAdapter
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub New()
            MyBase.New
            Me.ClearBeforeFill = true
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property ClearBeforeFill() As Boolean
            Get
                Return Me._clearBeforeFill
            End Get
            Set
                Me._clearBeforeFill = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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 = "RecipeIngredient"
            tableMapping.ColumnMappings.Add("RecipeIngredientID", "RecipeIngredientID")
            tableMapping.ColumnMappings.Add("RecipeID", "RecipeID")
            tableMapping.ColumnMappings.Add("IngredientID", "IngredientID")
            tableMapping.ColumnMappings.Add("UnitMeasurementID", "UnitMeasurementID")
            tableMapping.ColumnMappings.Add("IngredientAmount", "IngredientAmount")
            Me._adapter.TableMappings.Add(tableMapping)
            Me._adapter.DeleteCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.DeleteCommand.Connection = Me.Connection
            Me._adapter.DeleteCommand.CommandText = "dbo.DeleteRecipeIngredient"
            Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@recipeIngredientId", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "RecipeIngredientID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.InsertCommand.Connection = Me.Connection
            Me._adapter.InsertCommand.CommandText = "dbo.InsertRecipeIngredient"
            Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RecipeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "RecipeID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IngredientID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "IngredientID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@UnitMeasurementID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "UnitMeasurementID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IngredientAmount", Global.System.Data.SqlDbType.[Decimal], 9, Global.System.Data.ParameterDirection.Input, 18, 0, "IngredientAmount", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Identity", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.InputOutput, 10, 0, "RecipeIngredientID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.UpdateCommand.Connection = Me.Connection
            Me._adapter.UpdateCommand.CommandText = "dbo.UpdateRecipeIngredient"
            Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RecipeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "RecipeID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IngredientID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "IngredientID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@UnitMeasurementID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "UnitMeasurementID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IngredientAmount", Global.System.Data.SqlDbType.[Decimal], 9, Global.System.Data.ParameterDirection.Input, 18, 0, "IngredientAmount", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_RecipeIngredientId", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "RecipeIngredientID", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitConnection()
            Me._connection = New Global.System.Data.SqlClient.SqlConnection
            Me._connection.ConnectionString = Global.DataAccess.My.MySettings.Default.RecipeHolderDatabaseConnectionString
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitCommandCollection()
            Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(2) {}
            Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(0).Connection = Me.Connection
            Me._commandCollection(0).CommandText = "dbo.RetrieveRecipeIngredientById"
            Me._commandCollection(0).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@recipeId", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(1).Connection = Me.Connection
            Me._commandCollection(1).CommandText = "dbo.SearchForRecipeIngredient"
            Me._commandCollection(1).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@recipeIngredientId", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@recipeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@ingredientID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@unitMeasurementID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@ingredientAmount", Global.System.Data.SqlDbType.[Decimal], 9, Global.System.Data.ParameterDirection.Input, 18, 0, Nothing, 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 = "dbo.RetrieveRecipeIngredientTable"
            Me._commandCollection(2).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@recipeId", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, true)>  _
        Public Overloads Overridable Function Fill(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RecipeIngredientDataTable, ByVal recipeId As Global.System.Nullable(Of Integer)) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            If (recipeId.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(recipeId.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], true)>  _
        Public Overloads Overridable Function GetData(ByVal recipeId As Global.System.Nullable(Of Integer)) As EntitiesLayer.RecipeHolderDatabaseDataSet.RecipeIngredientDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            If (recipeId.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(recipeId.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RecipeIngredientDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.RecipeIngredientDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)>  _
        Public Overloads Overridable Function FillBySearch(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RecipeIngredientDataTable, ByVal recipeIngredientId As Global.System.Nullable(Of Integer), ByVal recipeID As Global.System.Nullable(Of Integer), ByVal ingredientID As Global.System.Nullable(Of Integer), ByVal unitMeasurementID As Global.System.Nullable(Of Integer), ByVal ingredientAmount As Global.System.Nullable(Of Decimal)) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (recipeIngredientId.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(recipeIngredientId.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (recipeID.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(2).Value = CType(recipeID.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value
            End If
            If (ingredientID.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(3).Value = CType(ingredientID.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(3).Value = Global.System.DBNull.Value
            End If
            If (unitMeasurementID.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(4).Value = CType(unitMeasurementID.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(4).Value = Global.System.DBNull.Value
            End If
            If (ingredientAmount.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(5).Value = CType(ingredientAmount.Value,Decimal)
            Else
                Me.Adapter.SelectCommand.Parameters(5).Value = Global.System.DBNull.Value
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], false)>  _
        Public Overloads Overridable Function GetDataBySearch(ByVal recipeIngredientId As Global.System.Nullable(Of Integer), ByVal recipeID As Global.System.Nullable(Of Integer), ByVal ingredientID As Global.System.Nullable(Of Integer), ByVal unitMeasurementID As Global.System.Nullable(Of Integer), ByVal ingredientAmount As Global.System.Nullable(Of Decimal)) As EntitiesLayer.RecipeHolderDatabaseDataSet.RecipeIngredientDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (recipeIngredientId.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(recipeIngredientId.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (recipeID.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(2).Value = CType(recipeID.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value
            End If
            If (ingredientID.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(3).Value = CType(ingredientID.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(3).Value = Global.System.DBNull.Value
            End If
            If (unitMeasurementID.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(4).Value = CType(unitMeasurementID.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(4).Value = Global.System.DBNull.Value
            End If
            If (ingredientAmount.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(5).Value = CType(ingredientAmount.Value,Decimal)
            Else
                Me.Adapter.SelectCommand.Parameters(5).Value = Global.System.DBNull.Value
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RecipeIngredientDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.RecipeIngredientDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)>  _
        Public Overloads Overridable Function FillIngredients(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RecipeIngredientDataTable, ByVal recipeId As Global.System.Nullable(Of Integer)) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(2)
            If (recipeId.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(recipeId.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], false)>  _
        Public Overloads Overridable Function GetDataByIngredients(ByVal recipeId As Global.System.Nullable(Of Integer)) As EntitiesLayer.RecipeHolderDatabaseDataSet.RecipeIngredientDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(2)
            If (recipeId.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(recipeId.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RecipeIngredientDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.RecipeIngredientDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RecipeIngredientDataTable) As Integer
            Return Me.Adapter.Update(dataTable)
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataSet As EntitiesLayer.RecipeHolderDatabaseDataSet) As Integer
            Return Me.Adapter.Update(dataSet, "RecipeIngredient")
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataRow As Global.System.Data.DataRow) As Integer
            Return Me.Adapter.Update(New Global.System.Data.DataRow() {dataRow})
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer
            Return Me.Adapter.Update(dataRows)
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Delete, true)>  _
        Public Overloads Overridable Function Delete(ByVal recipeIngredientId As Global.System.Nullable(Of Integer)) As Integer
            If (recipeIngredientId.HasValue = true) Then
                Me.Adapter.DeleteCommand.Parameters(1).Value = CType(recipeIngredientId.Value,Integer)
            Else
                Me.Adapter.DeleteCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.DeleteCommand.Connection.State
            If ((Me.Adapter.DeleteCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.DeleteCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.DeleteCommand.Connection.Close
                End If
            End Try
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Insert, true)>  _
        Public Overloads Overridable Function Insert(ByVal RecipeID As Global.System.Nullable(Of Integer), ByVal IngredientID As Global.System.Nullable(Of Integer), ByVal UnitMeasurementID As Global.System.Nullable(Of Integer), ByVal IngredientAmount As Global.System.Nullable(Of Decimal), ByRef Identity As Global.System.Nullable(Of Integer)) As Integer
            If (RecipeID.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(1).Value = CType(RecipeID.Value,Integer)
            Else
                Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (IngredientID.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(2).Value = CType(IngredientID.Value,Integer)
            Else
                Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value
            End If
            If (UnitMeasurementID.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(3).Value = CType(UnitMeasurementID.Value,Integer)
            Else
                Me.Adapter.InsertCommand.Parameters(3).Value = Global.System.DBNull.Value
            End If
            If (IngredientAmount.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(4).Value = CType(IngredientAmount.Value,Decimal)
            Else
                Me.Adapter.InsertCommand.Parameters(4).Value = Global.System.DBNull.Value
            End If
            If (Identity.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(5).Value = CType(Identity.Value,Integer)
            Else
                Me.Adapter.InsertCommand.Parameters(5).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
                If ((Me.Adapter.InsertCommand.Parameters(5).Value Is Nothing)  _
                            OrElse (Me.Adapter.InsertCommand.Parameters(5).Value.GetType Is GetType(Global.System.DBNull))) Then
                    Identity = New Global.System.Nullable(Of Integer)
                Else
                    Identity = New Global.System.Nullable(Of Integer)(CType(Me.Adapter.InsertCommand.Parameters(5).Value,Integer))
                End If
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.InsertCommand.Connection.Close
                End If
            End Try
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Update, true)>  _
        Public Overloads Overridable Function Update(ByVal RecipeID As Global.System.Nullable(Of Integer), ByVal IngredientID As Global.System.Nullable(Of Integer), ByVal UnitMeasurementID As Global.System.Nullable(Of Integer), ByVal IngredientAmount As Global.System.Nullable(Of Decimal), ByVal Original_RecipeIngredientId As Global.System.Nullable(Of Integer)) As Integer
            If (RecipeID.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(1).Value = CType(RecipeID.Value,Integer)
            Else
                Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (IngredientID.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(2).Value = CType(IngredientID.Value,Integer)
            Else
                Me.Adapter.UpdateCommand.Parameters(2).Value = Global.System.DBNull.Value
            End If
            If (UnitMeasurementID.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(3).Value = CType(UnitMeasurementID.Value,Integer)
            Else
                Me.Adapter.UpdateCommand.Parameters(3).Value = Global.System.DBNull.Value
            End If
            If (IngredientAmount.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(4).Value = CType(IngredientAmount.Value,Decimal)
            Else
                Me.Adapter.UpdateCommand.Parameters(4).Value = Global.System.DBNull.Value
            End If
            If (Original_RecipeIngredientId.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(5).Value = CType(Original_RecipeIngredientId.Value,Integer)
            Else
                Me.Adapter.UpdateCommand.Parameters(5).Value = Global.System.DBNull.Value
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.UpdateCommand.Connection.State
            If ((Me.Adapter.UpdateCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.UpdateCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.UpdateCommand.Connection.Close
                End If
            End Try
        End Function
    End Class
    
    '''<summary>
    '''Represents the connection and commands used to retrieve and save data.
    '''</summary>
    <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"),  _
     Global.System.ComponentModel.DesignerCategoryAttribute("code"),  _
     Global.System.ComponentModel.ToolboxItem(true),  _
     Global.System.ComponentModel.DataObjectAttribute(true),  _
     Global.System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner"& _ 
        ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),  _
     Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
    Partial Public Class RecipesTableAdapter
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub New()
            MyBase.New
            Me.ClearBeforeFill = true
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property ClearBeforeFill() As Boolean
            Get
                Return Me._clearBeforeFill
            End Get
            Set
                Me._clearBeforeFill = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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 = "Recipes"
            tableMapping.ColumnMappings.Add("PreparationTime", "PreparationTime")
            tableMapping.ColumnMappings.Add("Directions", "Directions")
            tableMapping.ColumnMappings.Add("CookTime", "CookTime")
            tableMapping.ColumnMappings.Add("Photo", "Photo")
            tableMapping.ColumnMappings.Add("Temperature", "Temperature")
            tableMapping.ColumnMappings.Add("RecipeID", "RecipeID")
            tableMapping.ColumnMappings.Add("CourseTypeID", "CourseTypeID")
            tableMapping.ColumnMappings.Add("CuisineTypeID", "CuisineTypeID")
            tableMapping.ColumnMappings.Add("Name", "Name")
            tableMapping.ColumnMappings.Add("AccountId", "AccountId")
            Me._adapter.TableMappings.Add(tableMapping)
            Me._adapter.DeleteCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.DeleteCommand.Connection = Me.Connection
            Me._adapter.DeleteCommand.CommandText = "dbo.DeleteRecipe"
            Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@recipeId", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "RecipeID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.InsertCommand.Connection = Me.Connection
            Me._adapter.InsertCommand.CommandText = "dbo.InsertRecipe"
            Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RecipeName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CourseTypeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "CourseTypeID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CuisineTypeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "CuisineTypeID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@PreparationTime", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "PreparationTime", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Directions", Global.System.Data.SqlDbType.VarChar, 3000, Global.System.Data.ParameterDirection.Input, 0, 0, "Directions", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CookTime", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "CookTime", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Photo", Global.System.Data.SqlDbType.VarBinary, 2147483647, Global.System.Data.ParameterDirection.Input, 0, 0, "Photo", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Temperature", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "Temperature", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@AccountId", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "AccountId", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RecipeId", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.InputOutput, 10, 0, "RecipeID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.UpdateCommand.Connection = Me.Connection
            Me._adapter.UpdateCommand.CommandText = "dbo.UpdateRecipe"
            Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@preparationTime", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "PreparationTime", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@directions", Global.System.Data.SqlDbType.VarChar, 3000, Global.System.Data.ParameterDirection.Input, 0, 0, "Directions", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@cookTime", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "CookTime", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@photo", Global.System.Data.SqlDbType.VarBinary, 2147483647, Global.System.Data.ParameterDirection.Input, 0, 0, "Photo", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@temperature", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "Temperature", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@recipeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "RecipeID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@courseTypeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "CourseTypeID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@cuisineTypeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "CuisineTypeID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@recipeName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@accountId", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "AccountId", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitConnection()
            Me._connection = New Global.System.Data.SqlClient.SqlConnection
            Me._connection.ConnectionString = Global.DataAccess.My.MySettings.Default.RecipeHolderDatabaseConnectionString
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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 = "dbo.RetrieveRecipeById"
            Me._commandCollection(0).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@accountId", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(1).Connection = Me.Connection
            Me._commandCollection(1).CommandText = "dbo.SearchForRecipes"
            Me._commandCollection(1).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@recipeName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@preparationTimeMin", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@preparationTimeMax", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@courseTypeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@cuisineTypeID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@accountId", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, true)>  _
        Public Overloads Overridable Function FillRecipeById(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RecipesDataTable, ByVal accountId As Global.System.Nullable(Of Integer)) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            If (accountId.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(accountId.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], true)>  _
        Public Overloads Overridable Function GetDataRecipesById(ByVal accountId As Global.System.Nullable(Of Integer)) As EntitiesLayer.RecipeHolderDatabaseDataSet.RecipesDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            If (accountId.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(accountId.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RecipesDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.RecipesDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)>  _
        Public Overloads Overridable Function FillBySearch(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RecipesDataTable, ByVal recipeName As String, ByVal preparationTimeMin As Global.System.Nullable(Of Integer), ByVal preparationTimeMax As Global.System.Nullable(Of Integer), ByVal courseTypeID As Global.System.Nullable(Of Integer), ByVal cuisineTypeID As Global.System.Nullable(Of Integer), ByVal accountId As Global.System.Nullable(Of Integer)) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (recipeName Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(recipeName,String)
            End If
            If (preparationTimeMin.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(2).Value = CType(preparationTimeMin.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value
            End If
            If (preparationTimeMax.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(3).Value = CType(preparationTimeMax.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(3).Value = Global.System.DBNull.Value
            End If
            If (courseTypeID.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(4).Value = CType(courseTypeID.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(4).Value = Global.System.DBNull.Value
            End If
            If (cuisineTypeID.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(5).Value = CType(cuisineTypeID.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(5).Value = Global.System.DBNull.Value
            End If
            If (accountId.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(6).Value = CType(accountId.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(6).Value = Global.System.DBNull.Value
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], false)>  _
        Public Overloads Overridable Function GetDataBySearch(ByVal recipeName As String, ByVal preparationTimeMin As Global.System.Nullable(Of Integer), ByVal preparationTimeMax As Global.System.Nullable(Of Integer), ByVal courseTypeID As Global.System.Nullable(Of Integer), ByVal cuisineTypeID As Global.System.Nullable(Of Integer), ByVal accountId As Global.System.Nullable(Of Integer)) As EntitiesLayer.RecipeHolderDatabaseDataSet.RecipesDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (recipeName Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(recipeName,String)
            End If
            If (preparationTimeMin.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(2).Value = CType(preparationTimeMin.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value
            End If
            If (preparationTimeMax.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(3).Value = CType(preparationTimeMax.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(3).Value = Global.System.DBNull.Value
            End If
            If (courseTypeID.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(4).Value = CType(courseTypeID.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(4).Value = Global.System.DBNull.Value
            End If
            If (cuisineTypeID.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(5).Value = CType(cuisineTypeID.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(5).Value = Global.System.DBNull.Value
            End If
            If (accountId.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(6).Value = CType(accountId.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(6).Value = Global.System.DBNull.Value
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RecipesDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.RecipesDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RecipesDataTable) As Integer
            Return Me.Adapter.Update(dataTable)
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataSet As EntitiesLayer.RecipeHolderDatabaseDataSet) As Integer
            Return Me.Adapter.Update(dataSet, "Recipes")
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataRow As Global.System.Data.DataRow) As Integer
            Return Me.Adapter.Update(New Global.System.Data.DataRow() {dataRow})
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer
            Return Me.Adapter.Update(dataRows)
        End Function
    End Class
    
    '''<summary>
    '''Represents the connection and commands used to retrieve and save data.
    '''</summary>
    <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"),  _
     Global.System.ComponentModel.DesignerCategoryAttribute("code"),  _
     Global.System.ComponentModel.ToolboxItem(true),  _
     Global.System.ComponentModel.DataObjectAttribute(true),  _
     Global.System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner"& _ 
        ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),  _
     Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
    Partial Public Class UnitMeasurementsTableAdapter
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub New()
            MyBase.New
            Me.ClearBeforeFill = true
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property ClearBeforeFill() As Boolean
            Get
                Return Me._clearBeforeFill
            End Get
            Set
                Me._clearBeforeFill = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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 = "UnitMeasurements"
            tableMapping.ColumnMappings.Add("UnitMeasurementID", "UnitMeasurementID")
            tableMapping.ColumnMappings.Add("Name", "Name")
            Me._adapter.TableMappings.Add(tableMapping)
            Me._adapter.DeleteCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.DeleteCommand.Connection = Me.Connection
            Me._adapter.DeleteCommand.CommandText = "dbo.DeleteUnitMeasurement"
            Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_UnitMeasurementID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "UnitMeasurementID", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Name", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.InsertCommand.Connection = Me.Connection
            Me._adapter.InsertCommand.CommandText = "dbo.InsertUnitMeasurement"
            Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@unitMeaNameToInsert", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Identity", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.InputOutput, 10, 0, "UnitMeasurementID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.UpdateCommand.Connection = Me.Connection
            Me._adapter.UpdateCommand.CommandText = "dbo.UpdateUnitMeasurement"
            Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_UnitMeasurementID", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "UnitMeasurementID", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_Name", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@newUnitMeasurementName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "Name", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitConnection()
            Me._connection = New Global.System.Data.SqlClient.SqlConnection
            Me._connection.ConnectionString = Global.DataAccess.My.MySettings.Default.RecipeHolderDatabaseConnectionString
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitCommandCollection()
            Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(2) {}
            Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(0).Connection = Me.Connection
            Me._commandCollection(0).CommandText = "dbo.RetrieveAllUnitMeasurements"
            Me._commandCollection(0).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(1).Connection = Me.Connection
            Me._commandCollection(1).CommandText = "dbo.SearchForUnitMeasurement"
            Me._commandCollection(1).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@idToSearch", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@nameToSearch", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, Nothing, 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 = "dbo.RetrieveUnitMeasurementById"
            Me._commandCollection(2).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@unitMeasurementIdToSearch", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, true)>  _
        Public Overloads Overridable Function Fill(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.UnitMeasurementsDataTable) 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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], true)>  _
        Public Overloads Overridable Function GetData() As EntitiesLayer.RecipeHolderDatabaseDataSet.UnitMeasurementsDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.UnitMeasurementsDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.UnitMeasurementsDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)>  _
        Public Overloads Overridable Function FillBySearch(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.UnitMeasurementsDataTable, ByVal idToSearch As Global.System.Nullable(Of Integer), ByVal nameToSearch As String) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (idToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(idToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (nameToSearch Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(2).Value = CType(nameToSearch,String)
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], false)>  _
        Public Overloads Overridable Function GetDataBySearch(ByVal idToSearch As Global.System.Nullable(Of Integer), ByVal nameToSearch As String) As EntitiesLayer.RecipeHolderDatabaseDataSet.UnitMeasurementsDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (idToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(idToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (nameToSearch Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(2).Value = CType(nameToSearch,String)
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.UnitMeasurementsDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.UnitMeasurementsDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)>  _
        Public Overloads Overridable Function FillByUnitMeasurementId(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.UnitMeasurementsDataTable, ByVal unitMeasurementIdToSearch As Global.System.Nullable(Of Integer)) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(2)
            If (unitMeasurementIdToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(unitMeasurementIdToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], false)>  _
        Public Overloads Overridable Function GetDataByUnitMeasurementId(ByVal unitMeasurementIdToSearch As Global.System.Nullable(Of Integer)) As EntitiesLayer.RecipeHolderDatabaseDataSet.UnitMeasurementsDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(2)
            If (unitMeasurementIdToSearch.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(unitMeasurementIdToSearch.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.UnitMeasurementsDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.UnitMeasurementsDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.UnitMeasurementsDataTable) As Integer
            Return Me.Adapter.Update(dataTable)
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataSet As EntitiesLayer.RecipeHolderDatabaseDataSet) As Integer
            Return Me.Adapter.Update(dataSet, "UnitMeasurements")
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataRow As Global.System.Data.DataRow) As Integer
            Return Me.Adapter.Update(New Global.System.Data.DataRow() {dataRow})
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer
            Return Me.Adapter.Update(dataRows)
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Delete, true)>  _
        Public Overloads Overridable Function Delete(ByVal Original_UnitMeasurementID As Global.System.Nullable(Of Integer), ByVal Original_Name As String) As Integer
            If (Original_UnitMeasurementID.HasValue = true) Then
                Me.Adapter.DeleteCommand.Parameters(1).Value = CType(Original_UnitMeasurementID.Value,Integer)
            Else
                Me.Adapter.DeleteCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (Original_Name Is Nothing) Then
                Me.Adapter.DeleteCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.DeleteCommand.Parameters(2).Value = CType(Original_Name,String)
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.DeleteCommand.Connection.State
            If ((Me.Adapter.DeleteCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.DeleteCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.DeleteCommand.Connection.Close
                End If
            End Try
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Insert, true)>  _
        Public Overloads Overridable Function Insert(ByVal unitMeaNameToInsert As String, ByRef Identity As Global.System.Nullable(Of Integer)) As Integer
            If (unitMeaNameToInsert Is Nothing) Then
                Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.InsertCommand.Parameters(1).Value = CType(unitMeaNameToInsert,String)
            End If
            If (Identity.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(2).Value = CType(Identity.Value,Integer)
            Else
                Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.InsertCommand.Connection.State
            If ((Me.Adapter.InsertCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.InsertCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.InsertCommand.ExecuteNonQuery
                If ((Me.Adapter.InsertCommand.Parameters(2).Value Is Nothing)  _
                            OrElse (Me.Adapter.InsertCommand.Parameters(2).Value.GetType Is GetType(Global.System.DBNull))) Then
                    Identity = New Global.System.Nullable(Of Integer)
                Else
                    Identity = New Global.System.Nullable(Of Integer)(CType(Me.Adapter.InsertCommand.Parameters(2).Value,Integer))
                End If
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.InsertCommand.Connection.Close
                End If
            End Try
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Update, true)>  _
        Public Overloads Overridable Function Update(ByVal Original_UnitMeasurementID As String, ByVal Original_Name As String, ByVal newUnitMeasurementName As String) As Integer
            If (Original_UnitMeasurementID Is Nothing) Then
                Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.UpdateCommand.Parameters(1).Value = CType(Original_UnitMeasurementID,String)
            End If
            If (Original_Name Is Nothing) Then
                Me.Adapter.UpdateCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.UpdateCommand.Parameters(2).Value = CType(Original_Name,String)
            End If
            If (newUnitMeasurementName Is Nothing) Then
                Me.Adapter.UpdateCommand.Parameters(3).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.UpdateCommand.Parameters(3).Value = CType(newUnitMeasurementName,String)
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.UpdateCommand.Connection.State
            If ((Me.Adapter.UpdateCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.UpdateCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.UpdateCommand.Connection.Close
                End If
            End Try
        End Function
    End Class
    
    '''<summary>
    '''Represents the connection and commands used to retrieve and save data.
    '''</summary>
    <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"),  _
     Global.System.ComponentModel.DesignerCategoryAttribute("code"),  _
     Global.System.ComponentModel.ToolboxItem(true),  _
     Global.System.ComponentModel.DataObjectAttribute(true),  _
     Global.System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner"& _ 
        ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),  _
     Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
    Partial Public Class AccountsTableAdapter
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub New()
            MyBase.New
            Me.ClearBeforeFill = true
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property ClearBeforeFill() As Boolean
            Get
                Return Me._clearBeforeFill
            End Get
            Set
                Me._clearBeforeFill = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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 = "Accounts"
            tableMapping.ColumnMappings.Add("AccountID", "AccountID")
            tableMapping.ColumnMappings.Add("FirstName", "FirstName")
            tableMapping.ColumnMappings.Add("LastName", "LastName")
            tableMapping.ColumnMappings.Add("UserName", "UserName")
            tableMapping.ColumnMappings.Add("Password", "Password")
            tableMapping.ColumnMappings.Add("isProtected", "isProtected")
            tableMapping.ColumnMappings.Add("EMail", "EMail")
            tableMapping.ColumnMappings.Add("DateCreated", "DateCreated")
            Me._adapter.TableMappings.Add(tableMapping)
            Me._adapter.DeleteCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.DeleteCommand.Connection = Me.Connection
            Me._adapter.DeleteCommand.CommandText = "dbo.DeleteAccount"
            Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@accountIdToDelete", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "AccountID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.InsertCommand.Connection = Me.Connection
            Me._adapter.InsertCommand.CommandText = "dbo.InsertAccount"
            Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@FirstName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "FirstName", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@LastName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "LastName", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@UserName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "UserName", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Password", Global.System.Data.SqlDbType.VarBinary, 32, Global.System.Data.ParameterDirection.Input, 0, 0, "Password", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@isProtected", Global.System.Data.SqlDbType.Bit, 1, Global.System.Data.ParameterDirection.Input, 1, 0, "isProtected", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Email", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "EMail", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@AccountId", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.InputOutput, 10, 0, "AccountID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.UpdateCommand.Connection = Me.Connection
            Me._adapter.UpdateCommand.CommandText = "dbo.UpdateAccount"
            Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@FirstName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "FirstName", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@LastName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "LastName", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@UserName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "UserName", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Password", Global.System.Data.SqlDbType.VarBinary, 32, Global.System.Data.ParameterDirection.Input, 0, 0, "Password", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@isProtected", Global.System.Data.SqlDbType.Bit, 1, Global.System.Data.ParameterDirection.Input, 1, 0, "isProtected", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@accountIdToUpdate", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, "AccountID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@email", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, "EMail", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitConnection()
            Me._connection = New Global.System.Data.SqlClient.SqlConnection
            Me._connection.ConnectionString = Global.DataAccess.My.MySettings.Default.RecipeHolderDatabaseConnectionString
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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 = "dbo.RetrieveAccountByProtection"
            Me._commandCollection(0).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@isProtected", Global.System.Data.SqlDbType.Bit, 1, Global.System.Data.ParameterDirection.Input, 1, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(1).Connection = Me.Connection
            Me._commandCollection(1).CommandText = "dbo.SearchForProfile"
            Me._commandCollection(1).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@accountId", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@firstName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@lastName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@eMail", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@dateCreated", Global.System.Data.SqlDbType.DateTime, 8, Global.System.Data.ParameterDirection.Input, 23, 3, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@isProtected", Global.System.Data.SqlDbType.Bit, 1, Global.System.Data.ParameterDirection.Input, 1, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, true)>  _
        Public Overloads Overridable Function Fill(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.AccountsDataTable, ByVal isProtected As Global.System.Nullable(Of Boolean)) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            If (isProtected.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(isProtected.Value,Boolean)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], true)>  _
        Public Overloads Overridable Function GetData(ByVal isProtected As Global.System.Nullable(Of Boolean)) As EntitiesLayer.RecipeHolderDatabaseDataSet.AccountsDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            If (isProtected.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(isProtected.Value,Boolean)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.AccountsDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.AccountsDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)>  _
        Public Overloads Overridable Function FillBySearch(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.AccountsDataTable, ByVal accountId As Global.System.Nullable(Of Integer), ByVal firstName As String, ByVal lastName As String, ByVal eMail As String, ByVal dateCreated As Global.System.Nullable(Of Date), ByVal isProtected As Global.System.Nullable(Of Boolean)) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (accountId.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(accountId.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (firstName Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(2).Value = CType(firstName,String)
            End If
            If (lastName Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(3).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(3).Value = CType(lastName,String)
            End If
            If (eMail Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(4).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(4).Value = CType(eMail,String)
            End If
            If (dateCreated.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(5).Value = CType(dateCreated.Value,Date)
            Else
                Me.Adapter.SelectCommand.Parameters(5).Value = Global.System.DBNull.Value
            End If
            If (isProtected.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(6).Value = CType(isProtected.Value,Boolean)
            Else
                Me.Adapter.SelectCommand.Parameters(6).Value = Global.System.DBNull.Value
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], false)>  _
        Public Overloads Overridable Function GetDataBySearch(ByVal accountId As Global.System.Nullable(Of Integer), ByVal firstName As String, ByVal lastName As String, ByVal eMail As String, ByVal dateCreated As Global.System.Nullable(Of Date), ByVal isProtected As Global.System.Nullable(Of Boolean)) As EntitiesLayer.RecipeHolderDatabaseDataSet.AccountsDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (accountId.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(accountId.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (firstName Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(2).Value = CType(firstName,String)
            End If
            If (lastName Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(3).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(3).Value = CType(lastName,String)
            End If
            If (eMail Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(4).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(4).Value = CType(eMail,String)
            End If
            If (dateCreated.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(5).Value = CType(dateCreated.Value,Date)
            Else
                Me.Adapter.SelectCommand.Parameters(5).Value = Global.System.DBNull.Value
            End If
            If (isProtected.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(6).Value = CType(isProtected.Value,Boolean)
            Else
                Me.Adapter.SelectCommand.Parameters(6).Value = Global.System.DBNull.Value
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.AccountsDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.AccountsDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.AccountsDataTable) As Integer
            Return Me.Adapter.Update(dataTable)
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataSet As EntitiesLayer.RecipeHolderDatabaseDataSet) As Integer
            Return Me.Adapter.Update(dataSet, "Accounts")
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataRow As Global.System.Data.DataRow) As Integer
            Return Me.Adapter.Update(New Global.System.Data.DataRow() {dataRow})
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
        Public Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer
            Return Me.Adapter.Update(dataRows)
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Delete, true)>  _
        Public Overloads Overridable Function Delete(ByVal accountIdToDelete As Global.System.Nullable(Of Integer)) As Integer
            If (accountIdToDelete.HasValue = true) Then
                Me.Adapter.DeleteCommand.Parameters(1).Value = CType(accountIdToDelete.Value,Integer)
            Else
                Me.Adapter.DeleteCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.DeleteCommand.Connection.State
            If ((Me.Adapter.DeleteCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.DeleteCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.DeleteCommand.ExecuteNonQuery
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.DeleteCommand.Connection.Close
                End If
            End Try
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Insert, true)>  _
        Public Overloads Overridable Function Insert(ByVal FirstName As String, ByVal LastName As String, ByVal UserName As String, ByVal Password() As Byte, ByVal isProtected As Global.System.Nullable(Of Boolean), ByVal Email As String, ByRef AccountId As Global.System.Nullable(Of Integer)) As Integer
            If (FirstName Is Nothing) Then
                Me.Adapter.InsertCommand.Parameters(1).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.InsertCommand.Parameters(1).Value = CType(FirstName,String)
            End If
            If (LastName Is Nothing) Then
                Me.Adapter.InsertCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.InsertCommand.Parameters(2).Value = CType(LastName,String)
            End If
            If (UserName Is Nothing) Then
                Me.Adapter.InsertCommand.Parameters(3).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.InsertCommand.Parameters(3).Value = CType(UserName,String)
            End If
            If (Password Is Nothing) Then
                Me.Adapter.InsertCommand.Parameters(4).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.InsertCommand.Parameters(4).Value = CType(Password,Byte())
            End If
            If (isProtected.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(5).Value = CType(isProtected.Value,Boolean)
            Else
                Me.Adapter.InsertCommand.Parameters(5).Value = Global.System.DBNull.Value
            End If
            If (Email Is Nothing) Then
                Me.Adapter.InsertCommand.Parameters(6).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.InsertCommand.Parameters(6).Value = CType(Email,String)
            End If
            If (AccountId.HasValue = true) Then
                Me.Adapter.InsertCommand.Parameters(7).Value = CType(AccountId.Value,Integer)
            Else
                Me.Adapter.InsertCommand.Parameters(7).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
                If ((Me.Adapter.InsertCommand.Parameters(7).Value Is Nothing)  _
                            OrElse (Me.Adapter.InsertCommand.Parameters(7).Value.GetType Is GetType(Global.System.DBNull))) Then
                    AccountId = New Global.System.Nullable(Of Integer)
                Else
                    AccountId = New Global.System.Nullable(Of Integer)(CType(Me.Adapter.InsertCommand.Parameters(7).Value,Integer))
                End If
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.InsertCommand.Connection.Close
                End If
            End Try
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Update, true)>  _
        Public Overloads Overridable Function Update(ByVal FirstName As String, ByVal LastName As String, ByVal UserName As String, ByVal Password() As Byte, ByVal isProtected As Global.System.Nullable(Of Boolean), ByVal accountIdToUpdate As Global.System.Nullable(Of Integer), ByVal email As String) As Integer
            If (FirstName Is Nothing) Then
                Me.Adapter.UpdateCommand.Parameters(1).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.UpdateCommand.Parameters(1).Value = CType(FirstName,String)
            End If
            If (LastName Is Nothing) Then
                Me.Adapter.UpdateCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.UpdateCommand.Parameters(2).Value = CType(LastName,String)
            End If
            If (UserName Is Nothing) Then
                Me.Adapter.UpdateCommand.Parameters(3).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.UpdateCommand.Parameters(3).Value = CType(UserName,String)
            End If
            If (Password Is Nothing) Then
                Me.Adapter.UpdateCommand.Parameters(4).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.UpdateCommand.Parameters(4).Value = CType(Password,Byte())
            End If
            If (isProtected.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(5).Value = CType(isProtected.Value,Boolean)
            Else
                Me.Adapter.UpdateCommand.Parameters(5).Value = Global.System.DBNull.Value
            End If
            If (accountIdToUpdate.HasValue = true) Then
                Me.Adapter.UpdateCommand.Parameters(6).Value = CType(accountIdToUpdate.Value,Integer)
            Else
                Me.Adapter.UpdateCommand.Parameters(6).Value = Global.System.DBNull.Value
            End If
            If (email Is Nothing) Then
                Me.Adapter.UpdateCommand.Parameters(7).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.UpdateCommand.Parameters(7).Value = CType(email,String)
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = Me.Adapter.UpdateCommand.Connection.State
            If ((Me.Adapter.UpdateCommand.Connection.State And Global.System.Data.ConnectionState.Open)  _
                        <> Global.System.Data.ConnectionState.Open) Then
                Me.Adapter.UpdateCommand.Connection.Open
            End If
            Try 
                Dim returnValue As Integer = Me.Adapter.UpdateCommand.ExecuteNonQuery
                Return returnValue
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    Me.Adapter.UpdateCommand.Connection.Close
                End If
            End Try
        End Function
    End Class
    
    '''<summary>
    '''Represents the connection and commands used to retrieve and save data.
    '''</summary>
    <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"),  _
     Global.System.ComponentModel.DesignerCategoryAttribute("code"),  _
     Global.System.ComponentModel.ToolboxItem(true),  _
     Global.System.ComponentModel.DataObjectAttribute(true),  _
     Global.System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner"& _ 
        ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),  _
     Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
    Partial Public Class RetrieveRecipeTableTableAdapter
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub New()
            MyBase.New
            Me.ClearBeforeFill = true
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property ClearBeforeFill() As Boolean
            Get
                Return Me._clearBeforeFill
            End Get
            Set
                Me._clearBeforeFill = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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 = "RetrieveRecipeTable"
            tableMapping.ColumnMappings.Add("AccountId", "AccountId")
            tableMapping.ColumnMappings.Add("RecipeID", "RecipeID")
            tableMapping.ColumnMappings.Add("RecipeName", "RecipeName")
            tableMapping.ColumnMappings.Add("PreparationTime", "PreparationTime")
            tableMapping.ColumnMappings.Add("Directions", "Directions")
            tableMapping.ColumnMappings.Add("CookTime", "CookTime")
            tableMapping.ColumnMappings.Add("Temperature", "Temperature")
            tableMapping.ColumnMappings.Add("CourseTypeName", "CourseTypeName")
            tableMapping.ColumnMappings.Add("CuisineTypeName", "CuisineTypeName")
            Me._adapter.TableMappings.Add(tableMapping)
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitConnection()
            Me._connection = New Global.System.Data.SqlClient.SqlConnection
            Me._connection.ConnectionString = Global.DataAccess.My.MySettings.Default.RecipeHolderDatabaseConnectionString
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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 = "dbo.RetrieveRecipeTable"
            Me._commandCollection(0).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@accountId", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(1).Connection = Me.Connection
            Me._commandCollection(1).CommandText = "dbo.SearchRecipeTable"
            Me._commandCollection(1).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@recipeName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@courseTypeName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@cuisineTypeName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@prepMax", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@prepMin", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, true)>  _
        Public Overloads Overridable Function Fill(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RetrieveRecipeTableDataTable, ByVal accountId As Global.System.Nullable(Of Integer)) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            If (accountId.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(accountId.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], true)>  _
        Public Overloads Overridable Function GetData(ByVal accountId As Global.System.Nullable(Of Integer)) As EntitiesLayer.RecipeHolderDatabaseDataSet.RetrieveRecipeTableDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            If (accountId.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(accountId.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RetrieveRecipeTableDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.RetrieveRecipeTableDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)>  _
        Public Overloads Overridable Function FillBySearch(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RetrieveRecipeTableDataTable, ByVal recipeName As String, ByVal courseTypeName As String, ByVal cuisineTypeName As String, ByVal prepMax As Global.System.Nullable(Of Integer), ByVal prepMin As Global.System.Nullable(Of Integer)) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (recipeName Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(recipeName,String)
            End If
            If (courseTypeName Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(2).Value = CType(courseTypeName,String)
            End If
            If (cuisineTypeName Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(3).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(3).Value = CType(cuisineTypeName,String)
            End If
            If (prepMax.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(4).Value = CType(prepMax.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(4).Value = Global.System.DBNull.Value
            End If
            If (prepMin.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(5).Value = CType(prepMin.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(5).Value = Global.System.DBNull.Value
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], false)>  _
        Public Overloads Overridable Function GetDataBySearch(ByVal recipeName As String, ByVal courseTypeName As String, ByVal cuisineTypeName As String, ByVal prepMax As Global.System.Nullable(Of Integer), ByVal prepMin As Global.System.Nullable(Of Integer)) As EntitiesLayer.RecipeHolderDatabaseDataSet.RetrieveRecipeTableDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (recipeName Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(recipeName,String)
            End If
            If (courseTypeName Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(2).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(2).Value = CType(courseTypeName,String)
            End If
            If (cuisineTypeName Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(3).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(3).Value = CType(cuisineTypeName,String)
            End If
            If (prepMax.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(4).Value = CType(prepMax.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(4).Value = Global.System.DBNull.Value
            End If
            If (prepMin.HasValue = true) Then
                Me.Adapter.SelectCommand.Parameters(5).Value = CType(prepMin.Value,Integer)
            Else
                Me.Adapter.SelectCommand.Parameters(5).Value = Global.System.DBNull.Value
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RetrieveRecipeTableDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.RetrieveRecipeTableDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
    End Class
    
    '''<summary>
    '''Represents the connection and commands used to retrieve and save data.
    '''</summary>
    <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"),  _
     Global.System.ComponentModel.DesignerCategoryAttribute("code"),  _
     Global.System.ComponentModel.ToolboxItem(true),  _
     Global.System.ComponentModel.DataObjectAttribute(true),  _
     Global.System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner"& _ 
        ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),  _
     Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
    Partial Public Class RetrieveRecipeIngredientTableTableAdapter
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub New()
            MyBase.New
            Me.ClearBeforeFill = true
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property ClearBeforeFill() As Boolean
            Get
                Return Me._clearBeforeFill
            End Get
            Set
                Me._clearBeforeFill = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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 = "RetrieveRecipeIngredientTable"
            tableMapping.ColumnMappings.Add("RecipeId", "RecipeId")
            tableMapping.ColumnMappings.Add("IngredientName", "IngredientName")
            tableMapping.ColumnMappings.Add("IngredientAmount", "IngredientAmount")
            tableMapping.ColumnMappings.Add("UnitMeasurementName", "UnitMeasurementName")
            tableMapping.ColumnMappings.Add("FoodTypeName", "FoodTypeName")
            Me._adapter.TableMappings.Add(tableMapping)
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitConnection()
            Me._connection = New Global.System.Data.SqlClient.SqlConnection
            Me._connection.ConnectionString = Global.DataAccess.My.MySettings.Default.RecipeHolderDatabaseConnectionString
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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 = "dbo.RetrieveRecipeIngredientTable"
            Me._commandCollection(0).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(1).Connection = Me.Connection
            Me._commandCollection(1).CommandText = "dbo.SearchRecipeIngredientTable"
            Me._commandCollection(1).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@ingredientName", Global.System.Data.SqlDbType.VarChar, 50, Global.System.Data.ParameterDirection.Input, 0, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, true)>  _
        Public Overloads Overridable Function Fill(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RetrieveRecipeIngredientTableDataTable) 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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], true)>  _
        Public Overloads Overridable Function GetData() As EntitiesLayer.RecipeHolderDatabaseDataSet.RetrieveRecipeIngredientTableDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RetrieveRecipeIngredientTableDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.RetrieveRecipeIngredientTableDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)>  _
        Public Overloads Overridable Function FillBySearch(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RetrieveRecipeIngredientTableDataTable, ByVal ingredientName As String) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (ingredientName Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(ingredientName,String)
            End If
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], false)>  _
        Public Overloads Overridable Function GetDataBySearch(ByVal ingredientName As String) As EntitiesLayer.RecipeHolderDatabaseDataSet.RetrieveRecipeIngredientTableDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(1)
            If (ingredientName Is Nothing) Then
                Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value
            Else
                Me.Adapter.SelectCommand.Parameters(1).Value = CType(ingredientName,String)
            End If
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.RetrieveRecipeIngredientTableDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.RetrieveRecipeIngredientTableDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
    End Class
    
    '''<summary>
    '''Represents the connection and commands used to retrieve and save data.
    '''</summary>
    <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"),  _
     Global.System.ComponentModel.DesignerCategoryAttribute("code"),  _
     Global.System.ComponentModel.ToolboxItem(true),  _
     Global.System.ComponentModel.DataObjectAttribute(true),  _
     Global.System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner"& _ 
        ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),  _
     Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")>  _
    Partial Public Class ViewIngredientsFoodTypesTableAdapter
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub New()
            MyBase.New
            Me.ClearBeforeFill = true
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property ClearBeforeFill() As Boolean
            Get
                Return Me._clearBeforeFill
            End Get
            Set
                Me._clearBeforeFill = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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 = "ViewIngredientsFoodTypes"
            tableMapping.ColumnMappings.Add("IngredientName", "IngredientName")
            tableMapping.ColumnMappings.Add("FoodTypeName", "FoodTypeName")
            tableMapping.ColumnMappings.Add("FoodTypeID", "FoodTypeID")
            tableMapping.ColumnMappings.Add("IngredientID", "IngredientID")
            Me._adapter.TableMappings.Add(tableMapping)
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitConnection()
            Me._connection = New Global.System.Data.SqlClient.SqlConnection
            Me._connection.ConnectionString = Global.DataAccess.My.MySettings.Default.RecipeHolderDatabaseConnectionString
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitCommandCollection()
            Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(0) {}
            Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(0).Connection = Me.Connection
            Me._commandCollection(0).CommandText = "dbo.ViewIngredientsFoodTypes"
            Me._commandCollection(0).CommandType = Global.System.Data.CommandType.StoredProcedure
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@RETURN_VALUE", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.ReturnValue, 10, 0, Nothing, Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
        End Sub
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, true)>  _
        Public Overloads Overridable Function Fill(ByVal dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.ViewIngredientsFoodTypesDataTable) 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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"),  _
         Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], true)>  _
        Public Overloads Overridable Function GetData() As EntitiesLayer.RecipeHolderDatabaseDataSet.ViewIngredientsFoodTypesDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            Dim dataTable As EntitiesLayer.RecipeHolderDatabaseDataSet.ViewIngredientsFoodTypesDataTable = New EntitiesLayer.RecipeHolderDatabaseDataSet.ViewIngredientsFoodTypesDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
    End Class
    
    '''<summary>
    '''TableAdapterManager is used to coordinate TableAdapters in the dataset to enable Hierarchical Update scenarios
    '''</summary>
    <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"),  _
     Global.System.ComponentModel.DesignerCategoryAttribute("code"),  _
     Global.System.ComponentModel.ToolboxItem(true),  _
     Global.System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerDesigner, Microsoft.VSD"& _ 
        "esigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),  _
     Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapterManager")>  _
    Partial Public Class TableAdapterManager
        Inherits Global.System.ComponentModel.Component
        
        Private _updateOrder As UpdateOrderOption
        
        Private _coursesTableAdapter As CoursesTableAdapter
        
        Private _cuisineTypesTableAdapter As CuisineTypesTableAdapter
        
        Private _foodTypesTableAdapter As FoodTypesTableAdapter
        
        Private _ingredientsTableAdapter As IngredientsTableAdapter
        
        Private _nutritionDetailsTableAdapter As NutritionDetailsTableAdapter
        
        Private _recipeIngredientTableAdapter As RecipeIngredientTableAdapter
        
        Private _recipesTableAdapter As RecipesTableAdapter
        
        Private _unitMeasurementsTableAdapter As UnitMeasurementsTableAdapter
        
        Private _accountsTableAdapter As AccountsTableAdapter
        
        Private _backupDataSetBeforeUpdate As Boolean
        
        Private _connection As Global.System.Data.IDbConnection
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property UpdateOrder() As UpdateOrderOption
            Get
                Return Me._updateOrder
            End Get
            Set
                Me._updateOrder = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso"& _ 
            "ft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"& _ 
            "", "System.Drawing.Design.UITypeEditor")>  _
        Public Property CoursesTableAdapter() As CoursesTableAdapter
            Get
                Return Me._coursesTableAdapter
            End Get
            Set
                Me._coursesTableAdapter = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso"& _ 
            "ft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"& _ 
            "", "System.Drawing.Design.UITypeEditor")>  _
        Public Property CuisineTypesTableAdapter() As CuisineTypesTableAdapter
            Get
                Return Me._cuisineTypesTableAdapter
            End Get
            Set
                Me._cuisineTypesTableAdapter = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso"& _ 
            "ft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"& _ 
            "", "System.Drawing.Design.UITypeEditor")>  _
        Public Property FoodTypesTableAdapter() As FoodTypesTableAdapter
            Get
                Return Me._foodTypesTableAdapter
            End Get
            Set
                Me._foodTypesTableAdapter = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso"& _ 
            "ft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"& _ 
            "", "System.Drawing.Design.UITypeEditor")>  _
        Public Property IngredientsTableAdapter() As IngredientsTableAdapter
            Get
                Return Me._ingredientsTableAdapter
            End Get
            Set
                Me._ingredientsTableAdapter = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso"& _ 
            "ft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"& _ 
            "", "System.Drawing.Design.UITypeEditor")>  _
        Public Property NutritionDetailsTableAdapter() As NutritionDetailsTableAdapter
            Get
                Return Me._nutritionDetailsTableAdapter
            End Get
            Set
                Me._nutritionDetailsTableAdapter = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso"& _ 
            "ft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"& _ 
            "", "System.Drawing.Design.UITypeEditor")>  _
        Public Property RecipeIngredientTableAdapter() As RecipeIngredientTableAdapter
            Get
                Return Me._recipeIngredientTableAdapter
            End Get
            Set
                Me._recipeIngredientTableAdapter = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso"& _ 
            "ft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"& _ 
            "", "System.Drawing.Design.UITypeEditor")>  _
        Public Property RecipesTableAdapter() As RecipesTableAdapter
            Get
                Return Me._recipesTableAdapter
            End Get
            Set
                Me._recipesTableAdapter = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso"& _ 
            "ft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"& _ 
            "", "System.Drawing.Design.UITypeEditor")>  _
        Public Property UnitMeasurementsTableAdapter() As UnitMeasurementsTableAdapter
            Get
                Return Me._unitMeasurementsTableAdapter
            End Get
            Set
                Me._unitMeasurementsTableAdapter = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso"& _ 
            "ft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"& _ 
            "", "System.Drawing.Design.UITypeEditor")>  _
        Public Property AccountsTableAdapter() As AccountsTableAdapter
            Get
                Return Me._accountsTableAdapter
            End Get
            Set
                Me._accountsTableAdapter = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property BackupDataSetBeforeUpdate() As Boolean
            Get
                Return Me._backupDataSetBeforeUpdate
            End Get
            Set
                Me._backupDataSetBeforeUpdate = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Browsable(false)>  _
        Public Property Connection() As Global.System.Data.IDbConnection
            Get
                If (Not (Me._connection) Is Nothing) Then
                    Return Me._connection
                End If
                If ((Not (Me._coursesTableAdapter) Is Nothing)  _
                            AndAlso (Not (Me._coursesTableAdapter.Connection) Is Nothing)) Then
                    Return Me._coursesTableAdapter.Connection
                End If
                If ((Not (Me._cuisineTypesTableAdapter) Is Nothing)  _
                            AndAlso (Not (Me._cuisineTypesTableAdapter.Connection) Is Nothing)) Then
                    Return Me._cuisineTypesTableAdapter.Connection
                End If
                If ((Not (Me._foodTypesTableAdapter) Is Nothing)  _
                            AndAlso (Not (Me._foodTypesTableAdapter.Connection) Is Nothing)) Then
                    Return Me._foodTypesTableAdapter.Connection
                End If
                If ((Not (Me._ingredientsTableAdapter) Is Nothing)  _
                            AndAlso (Not (Me._ingredientsTableAdapter.Connection) Is Nothing)) Then
                    Return Me._ingredientsTableAdapter.Connection
                End If
                If ((Not (Me._nutritionDetailsTableAdapter) Is Nothing)  _
                            AndAlso (Not (Me._nutritionDetailsTableAdapter.Connection) Is Nothing)) Then
                    Return Me._nutritionDetailsTableAdapter.Connection
                End If
                If ((Not (Me._recipeIngredientTableAdapter) Is Nothing)  _
                            AndAlso (Not (Me._recipeIngredientTableAdapter.Connection) Is Nothing)) Then
                    Return Me._recipeIngredientTableAdapter.Connection
                End If
                If ((Not (Me._recipesTableAdapter) Is Nothing)  _
                            AndAlso (Not (Me._recipesTableAdapter.Connection) Is Nothing)) Then
                    Return Me._recipesTableAdapter.Connection
                End If
                If ((Not (Me._unitMeasurementsTableAdapter) Is Nothing)  _
                            AndAlso (Not (Me._unitMeasurementsTableAdapter.Connection) Is Nothing)) Then
                    Return Me._unitMeasurementsTableAdapter.Connection
                End If
                If ((Not (Me._accountsTableAdapter) Is Nothing)  _
                            AndAlso (Not (Me._accountsTableAdapter.Connection) Is Nothing)) Then
                    Return Me._accountsTableAdapter.Connection
                End If
                Return Nothing
            End Get
            Set
                Me._connection = value
            End Set
        End Property
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         Global.System.ComponentModel.Browsable(false)>  _
        Public ReadOnly Property TableAdapterInstanceCount() As Integer
            Get
                Dim count As Integer = 0
                If (Not (Me._coursesTableAdapter) Is Nothing) Then
                    count = (count + 1)
                End If
                If (Not (Me._cuisineTypesTableAdapter) Is Nothing) Then
                    count = (count + 1)
                End If
                If (Not (Me._foodTypesTableAdapter) Is Nothing) Then
                    count = (count + 1)
                End If
                If (Not (Me._ingredientsTableAdapter) Is Nothing) Then
                    count = (count + 1)
                End If
                If (Not (Me._nutritionDetailsTableAdapter) Is Nothing) Then
                    count = (count + 1)
                End If
                If (Not (Me._recipeIngredientTableAdapter) Is Nothing) Then
                    count = (count + 1)
                End If
                If (Not (Me._recipesTableAdapter) Is Nothing) Then
                    count = (count + 1)
                End If
                If (Not (Me._unitMeasurementsTableAdapter) Is Nothing) Then
                    count = (count + 1)
                End If
                If (Not (Me._accountsTableAdapter) Is Nothing) Then
                    count = (count + 1)
                End If
                Return count
            End Get
        End Property
        
        '''<summary>
        '''Update rows in top-down order.
        '''</summary>
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Function UpdateUpdatedRows(ByVal dataSet As EntitiesLayer.RecipeHolderDatabaseDataSet, 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._accountsTableAdapter) Is Nothing) Then
                Dim updatedRows() As Global.System.Data.DataRow = dataSet.Accounts.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._accountsTableAdapter.Update(updatedRows))
                    allChangedRows.AddRange(updatedRows)
                End If
            End If
            If (Not (Me._foodTypesTableAdapter) Is Nothing) Then
                Dim updatedRows() As Global.System.Data.DataRow = dataSet.FoodTypes.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._foodTypesTableAdapter.Update(updatedRows))
                    allChangedRows.AddRange(updatedRows)
                End If
            End If
            If (Not (Me._cuisineTypesTableAdapter) Is Nothing) Then
                Dim updatedRows() As Global.System.Data.DataRow = dataSet.CuisineTypes.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._cuisineTypesTableAdapter.Update(updatedRows))
                    allChangedRows.AddRange(updatedRows)
                End If
            End If
            If (Not (Me._coursesTableAdapter) Is Nothing) Then
                Dim updatedRows() As Global.System.Data.DataRow = dataSet.Courses.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._coursesTableAdapter.Update(updatedRows))
                    allChangedRows.AddRange(updatedRows)
                End If
            End If
            If (Not (Me._unitMeasurementsTableAdapter) Is Nothing) Then
                Dim updatedRows() As Global.System.Data.DataRow = dataSet.UnitMeasurements.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._unitMeasurementsTableAdapter.Update(updatedRows))
                    allChangedRows.AddRange(updatedRows)
                End If
            End If
            If (Not (Me._ingredientsTableAdapter) Is Nothing) Then
                Dim updatedRows() As Global.System.Data.DataRow = dataSet.Ingredients.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._ingredientsTableAdapter.Update(updatedRows))
                    allChangedRows.AddRange(updatedRows)
                End If
            End If
            If (Not (Me._recipesTableAdapter) Is Nothing) Then
                Dim updatedRows() As Global.System.Data.DataRow = dataSet.Recipes.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._recipesTableAdapter.Update(updatedRows))
                    allChangedRows.AddRange(updatedRows)
                End If
            End If
            If (Not (Me._nutritionDetailsTableAdapter) Is Nothing) Then
                Dim updatedRows() As Global.System.Data.DataRow = dataSet.NutritionDetails.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._nutritionDetailsTableAdapter.Update(updatedRows))
                    allChangedRows.AddRange(updatedRows)
                End If
            End If
            If (Not (Me._recipeIngredientTableAdapter) Is Nothing) Then
                Dim updatedRows() As Global.System.Data.DataRow = dataSet.RecipeIngredient.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._recipeIngredientTableAdapter.Update(updatedRows))
                    allChangedRows.AddRange(updatedRows)
                End If
            End If
            Return result
        End Function
        
        '''<summary>
        '''Insert rows in top-down order.
        '''</summary>
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Function UpdateInsertedRows(ByVal dataSet As EntitiesLayer.RecipeHolderDatabaseDataSet, ByVal allAddedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)) As Integer
            Dim result As Integer = 0
            If (Not (Me._accountsTableAdapter) Is Nothing) Then
                Dim addedRows() As Global.System.Data.DataRow = dataSet.Accounts.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added)
                If ((Not (addedRows) Is Nothing)  _
                            AndAlso (0 < addedRows.Length)) Then
                    result = (result + Me._accountsTableAdapter.Update(addedRows))
                    allAddedRows.AddRange(addedRows)
                End If
            End If
            If (Not (Me._foodTypesTableAdapter) Is Nothing) Then
                Dim addedRows() As Global.System.Data.DataRow = dataSet.FoodTypes.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added)
                If ((Not (addedRows) Is Nothing)  _
                            AndAlso (0 < addedRows.Length)) Then
                    result = (result + Me._foodTypesTableAdapter.Update(addedRows))
                    allAddedRows.AddRange(addedRows)
                End If
            End If
            If (Not (Me._cuisineTypesTableAdapter) Is Nothing) Then
                Dim addedRows() As Global.System.Data.DataRow = dataSet.CuisineTypes.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added)
                If ((Not (addedRows) Is Nothing)  _
                            AndAlso (0 < addedRows.Length)) Then
                    result = (result + Me._cuisineTypesTableAdapter.Update(addedRows))
                    allAddedRows.AddRange(addedRows)
                End If
            End If
            If (Not (Me._coursesTableAdapter) Is Nothing) Then
                Dim addedRows() As Global.System.Data.DataRow = dataSet.Courses.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added)
                If ((Not (addedRows) Is Nothing)  _
                            AndAlso (0 < addedRows.Length)) Then
                    result = (result + Me._coursesTableAdapter.Update(addedRows))
                    allAddedRows.AddRange(addedRows)
                End If
            End If
            If (Not (Me._unitMeasurementsTableAdapter) Is Nothing) Then
                Dim addedRows() As Global.System.Data.DataRow = dataSet.UnitMeasurements.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added)
                If ((Not (addedRows) Is Nothing)  _
                            AndAlso (0 < addedRows.Length)) Then
                    result = (result + Me._unitMeasurementsTableAdapter.Update(addedRows))
                    allAddedRows.AddRange(addedRows)
                End If
            End If
            If (Not (Me._ingredientsTableAdapter) Is Nothing) Then
                Dim addedRows() As Global.System.Data.DataRow = dataSet.Ingredients.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added)
                If ((Not (addedRows) Is Nothing)  _
                            AndAlso (0 < addedRows.Length)) Then
                    result = (result + Me._ingredientsTableAdapter.Update(addedRows))
                    allAddedRows.AddRange(addedRows)
                End If
            End If
            If (Not (Me._recipesTableAdapter) Is Nothing) Then
                Dim addedRows() As Global.System.Data.DataRow = dataSet.Recipes.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added)
                If ((Not (addedRows) Is Nothing)  _
                            AndAlso (0 < addedRows.Length)) Then
                    result = (result + Me._recipesTableAdapter.Update(addedRows))
                    allAddedRows.AddRange(addedRows)
                End If
            End If
            If (Not (Me._nutritionDetailsTableAdapter) Is Nothing) Then
                Dim addedRows() As Global.System.Data.DataRow = dataSet.NutritionDetails.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added)
                If ((Not (addedRows) Is Nothing)  _
                            AndAlso (0 < addedRows.Length)) Then
                    result = (result + Me._nutritionDetailsTableAdapter.Update(addedRows))
                    allAddedRows.AddRange(addedRows)
                End If
            End If
            If (Not (Me._recipeIngredientTableAdapter) Is Nothing) Then
                Dim addedRows() As Global.System.Data.DataRow = dataSet.RecipeIngredient.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Added)
                If ((Not (addedRows) Is Nothing)  _
                            AndAlso (0 < addedRows.Length)) Then
                    result = (result + Me._recipeIngredientTableAdapter.Update(addedRows))
                    allAddedRows.AddRange(addedRows)
                End If
            End If
            Return result
        End Function
        
        '''<summary>
        '''Delete rows in bottom-up order.
        '''</summary>
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Function UpdateDeletedRows(ByVal dataSet As EntitiesLayer.RecipeHolderDatabaseDataSet, ByVal allChangedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)) As Integer
            Dim result As Integer = 0
            If (Not (Me._recipeIngredientTableAdapter) Is Nothing) Then
                Dim deletedRows() As Global.System.Data.DataRow = dataSet.RecipeIngredient.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted)
                If ((Not (deletedRows) Is Nothing)  _
                            AndAlso (0 < deletedRows.Length)) Then
                    result = (result + Me._recipeIngredientTableAdapter.Update(deletedRows))
                    allChangedRows.AddRange(deletedRows)
                End If
            End If
            If (Not (Me._nutritionDetailsTableAdapter) Is Nothing) Then
                Dim deletedRows() As Global.System.Data.DataRow = dataSet.NutritionDetails.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted)
                If ((Not (deletedRows) Is Nothing)  _
                            AndAlso (0 < deletedRows.Length)) Then
                    result = (result + Me._nutritionDetailsTableAdapter.Update(deletedRows))
                    allChangedRows.AddRange(deletedRows)
                End If
            End If
            If (Not (Me._recipesTableAdapter) Is Nothing) Then
                Dim deletedRows() As Global.System.Data.DataRow = dataSet.Recipes.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted)
                If ((Not (deletedRows) Is Nothing)  _
                            AndAlso (0 < deletedRows.Length)) Then
                    result = (result + Me._recipesTableAdapter.Update(deletedRows))
                    allChangedRows.AddRange(deletedRows)
                End If
            End If
            If (Not (Me._ingredientsTableAdapter) Is Nothing) Then
                Dim deletedRows() As Global.System.Data.DataRow = dataSet.Ingredients.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted)
                If ((Not (deletedRows) Is Nothing)  _
                            AndAlso (0 < deletedRows.Length)) Then
                    result = (result + Me._ingredientsTableAdapter.Update(deletedRows))
                    allChangedRows.AddRange(deletedRows)
                End If
            End If
            If (Not (Me._unitMeasurementsTableAdapter) Is Nothing) Then
                Dim deletedRows() As Global.System.Data.DataRow = dataSet.UnitMeasurements.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted)
                If ((Not (deletedRows) Is Nothing)  _
                            AndAlso (0 < deletedRows.Length)) Then
                    result = (result + Me._unitMeasurementsTableAdapter.Update(deletedRows))
                    allChangedRows.AddRange(deletedRows)
                End If
            End If
            If (Not (Me._coursesTableAdapter) Is Nothing) Then
                Dim deletedRows() As Global.System.Data.DataRow = dataSet.Courses.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted)
                If ((Not (deletedRows) Is Nothing)  _
                            AndAlso (0 < deletedRows.Length)) Then
                    result = (result + Me._coursesTableAdapter.Update(deletedRows))
                    allChangedRows.AddRange(deletedRows)
                End If
            End If
            If (Not (Me._cuisineTypesTableAdapter) Is Nothing) Then
                Dim deletedRows() As Global.System.Data.DataRow = dataSet.CuisineTypes.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted)
                If ((Not (deletedRows) Is Nothing)  _
                            AndAlso (0 < deletedRows.Length)) Then
                    result = (result + Me._cuisineTypesTableAdapter.Update(deletedRows))
                    allChangedRows.AddRange(deletedRows)
                End If
            End If
            If (Not (Me._foodTypesTableAdapter) Is Nothing) Then
                Dim deletedRows() As Global.System.Data.DataRow = dataSet.FoodTypes.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted)
                If ((Not (deletedRows) Is Nothing)  _
                            AndAlso (0 < deletedRows.Length)) Then
                    result = (result + Me._foodTypesTableAdapter.Update(deletedRows))
                    allChangedRows.AddRange(deletedRows)
                End If
            End If
            If (Not (Me._accountsTableAdapter) Is Nothing) Then
                Dim deletedRows() As Global.System.Data.DataRow = dataSet.Accounts.Select(Nothing, Nothing, Global.System.Data.DataViewRowState.Deleted)
                If ((Not (deletedRows) Is Nothing)  _
                            AndAlso (0 < deletedRows.Length)) Then
                    result = (result + Me._accountsTableAdapter.Update(deletedRows))
                    allChangedRows.AddRange(deletedRows)
                End If
            End If
            Return result
        End Function
        
        '''<summary>
        '''Remove inserted rows that become updated rows after calling TableAdapter.Update(inserted rows) first
        '''</summary>
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        '''<summary>
        '''Update all changes to the dataset.
        '''</summary>
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Overridable Function UpdateAll(ByVal dataSet As EntitiesLayer.RecipeHolderDatabaseDataSet) 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._coursesTableAdapter) Is Nothing)  _
                        AndAlso (Me.MatchTableAdapterConnection(Me._coursesTableAdapter.Connection) = false)) Then
                Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s"& _ 
                        "tring.")
            End If
            If ((Not (Me._cuisineTypesTableAdapter) Is Nothing)  _
                        AndAlso (Me.MatchTableAdapterConnection(Me._cuisineTypesTableAdapter.Connection) = false)) Then
                Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s"& _ 
                        "tring.")
            End If
            If ((Not (Me._foodTypesTableAdapter) Is Nothing)  _
                        AndAlso (Me.MatchTableAdapterConnection(Me._foodTypesTableAdapter.Connection) = false)) Then
                Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s"& _ 
                        "tring.")
            End If
            If ((Not (Me._ingredientsTableAdapter) Is Nothing)  _
                        AndAlso (Me.MatchTableAdapterConnection(Me._ingredientsTableAdapter.Connection) = false)) Then
                Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s"& _ 
                        "tring.")
            End If
            If ((Not (Me._nutritionDetailsTableAdapter) Is Nothing)  _
                        AndAlso (Me.MatchTableAdapterConnection(Me._nutritionDetailsTableAdapter.Connection) = false)) Then
                Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s"& _ 
                        "tring.")
            End If
            If ((Not (Me._recipeIngredientTableAdapter) Is Nothing)  _
                        AndAlso (Me.MatchTableAdapterConnection(Me._recipeIngredientTableAdapter.Connection) = false)) Then
                Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s"& _ 
                        "tring.")
            End If
            If ((Not (Me._recipesTableAdapter) Is Nothing)  _
                        AndAlso (Me.MatchTableAdapterConnection(Me._recipesTableAdapter.Connection) = false)) Then
                Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s"& _ 
                        "tring.")
            End If
            If ((Not (Me._unitMeasurementsTableAdapter) Is Nothing)  _
                        AndAlso (Me.MatchTableAdapterConnection(Me._unitMeasurementsTableAdapter.Connection) = false)) Then
                Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s"& _ 
                        "tring.")
            End If
            If ((Not (Me._accountsTableAdapter) Is Nothing)  _
                        AndAlso (Me.MatchTableAdapterConnection(Me._accountsTableAdapter.Connection) = false)) Then
                Throw New Global.System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s"& _ 
                        "tring.")
            End If
            Dim workConnection As Global.System.Data.IDbConnection = Me.Connection
            If (workConnection Is Nothing) Then
                Throw New Global.System.ApplicationException("TableAdapterManager contains no connection information. Set each TableAdapterMana"& _ 
                        "ger TableAdapter property to a valid TableAdapter instance.")
            End If
            Dim workConnOpened As Boolean = false
            If ((workConnection.State And Global.System.Data.ConnectionState.Broken)  _
                        = Global.System.Data.ConnectionState.Broken) Then
                workConnection.Close
            End If
            If (workConnection.State = Global.System.Data.ConnectionState.Closed) Then
                workConnection.Open
                workConnOpened = true
            End If
            Dim workTransaction As Global.System.Data.IDbTransaction = workConnection.BeginTransaction
            If (workTransaction Is Nothing) Then
                Throw New Global.System.ApplicationException("The transaction cannot begin. The current data connection does not support transa"& _ 
                        "ctions or the current state is not allowing the transaction to begin.")
            End If
            Dim allChangedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow) = New Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)
            Dim allAddedRows As Global.System.Collections.Generic.List(Of Global.System.Data.DataRow) = New Global.System.Collections.Generic.List(Of Global.System.Data.DataRow)
            Dim adaptersWithAcceptChangesDuringUpdate As Global.System.Collections.Generic.List(Of Global.System.Data.Common.DataAdapter) = New Global.System.Collections.Generic.List(Of Global.System.Data.Common.DataAdapter)
            Dim revertConnections As Global.System.Collections.Generic.Dictionary(Of Object, Global.System.Data.IDbConnection) = New Global.System.Collections.Generic.Dictionary(Of Object, Global.System.Data.IDbConnection)
            Dim result As Integer = 0
            Dim backupDataSet As Global.System.Data.DataSet = Nothing
            If Me.BackupDataSetBeforeUpdate Then
                backupDataSet = New Global.System.Data.DataSet
                backupDataSet.Merge(dataSet)
            End If
            Try 
                '---- Prepare for update -----------
                '
                If (Not (Me._coursesTableAdapter) Is Nothing) Then
                    revertConnections.Add(Me._coursesTableAdapter, Me._coursesTableAdapter.Connection)
                    Me._coursesTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection)
                    Me._coursesTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction)
                    If Me._coursesTableAdapter.Adapter.AcceptChangesDuringUpdate Then
                        Me._coursesTableAdapter.Adapter.AcceptChangesDuringUpdate = false
                        adaptersWithAcceptChangesDuringUpdate.Add(Me._coursesTableAdapter.Adapter)
                    End If
                End If
                If (Not (Me._cuisineTypesTableAdapter) Is Nothing) Then
                    revertConnections.Add(Me._cuisineTypesTableAdapter, Me._cuisineTypesTableAdapter.Connection)
                    Me._cuisineTypesTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection)
                    Me._cuisineTypesTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction)
                    If Me._cuisineTypesTableAdapter.Adapter.AcceptChangesDuringUpdate Then
                        Me._cuisineTypesTableAdapter.Adapter.AcceptChangesDuringUpdate = false
                        adaptersWithAcceptChangesDuringUpdate.Add(Me._cuisineTypesTableAdapter.Adapter)
                    End If
                End If
                If (Not (Me._foodTypesTableAdapter) Is Nothing) Then
                    revertConnections.Add(Me._foodTypesTableAdapter, Me._foodTypesTableAdapter.Connection)
                    Me._foodTypesTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection)
                    Me._foodTypesTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction)
                    If Me._foodTypesTableAdapter.Adapter.AcceptChangesDuringUpdate Then
                        Me._foodTypesTableAdapter.Adapter.AcceptChangesDuringUpdate = false
                        adaptersWithAcceptChangesDuringUpdate.Add(Me._foodTypesTableAdapter.Adapter)
                    End If
                End If
                If (Not (Me._ingredientsTableAdapter) Is Nothing) Then
                    revertConnections.Add(Me._ingredientsTableAdapter, Me._ingredientsTableAdapter.Connection)
                    Me._ingredientsTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection)
                    Me._ingredientsTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction)
                    If Me._ingredientsTableAdapter.Adapter.AcceptChangesDuringUpdate Then
                        Me._ingredientsTableAdapter.Adapter.AcceptChangesDuringUpdate = false
                        adaptersWithAcceptChangesDuringUpdate.Add(Me._ingredientsTableAdapter.Adapter)
                    End If
                End If
                If (Not (Me._nutritionDetailsTableAdapter) Is Nothing) Then
                    revertConnections.Add(Me._nutritionDetailsTableAdapter, Me._nutritionDetailsTableAdapter.Connection)
                    Me._nutritionDetailsTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection)
                    Me._nutritionDetailsTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction)
                    If Me._nutritionDetailsTableAdapter.Adapter.AcceptChangesDuringUpdate Then
                        Me._nutritionDetailsTableAdapter.Adapter.AcceptChangesDuringUpdate = false
                        adaptersWithAcceptChangesDuringUpdate.Add(Me._nutritionDetailsTableAdapter.Adapter)
                    End If
                End If
                If (Not (Me._recipeIngredientTableAdapter) Is Nothing) Then
                    revertConnections.Add(Me._recipeIngredientTableAdapter, Me._recipeIngredientTableAdapter.Connection)
                    Me._recipeIngredientTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection)
                    Me._recipeIngredientTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction)
                    If Me._recipeIngredientTableAdapter.Adapter.AcceptChangesDuringUpdate Then
                        Me._recipeIngredientTableAdapter.Adapter.AcceptChangesDuringUpdate = false
                        adaptersWithAcceptChangesDuringUpdate.Add(Me._recipeIngredientTableAdapter.Adapter)
                    End If
                End If
                If (Not (Me._recipesTableAdapter) Is Nothing) Then
                    revertConnections.Add(Me._recipesTableAdapter, Me._recipesTableAdapter.Connection)
                    Me._recipesTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection)
                    Me._recipesTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction)
                    If Me._recipesTableAdapter.Adapter.AcceptChangesDuringUpdate Then
                        Me._recipesTableAdapter.Adapter.AcceptChangesDuringUpdate = false
                        adaptersWithAcceptChangesDuringUpdate.Add(Me._recipesTableAdapter.Adapter)
                    End If
                End If
                If (Not (Me._unitMeasurementsTableAdapter) Is Nothing) Then
                    revertConnections.Add(Me._unitMeasurementsTableAdapter, Me._unitMeasurementsTableAdapter.Connection)
                    Me._unitMeasurementsTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection)
                    Me._unitMeasurementsTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction)
                    If Me._unitMeasurementsTableAdapter.Adapter.AcceptChangesDuringUpdate Then
                        Me._unitMeasurementsTableAdapter.Adapter.AcceptChangesDuringUpdate = false
                        adaptersWithAcceptChangesDuringUpdate.Add(Me._unitMeasurementsTableAdapter.Adapter)
                    End If
                End If
                If (Not (Me._accountsTableAdapter) Is Nothing) Then
                    revertConnections.Add(Me._accountsTableAdapter, Me._accountsTableAdapter.Connection)
                    Me._accountsTableAdapter.Connection = CType(workConnection,Global.System.Data.SqlClient.SqlConnection)
                    Me._accountsTableAdapter.Transaction = CType(workTransaction,Global.System.Data.SqlClient.SqlTransaction)
                    If Me._accountsTableAdapter.Adapter.AcceptChangesDuringUpdate Then
                        Me._accountsTableAdapter.Adapter.AcceptChangesDuringUpdate = false
                        adaptersWithAcceptChangesDuringUpdate.Add(Me._accountsTableAdapter.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._coursesTableAdapter) Is Nothing) Then
                    Me._coursesTableAdapter.Connection = CType(revertConnections(Me._coursesTableAdapter),Global.System.Data.SqlClient.SqlConnection)
                    Me._coursesTableAdapter.Transaction = Nothing
                End If
                If (Not (Me._cuisineTypesTableAdapter) Is Nothing) Then
                    Me._cuisineTypesTableAdapter.Connection = CType(revertConnections(Me._cuisineTypesTableAdapter),Global.System.Data.SqlClient.SqlConnection)
                    Me._cuisineTypesTableAdapter.Transaction = Nothing
                End If
                If (Not (Me._foodTypesTableAdapter) Is Nothing) Then
                    Me._foodTypesTableAdapter.Connection = CType(revertConnections(Me._foodTypesTableAdapter),Global.System.Data.SqlClient.SqlConnection)
                    Me._foodTypesTableAdapter.Transaction = Nothing
                End If
                If (Not (Me._ingredientsTableAdapter) Is Nothing) Then
                    Me._ingredientsTableAdapter.Connection = CType(revertConnections(Me._ingredientsTableAdapter),Global.System.Data.SqlClient.SqlConnection)
                    Me._ingredientsTableAdapter.Transaction = Nothing
                End If
                If (Not (Me._nutritionDetailsTableAdapter) Is Nothing) Then
                    Me._nutritionDetailsTableAdapter.Connection = CType(revertConnections(Me._nutritionDetailsTableAdapter),Global.System.Data.SqlClient.SqlConnection)
                    Me._nutritionDetailsTableAdapter.Transaction = Nothing
                End If
                If (Not (Me._recipeIngredientTableAdapter) Is Nothing) Then
                    Me._recipeIngredientTableAdapter.Connection = CType(revertConnections(Me._recipeIngredientTableAdapter),Global.System.Data.SqlClient.SqlConnection)
                    Me._recipeIngredientTableAdapter.Transaction = Nothing
                End If
                If (Not (Me._recipesTableAdapter) Is Nothing) Then
                    Me._recipesTableAdapter.Connection = CType(revertConnections(Me._recipesTableAdapter),Global.System.Data.SqlClient.SqlConnection)
                    Me._recipesTableAdapter.Transaction = Nothing
                End If
                If (Not (Me._unitMeasurementsTableAdapter) Is Nothing) Then
                    Me._unitMeasurementsTableAdapter.Connection = CType(revertConnections(Me._unitMeasurementsTableAdapter),Global.System.Data.SqlClient.SqlConnection)
                    Me._unitMeasurementsTableAdapter.Transaction = Nothing
                End If
                If (Not (Me._accountsTableAdapter) Is Nothing) Then
                    Me._accountsTableAdapter.Connection = CType(revertConnections(Me._accountsTableAdapter),Global.System.Data.SqlClient.SqlConnection)
                    Me._accountsTableAdapter.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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        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
        
        '''<summary>
        '''Update Order Option
        '''</summary>
        <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")>  _
        Public Enum UpdateOrderOption
            
            InsertUpdateDelete = 0
            
            UpdateInsertDelete = 1
        End Enum
        
        '''<summary>
        '''Used to sort self-referenced table's rows
        '''</summary>
        <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")>  _
        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
            
            <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
            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
            
            <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
            Private Function IsChildAndParent(ByVal child As Global.System.Data.DataRow, ByVal parent As Global.System.Data.DataRow) As Boolean
                Global.System.Diagnostics.Debug.Assert((Not (child) Is Nothing))
                Global.System.Diagnostics.Debug.Assert((Not (parent) Is Nothing))
                Dim newParent As Global.System.Data.DataRow = child.GetParentRow(Me._relation, Global.System.Data.DataRowVersion.[Default])

                Do While ((Not (newParent) Is Nothing)  _
                            AndAlso ((Object.ReferenceEquals(newParent, child) = false)  _
                            AndAlso (Object.ReferenceEquals(newParent, parent) = false)))
                    newParent = newParent.GetParentRow(Me._relation, Global.System.Data.DataRowVersion.[Default])

                Loop
                If (newParent Is Nothing) Then
                    newParent = child.GetParentRow(Me._relation, Global.System.Data.DataRowVersion.Original)
                    Do While ((Not (newParent) Is Nothing)  _
                                AndAlso ((Object.ReferenceEquals(newParent, child) = false)  _
                                AndAlso (Object.ReferenceEquals(newParent, parent) = false)))
                        newParent = newParent.GetParentRow(Me._relation, Global.System.Data.DataRowVersion.Original)

                    Loop
                End If
                If Object.ReferenceEquals(newParent, parent) Then
                    Return true
                End If
                Return false
            End Function
            
            <Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
            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

                'Is row1 the child or grandchild of row2
                If Me.IsChildAndParent(row1, row2) Then
                    Return Me._childFirst
                End If

                'Is row2 the child or grandchild of row1
                If Me.IsChildAndParent(row2, row1) Then
                    Return (-1 * Me._childFirst)
                End If
                Return 0
            End Function
        End Class
    End Class
End Namespace
