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

namespace WizardBasedDataAccess {
    using System;
    
    
    [Serializable()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.ComponentModel.ToolboxItem(true)]
    [System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedDataSetSchema")]
    [System.Xml.Serialization.XmlRootAttribute("CarsDataSet")]
    [System.ComponentModel.Design.HelpKeywordAttribute("vs.data.DataSet")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Usage", "CA2240:ImplementISerializableCorrectly")]
    public partial class CarsDataSet : System.Data.DataSet {
        
        private InventoryDataTable tableInventory;
        
        private System.Data.SchemaSerializationMode _schemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
        
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public CarsDataSet() {
            this.BeginInit();
            this.InitClass();
            System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            base.Tables.CollectionChanged += schemaChangedHandler;
            base.Relations.CollectionChanged += schemaChangedHandler;
            this.EndInit();
        }
        
        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        protected CarsDataSet(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
                base(info, context) {
            if ((this.IsBinarySerialized(info, context) == true)) {
                this.InitVars(false);
                System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
                this.Tables.CollectionChanged += schemaChangedHandler1;
                this.Relations.CollectionChanged += schemaChangedHandler1;
                return;
            }
            string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
            if ((this.DetermineSchemaSerializationMode(info, context) == System.Data.SchemaSerializationMode.IncludeSchema)) {
                System.Data.DataSet ds = new System.Data.DataSet();
                ds.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
                if ((ds.Tables["Inventory"] != null)) {
                    base.Tables.Add(new InventoryDataTable(ds.Tables["Inventory"]));
                }
                this.DataSetName = ds.DataSetName;
                this.Prefix = ds.Prefix;
                this.Namespace = ds.Namespace;
                this.Locale = ds.Locale;
                this.CaseSensitive = ds.CaseSensitive;
                this.EnforceConstraints = ds.EnforceConstraints;
                this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
                this.InitVars();
            }
            else {
                this.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
            }
            this.GetSerializationData(info, context);
            System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            base.Tables.CollectionChanged += schemaChangedHandler;
            this.Relations.CollectionChanged += schemaChangedHandler;
        }
        
        [System.ComponentModel.Browsable(false)]
        [System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)]
        public InventoryDataTable Inventory {
            get {
                return this.tableInventory;
            }
        }
        
        public override System.Data.SchemaSerializationMode SchemaSerializationMode {
            get {
                return this._schemaSerializationMode;
            }
            set {
                this._schemaSerializationMode = value;
            }
        }
        
        [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public new System.Data.DataTableCollection Tables {
            get {
                return base.Tables;
            }
        }
        
        [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public new System.Data.DataRelationCollection Relations {
            get {
                return base.Relations;
            }
        }
        
        [System.ComponentModel.DefaultValueAttribute(true)]
        public new bool EnforceConstraints {
            get {
                return base.EnforceConstraints;
            }
            set {
                base.EnforceConstraints = value;
            }
        }
        
        protected override void InitializeDerivedDataSet() {
            this.BeginInit();
            this.InitClass();
            this.EndInit();
        }
        
        public override System.Data.DataSet Clone() {
            CarsDataSet cln = ((CarsDataSet)(base.Clone()));
            cln.InitVars();
            return cln;
        }
        
        protected override bool ShouldSerializeTables() {
            return false;
        }
        
        protected override bool ShouldSerializeRelations() {
            return false;
        }
        
        protected override void ReadXmlSerializable(System.Xml.XmlReader reader) {
            if ((this.DetermineSchemaSerializationMode(reader) == System.Data.SchemaSerializationMode.IncludeSchema)) {
                this.Reset();
                System.Data.DataSet ds = new System.Data.DataSet();
                ds.ReadXml(reader);
                if ((ds.Tables["Inventory"] != null)) {
                    base.Tables.Add(new InventoryDataTable(ds.Tables["Inventory"]));
                }
                this.DataSetName = ds.DataSetName;
                this.Prefix = ds.Prefix;
                this.Namespace = ds.Namespace;
                this.Locale = ds.Locale;
                this.CaseSensitive = ds.CaseSensitive;
                this.EnforceConstraints = ds.EnforceConstraints;
                this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
                this.InitVars();
            }
            else {
                this.ReadXml(reader);
                this.InitVars();
            }
        }
        
        protected override System.Xml.Schema.XmlSchema GetSchemaSerializable() {
            System.IO.MemoryStream stream = new System.IO.MemoryStream();
            this.WriteXmlSchema(new System.Xml.XmlTextWriter(stream, null));
            stream.Position = 0;
            return System.Xml.Schema.XmlSchema.Read(new System.Xml.XmlTextReader(stream), null);
        }
        
        internal void InitVars() {
            this.InitVars(true);
        }
        
        internal void InitVars(bool initTable) {
            this.tableInventory = ((InventoryDataTable)(base.Tables["Inventory"]));
            if ((initTable == true)) {
                if ((this.tableInventory != null)) {
                    this.tableInventory.InitVars();
                }
            }
        }
        
        private void InitClass() {
            this.DataSetName = "CarsDataSet";
            this.Prefix = "";
            this.Namespace = "http://tempuri.org/CarsDataSet.xsd";
            this.EnforceConstraints = true;
            this.tableInventory = new InventoryDataTable();
            base.Tables.Add(this.tableInventory);
        }
        
        private bool ShouldSerializeInventory() {
            return false;
        }
        
        private void SchemaChanged(object sender, System.ComponentModel.CollectionChangeEventArgs e) {
            if ((e.Action == System.ComponentModel.CollectionChangeAction.Remove)) {
                this.InitVars();
            }
        }
        
        public static System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(System.Xml.Schema.XmlSchemaSet xs) {
            CarsDataSet ds = new CarsDataSet();
            System.Xml.Schema.XmlSchemaComplexType type = new System.Xml.Schema.XmlSchemaComplexType();
            System.Xml.Schema.XmlSchemaSequence sequence = new System.Xml.Schema.XmlSchemaSequence();
            xs.Add(ds.GetSchemaSerializable());
            System.Xml.Schema.XmlSchemaAny any = new System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            return type;
        }
        
        public delegate void InventoryRowChangeEventHandler(object sender, InventoryRowChangeEvent e);
        
        [System.Serializable()]
        [System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")]
        public partial class InventoryDataTable : System.Data.DataTable, System.Collections.IEnumerable {
            
            private System.Data.DataColumn columnCarID;
            
            private System.Data.DataColumn columnMake;
            
            private System.Data.DataColumn columnColor;
            
            private System.Data.DataColumn columnPetName;
            
            public InventoryDataTable() {
                this.TableName = "Inventory";
                this.BeginInit();
                this.InitClass();
                this.EndInit();
            }
            
            internal InventoryDataTable(System.Data.DataTable table) {
                this.TableName = table.TableName;
                if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
                    this.CaseSensitive = table.CaseSensitive;
                }
                if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
                    this.Locale = table.Locale;
                }
                if ((table.Namespace != table.DataSet.Namespace)) {
                    this.Namespace = table.Namespace;
                }
                this.Prefix = table.Prefix;
                this.MinimumCapacity = table.MinimumCapacity;
            }
            
            protected InventoryDataTable(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
                    base(info, context) {
                this.InitVars();
            }
            
            public System.Data.DataColumn CarIDColumn {
                get {
                    return this.columnCarID;
                }
            }
            
            public System.Data.DataColumn MakeColumn {
                get {
                    return this.columnMake;
                }
            }
            
            public System.Data.DataColumn ColorColumn {
                get {
                    return this.columnColor;
                }
            }
            
            public System.Data.DataColumn PetNameColumn {
                get {
                    return this.columnPetName;
                }
            }
            
            [System.ComponentModel.Browsable(false)]
            public int Count {
                get {
                    return this.Rows.Count;
                }
            }
            
            public InventoryRow this[int index] {
                get {
                    return ((InventoryRow)(this.Rows[index]));
                }
            }
            
            public event InventoryRowChangeEventHandler InventoryRowChanged;
            
            public event InventoryRowChangeEventHandler InventoryRowChanging;
            
            public event InventoryRowChangeEventHandler InventoryRowDeleted;
            
            public event InventoryRowChangeEventHandler InventoryRowDeleting;
            
            public void AddInventoryRow(InventoryRow row) {
                this.Rows.Add(row);
            }
            
            public InventoryRow AddInventoryRow(int CarID, string Make, string Color, string PetName) {
                InventoryRow rowInventoryRow = ((InventoryRow)(this.NewRow()));
                rowInventoryRow.ItemArray = new object[] {
                        CarID,
                        Make,
                        Color,
                        PetName};
                this.Rows.Add(rowInventoryRow);
                return rowInventoryRow;
            }
            
            public InventoryRow FindByCarID(int CarID) {
                return ((InventoryRow)(this.Rows.Find(new object[] {
                            CarID})));
            }
            
            public virtual System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override System.Data.DataTable Clone() {
                InventoryDataTable cln = ((InventoryDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override System.Data.DataTable CreateInstance() {
                return new InventoryDataTable();
            }
            
            internal void InitVars() {
                this.columnCarID = base.Columns["CarID"];
                this.columnMake = base.Columns["Make"];
                this.columnColor = base.Columns["Color"];
                this.columnPetName = base.Columns["PetName"];
            }
            
            private void InitClass() {
                this.columnCarID = new System.Data.DataColumn("CarID", typeof(int), null, System.Data.MappingType.Element);
                base.Columns.Add(this.columnCarID);
                this.columnMake = new System.Data.DataColumn("Make", typeof(string), null, System.Data.MappingType.Element);
                base.Columns.Add(this.columnMake);
                this.columnColor = new System.Data.DataColumn("Color", typeof(string), null, System.Data.MappingType.Element);
                base.Columns.Add(this.columnColor);
                this.columnPetName = new System.Data.DataColumn("PetName", typeof(string), null, System.Data.MappingType.Element);
                base.Columns.Add(this.columnPetName);
                this.Constraints.Add(new System.Data.UniqueConstraint("Constraint1", new System.Data.DataColumn[] {
                                this.columnCarID}, true));
                this.columnCarID.AllowDBNull = false;
                this.columnCarID.Unique = true;
                this.columnMake.MaxLength = 20;
                this.columnColor.MaxLength = 20;
                this.columnPetName.MaxLength = 20;
            }
            
            public InventoryRow NewInventoryRow() {
                return ((InventoryRow)(this.NewRow()));
            }
            
            protected override System.Data.DataRow NewRowFromBuilder(System.Data.DataRowBuilder builder) {
                return new InventoryRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(InventoryRow);
            }
            
            protected override void OnRowChanged(System.Data.DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.InventoryRowChanged != null)) {
                    this.InventoryRowChanged(this, new InventoryRowChangeEvent(((InventoryRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(System.Data.DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.InventoryRowChanging != null)) {
                    this.InventoryRowChanging(this, new InventoryRowChangeEvent(((InventoryRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(System.Data.DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.InventoryRowDeleted != null)) {
                    this.InventoryRowDeleted(this, new InventoryRowChangeEvent(((InventoryRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(System.Data.DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.InventoryRowDeleting != null)) {
                    this.InventoryRowDeleting(this, new InventoryRowChangeEvent(((InventoryRow)(e.Row)), e.Action));
                }
            }
            
            public void RemoveInventoryRow(InventoryRow row) {
                this.Rows.Remove(row);
            }
            
            public static System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(System.Xml.Schema.XmlSchemaSet xs) {
                System.Xml.Schema.XmlSchemaComplexType type = new System.Xml.Schema.XmlSchemaComplexType();
                System.Xml.Schema.XmlSchemaSequence sequence = new System.Xml.Schema.XmlSchemaSequence();
                CarsDataSet ds = new CarsDataSet();
                xs.Add(ds.GetSchemaSerializable());
                System.Xml.Schema.XmlSchemaAny any1 = new System.Xml.Schema.XmlSchemaAny();
                any1.Namespace = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs = new decimal(0);
                any1.MaxOccurs = decimal.MaxValue;
                any1.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                System.Xml.Schema.XmlSchemaAny any2 = new System.Xml.Schema.XmlSchemaAny();
                any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs = new decimal(1);
                any2.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                System.Xml.Schema.XmlSchemaAttribute attribute1 = new System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                System.Xml.Schema.XmlSchemaAttribute attribute2 = new System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name = "tableTypeName";
                attribute2.FixedValue = "InventoryDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                return type;
            }
        }
        
        public partial class InventoryRow : System.Data.DataRow {
            
            private InventoryDataTable tableInventory;
            
            internal InventoryRow(System.Data.DataRowBuilder rb) : 
                    base(rb) {
                this.tableInventory = ((InventoryDataTable)(this.Table));
            }
            
            public int CarID {
                get {
                    return ((int)(this[this.tableInventory.CarIDColumn]));
                }
                set {
                    this[this.tableInventory.CarIDColumn] = value;
                }
            }
            
            public string Make {
                get {
                    try {
                        return ((string)(this[this.tableInventory.MakeColumn]));
                    }
                    catch (System.InvalidCastException e) {
                        throw new System.Data.StrongTypingException("The value for column \'Make\' in table \'Inventory\' is DBNull.", e);
                    }
                }
                set {
                    this[this.tableInventory.MakeColumn] = value;
                }
            }
            
            public string Color {
                get {
                    try {
                        return ((string)(this[this.tableInventory.ColorColumn]));
                    }
                    catch (System.InvalidCastException e) {
                        throw new System.Data.StrongTypingException("The value for column \'Color\' in table \'Inventory\' is DBNull.", e);
                    }
                }
                set {
                    this[this.tableInventory.ColorColumn] = value;
                }
            }
            
            public string PetName {
                get {
                    try {
                        return ((string)(this[this.tableInventory.PetNameColumn]));
                    }
                    catch (System.InvalidCastException e) {
                        throw new System.Data.StrongTypingException("The value for column \'PetName\' in table \'Inventory\' is DBNull.", e);
                    }
                }
                set {
                    this[this.tableInventory.PetNameColumn] = value;
                }
            }
            
            public bool IsMakeNull() {
                return this.IsNull(this.tableInventory.MakeColumn);
            }
            
            public void SetMakeNull() {
                this[this.tableInventory.MakeColumn] = System.Convert.DBNull;
            }
            
            public bool IsColorNull() {
                return this.IsNull(this.tableInventory.ColorColumn);
            }
            
            public void SetColorNull() {
                this[this.tableInventory.ColorColumn] = System.Convert.DBNull;
            }
            
            public bool IsPetNameNull() {
                return this.IsNull(this.tableInventory.PetNameColumn);
            }
            
            public void SetPetNameNull() {
                this[this.tableInventory.PetNameColumn] = System.Convert.DBNull;
            }
        }
        
        public class InventoryRowChangeEvent : System.EventArgs {
            
            private InventoryRow eventRow;
            
            private System.Data.DataRowAction eventAction;
            
            public InventoryRowChangeEvent(InventoryRow row, System.Data.DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public InventoryRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public System.Data.DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}
namespace WizardBasedDataAccess.CarsDataSetTableAdapters {
    
    
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.ComponentModel.ToolboxItem(true)]
    [System.ComponentModel.DataObjectAttribute(true)]
    [System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" +
        ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
    [System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
    public partial class InventoryTableAdapter : System.ComponentModel.Component {
        
        private System.Data.SqlClient.SqlDataAdapter m_adapter;
        
        private System.Data.SqlClient.SqlConnection m_connection;
        
        private System.Data.SqlClient.SqlCommand[] m_commandCollection;
        
        private bool m_clearBeforeFill;
        
        public InventoryTableAdapter() {
            this.m_clearBeforeFill = true;
        }
        
        private System.Data.SqlClient.SqlDataAdapter Adapter {
            get {
                if ((this.m_adapter == null)) {
                    this.InitAdapter();
                }
                return this.m_adapter;
            }
        }
        
        internal System.Data.SqlClient.SqlConnection Connection {
            get {
                if ((this.m_connection == null)) {
                    this.InitConnection();
                }
                return this.m_connection;
            }
            set {
                this.m_connection = value;
                if ((this.Adapter.InsertCommand != null)) {
                    this.Adapter.InsertCommand.Connection = value;
                }
                if ((this.Adapter.DeleteCommand != null)) {
                    this.Adapter.DeleteCommand.Connection = value;
                }
                if ((this.Adapter.UpdateCommand != null)) {
                    this.Adapter.UpdateCommand.Connection = value;
                }
                for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
                    if ((this.CommandCollection[i] != null)) {
                        ((System.Data.SqlClient.SqlCommand)(this.CommandCollection[i])).Connection = value;
                    }
                }
            }
        }
        
        protected System.Data.SqlClient.SqlCommand[] CommandCollection {
            get {
                if ((this.m_commandCollection == null)) {
                    this.InitCommandCollection();
                }
                return this.m_commandCollection;
            }
        }
        
        public bool ClearBeforeFill {
            get {
                return this.m_clearBeforeFill;
            }
            set {
                this.m_clearBeforeFill = value;
            }
        }
        
        private void InitAdapter() {
            this.m_adapter = new System.Data.SqlClient.SqlDataAdapter();
            System.Data.Common.DataTableMapping tableMapping = new System.Data.Common.DataTableMapping();
            tableMapping.SourceTable = "Table";
            tableMapping.DataSetTable = "Inventory";
            tableMapping.ColumnMappings.Add("CarID", "CarID");
            tableMapping.ColumnMappings.Add("Make", "Make");
            tableMapping.ColumnMappings.Add("Color", "Color");
            tableMapping.ColumnMappings.Add("PetName", "PetName");
            this.m_adapter.TableMappings.Add(tableMapping);
            this.m_adapter.DeleteCommand = new System.Data.SqlClient.SqlCommand();
            this.m_adapter.DeleteCommand.Connection = this.Connection;
            this.m_adapter.DeleteCommand.CommandText = @"DELETE FROM [dbo].[Inventory] WHERE (([CarID] = @Original_CarID) AND ((@IsNull_Make = 1 AND [Make] IS NULL) OR ([Make] = @Original_Make)) AND ((@IsNull_Color = 1 AND [Color] IS NULL) OR ([Color] = @Original_Color)) AND ((@IsNull_PetName = 1 AND [PetName] IS NULL) OR ([PetName] = @Original_PetName)))";
            this.m_adapter.DeleteCommand.CommandType = System.Data.CommandType.Text;
            this.m_adapter.DeleteCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_CarID", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, 0, 0, "CarID", System.Data.DataRowVersion.Original, false, null, "", "", ""));
            this.m_adapter.DeleteCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@IsNull_Make", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, 0, 0, "Make", System.Data.DataRowVersion.Original, true, null, "", "", ""));
            this.m_adapter.DeleteCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Make", System.Data.SqlDbType.Char, 0, System.Data.ParameterDirection.Input, 0, 0, "Make", System.Data.DataRowVersion.Original, false, null, "", "", ""));
            this.m_adapter.DeleteCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@IsNull_Color", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, 0, 0, "Color", System.Data.DataRowVersion.Original, true, null, "", "", ""));
            this.m_adapter.DeleteCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Color", System.Data.SqlDbType.Char, 0, System.Data.ParameterDirection.Input, 0, 0, "Color", System.Data.DataRowVersion.Original, false, null, "", "", ""));
            this.m_adapter.DeleteCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@IsNull_PetName", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, 0, 0, "PetName", System.Data.DataRowVersion.Original, true, null, "", "", ""));
            this.m_adapter.DeleteCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_PetName", System.Data.SqlDbType.Char, 0, System.Data.ParameterDirection.Input, 0, 0, "PetName", System.Data.DataRowVersion.Original, false, null, "", "", ""));
            this.m_adapter.InsertCommand = new System.Data.SqlClient.SqlCommand();
            this.m_adapter.InsertCommand.Connection = this.Connection;
            this.m_adapter.InsertCommand.CommandText = "INSERT INTO [dbo].[Inventory] ([CarID], [Make], [Color], [PetName]) VALUES (@CarI" +
                "D, @Make, @Color, @PetName);\r\nSELECT CarID, Make, Color, PetName FROM Inventory " +
                "WHERE (CarID = @CarID)";
            this.m_adapter.InsertCommand.CommandType = System.Data.CommandType.Text;
            this.m_adapter.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@CarID", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, 0, 0, "CarID", System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this.m_adapter.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Make", System.Data.SqlDbType.Char, 0, System.Data.ParameterDirection.Input, 0, 0, "Make", System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this.m_adapter.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Color", System.Data.SqlDbType.Char, 0, System.Data.ParameterDirection.Input, 0, 0, "Color", System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this.m_adapter.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@PetName", System.Data.SqlDbType.Char, 0, System.Data.ParameterDirection.Input, 0, 0, "PetName", System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this.m_adapter.UpdateCommand = new System.Data.SqlClient.SqlCommand();
            this.m_adapter.UpdateCommand.Connection = this.Connection;
            this.m_adapter.UpdateCommand.CommandText = @"UPDATE [dbo].[Inventory] SET [CarID] = @CarID, [Make] = @Make, [Color] = @Color, [PetName] = @PetName WHERE (([CarID] = @Original_CarID) AND ((@IsNull_Make = 1 AND [Make] IS NULL) OR ([Make] = @Original_Make)) AND ((@IsNull_Color = 1 AND [Color] IS NULL) OR ([Color] = @Original_Color)) AND ((@IsNull_PetName = 1 AND [PetName] IS NULL) OR ([PetName] = @Original_PetName)));
SELECT CarID, Make, Color, PetName FROM Inventory WHERE (CarID = @CarID)";
            this.m_adapter.UpdateCommand.CommandType = System.Data.CommandType.Text;
            this.m_adapter.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@CarID", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, 0, 0, "CarID", System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this.m_adapter.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Make", System.Data.SqlDbType.Char, 0, System.Data.ParameterDirection.Input, 0, 0, "Make", System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this.m_adapter.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Color", System.Data.SqlDbType.Char, 0, System.Data.ParameterDirection.Input, 0, 0, "Color", System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this.m_adapter.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@PetName", System.Data.SqlDbType.Char, 0, System.Data.ParameterDirection.Input, 0, 0, "PetName", System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this.m_adapter.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_CarID", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, 0, 0, "CarID", System.Data.DataRowVersion.Original, false, null, "", "", ""));
            this.m_adapter.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@IsNull_Make", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, 0, 0, "Make", System.Data.DataRowVersion.Original, true, null, "", "", ""));
            this.m_adapter.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Make", System.Data.SqlDbType.Char, 0, System.Data.ParameterDirection.Input, 0, 0, "Make", System.Data.DataRowVersion.Original, false, null, "", "", ""));
            this.m_adapter.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@IsNull_Color", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, 0, 0, "Color", System.Data.DataRowVersion.Original, true, null, "", "", ""));
            this.m_adapter.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Color", System.Data.SqlDbType.Char, 0, System.Data.ParameterDirection.Input, 0, 0, "Color", System.Data.DataRowVersion.Original, false, null, "", "", ""));
            this.m_adapter.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@IsNull_PetName", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, 0, 0, "PetName", System.Data.DataRowVersion.Original, true, null, "", "", ""));
            this.m_adapter.UpdateCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_PetName", System.Data.SqlDbType.Char, 0, System.Data.ParameterDirection.Input, 0, 0, "PetName", System.Data.DataRowVersion.Original, false, null, "", "", ""));
        }
        
        private void InitConnection() {
            this.m_connection = new System.Data.SqlClient.SqlConnection();
            this.m_connection.ConnectionString = WizardBasedDataAccess.Properties.Settings.Default.CarsConnectionString;
        }
        
        private void InitCommandCollection() {
            this.m_commandCollection = new System.Data.SqlClient.SqlCommand[1];
            this.m_commandCollection[0] = new System.Data.SqlClient.SqlCommand();
            this.m_commandCollection[0].Connection = this.Connection;
            this.m_commandCollection[0].CommandText = "SELECT CarID, Make, Color, PetName FROM dbo.Inventory";
            this.m_commandCollection[0].CommandType = System.Data.CommandType.Text;
        }
        
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Fill, true)]
        public virtual int Fill(CarsDataSet.InventoryDataTable dataTable) {
            this.Adapter.SelectCommand = this.CommandCollection[0];
            if ((this.m_clearBeforeFill == true)) {
                dataTable.Clear();
            }
            int returnValue = this.Adapter.Fill(dataTable);
            return returnValue;
        }
        
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public virtual CarsDataSet.InventoryDataTable GetData() {
            this.Adapter.SelectCommand = this.CommandCollection[0];
            CarsDataSet.InventoryDataTable dataTable = new CarsDataSet.InventoryDataTable();
            this.Adapter.Fill(dataTable);
            return dataTable;
        }
        
        public virtual int Update(CarsDataSet.InventoryDataTable dataTable) {
            return this.Adapter.Update(dataTable);
        }
        
        public virtual int Update(CarsDataSet dataSet) {
            return this.Adapter.Update(dataSet, "Inventory");
        }
        
        public virtual int Update(System.Data.DataRow dataRow) {
            return this.Adapter.Update(new System.Data.DataRow[] {
                        dataRow});
        }
        
        public virtual int Update(System.Data.DataRow[] dataRows) {
            return this.Adapter.Update(dataRows);
        }
        
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Delete, true)]
        public virtual int Delete(int Original_CarID, string Original_Make, string Original_Color, string Original_PetName) {
            this.Adapter.DeleteCommand.Parameters[0].Value = ((int)(Original_CarID));
            if ((Original_Make == null)) {
                this.Adapter.DeleteCommand.Parameters[1].Value = ((int)(1));
                this.Adapter.DeleteCommand.Parameters[2].Value = System.DBNull.Value;
            }
            else {
                this.Adapter.DeleteCommand.Parameters[1].Value = ((int)(0));
                this.Adapter.DeleteCommand.Parameters[2].Value = ((string)(Original_Make));
            }
            if ((Original_Color == null)) {
                this.Adapter.DeleteCommand.Parameters[3].Value = ((int)(1));
                this.Adapter.DeleteCommand.Parameters[4].Value = System.DBNull.Value;
            }
            else {
                this.Adapter.DeleteCommand.Parameters[3].Value = ((int)(0));
                this.Adapter.DeleteCommand.Parameters[4].Value = ((string)(Original_Color));
            }
            if ((Original_PetName == null)) {
                this.Adapter.DeleteCommand.Parameters[5].Value = ((int)(1));
                this.Adapter.DeleteCommand.Parameters[6].Value = System.DBNull.Value;
            }
            else {
                this.Adapter.DeleteCommand.Parameters[5].Value = ((int)(0));
                this.Adapter.DeleteCommand.Parameters[6].Value = ((string)(Original_PetName));
            }
            System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State;
            this.Adapter.DeleteCommand.Connection.Open();
            try {
                return this.Adapter.DeleteCommand.ExecuteNonQuery();
            }
            finally {
                if ((previousConnectionState == System.Data.ConnectionState.Closed)) {
                    this.Adapter.DeleteCommand.Connection.Close();
                }
            }
        }
        
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Insert, true)]
        public virtual int Insert(int CarID, string Make, string Color, string PetName) {
            this.Adapter.InsertCommand.Parameters[0].Value = ((int)(CarID));
            if ((Make == null)) {
                this.Adapter.InsertCommand.Parameters[1].Value = System.DBNull.Value;
            }
            else {
                this.Adapter.InsertCommand.Parameters[1].Value = ((string)(Make));
            }
            if ((Color == null)) {
                this.Adapter.InsertCommand.Parameters[2].Value = System.DBNull.Value;
            }
            else {
                this.Adapter.InsertCommand.Parameters[2].Value = ((string)(Color));
            }
            if ((PetName == null)) {
                this.Adapter.InsertCommand.Parameters[3].Value = System.DBNull.Value;
            }
            else {
                this.Adapter.InsertCommand.Parameters[3].Value = ((string)(PetName));
            }
            System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State;
            this.Adapter.InsertCommand.Connection.Open();
            try {
                return this.Adapter.InsertCommand.ExecuteNonQuery();
            }
            finally {
                if ((previousConnectionState == System.Data.ConnectionState.Closed)) {
                    this.Adapter.InsertCommand.Connection.Close();
                }
            }
        }
        
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, true)]
        public virtual int Update(int CarID, string Make, string Color, string PetName, int Original_CarID, string Original_Make, string Original_Color, string Original_PetName) {
            this.Adapter.UpdateCommand.Parameters[0].Value = ((int)(CarID));
            if ((Make == null)) {
                this.Adapter.UpdateCommand.Parameters[1].Value = System.DBNull.Value;
            }
            else {
                this.Adapter.UpdateCommand.Parameters[1].Value = ((string)(Make));
            }
            if ((Color == null)) {
                this.Adapter.UpdateCommand.Parameters[2].Value = System.DBNull.Value;
            }
            else {
                this.Adapter.UpdateCommand.Parameters[2].Value = ((string)(Color));
            }
            if ((PetName == null)) {
                this.Adapter.UpdateCommand.Parameters[3].Value = System.DBNull.Value;
            }
            else {
                this.Adapter.UpdateCommand.Parameters[3].Value = ((string)(PetName));
            }
            this.Adapter.UpdateCommand.Parameters[4].Value = ((int)(Original_CarID));
            if ((Original_Make == null)) {
                this.Adapter.UpdateCommand.Parameters[5].Value = ((int)(1));
                this.Adapter.UpdateCommand.Parameters[6].Value = System.DBNull.Value;
            }
            else {
                this.Adapter.UpdateCommand.Parameters[5].Value = ((int)(0));
                this.Adapter.UpdateCommand.Parameters[6].Value = ((string)(Original_Make));
            }
            if ((Original_Color == null)) {
                this.Adapter.UpdateCommand.Parameters[7].Value = ((int)(1));
                this.Adapter.UpdateCommand.Parameters[8].Value = System.DBNull.Value;
            }
            else {
                this.Adapter.UpdateCommand.Parameters[7].Value = ((int)(0));
                this.Adapter.UpdateCommand.Parameters[8].Value = ((string)(Original_Color));
            }
            if ((Original_PetName == null)) {
                this.Adapter.UpdateCommand.Parameters[9].Value = ((int)(1));
                this.Adapter.UpdateCommand.Parameters[10].Value = System.DBNull.Value;
            }
            else {
                this.Adapter.UpdateCommand.Parameters[9].Value = ((int)(0));
                this.Adapter.UpdateCommand.Parameters[10].Value = ((string)(Original_PetName));
            }
            System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State;
            this.Adapter.UpdateCommand.Connection.Open();
            try {
                return this.Adapter.UpdateCommand.ExecuteNonQuery();
            }
            finally {
                if ((previousConnectionState == System.Data.ConnectionState.Closed)) {
                    this.Adapter.UpdateCommand.Connection.Close();
                }
            }
        }
    }
}
