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

namespace Tutorial_19 {
    using System;
    using System.Data;
    using System.Xml;
    using System.Runtime.Serialization;
    
    
    [Serializable()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Diagnostics.DebuggerStepThrough()]
    [System.ComponentModel.ToolboxItem(true)]
    public class DsComposer : DataSet {
        
        private ComposerDataTable tableComposer;
        
        public DsComposer() {
            this.InitClass();
            System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            this.Tables.CollectionChanged += schemaChangedHandler;
            this.Relations.CollectionChanged += schemaChangedHandler;
        }
        
        protected DsComposer(SerializationInfo info, StreamingContext context) {
            string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
            if ((strSchema != null)) {
                DataSet ds = new DataSet();
                ds.ReadXmlSchema(new XmlTextReader(new System.IO.StringReader(strSchema)));
                if ((ds.Tables["Composer"] != null)) {
                    this.Tables.Add(new ComposerDataTable(ds.Tables["Composer"]));
                }
                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.InitClass();
            }
            this.GetSerializationData(info, context);
            System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            this.Tables.CollectionChanged += schemaChangedHandler;
            this.Relations.CollectionChanged += schemaChangedHandler;
        }
        
        [System.ComponentModel.Browsable(false)]
        [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)]
        public ComposerDataTable Composer {
            get {
                return this.tableComposer;
            }
        }
        
        public override DataSet Clone() {
            DsComposer cln = ((DsComposer)(base.Clone()));
            cln.InitVars();
            return cln;
        }
        
        protected override bool ShouldSerializeTables() {
            return false;
        }
        
        protected override bool ShouldSerializeRelations() {
            return false;
        }
        
        protected override void ReadXmlSerializable(XmlReader reader) {
            this.Reset();
            DataSet ds = new DataSet();
            ds.ReadXml(reader);
            if ((ds.Tables["Composer"] != null)) {
                this.Tables.Add(new ComposerDataTable(ds.Tables["Composer"]));
            }
            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();
        }
        
        protected override System.Xml.Schema.XmlSchema GetSchemaSerializable() {
            System.IO.MemoryStream stream = new System.IO.MemoryStream();
            this.WriteXmlSchema(new XmlTextWriter(stream, null));
            stream.Position = 0;
            return System.Xml.Schema.XmlSchema.Read(new XmlTextReader(stream), null);
        }
        
        internal void InitVars() {
            this.tableComposer = ((ComposerDataTable)(this.Tables["Composer"]));
            if ((this.tableComposer != null)) {
                this.tableComposer.InitVars();
            }
        }
        
        private void InitClass() {
            this.DataSetName = "DsComposer";
            this.Prefix = "";
            this.Namespace = "http://www.tempuri.org/DsComposer.xsd";
            this.Locale = new System.Globalization.CultureInfo("en-US");
            this.CaseSensitive = false;
            this.EnforceConstraints = true;
            this.tableComposer = new ComposerDataTable();
            this.Tables.Add(this.tableComposer);
        }
        
        private bool ShouldSerializeComposer() {
            return false;
        }
        
        private void SchemaChanged(object sender, System.ComponentModel.CollectionChangeEventArgs e) {
            if ((e.Action == System.ComponentModel.CollectionChangeAction.Remove)) {
                this.InitVars();
            }
        }
        
        public delegate void ComposerRowChangeEventHandler(object sender, ComposerRowChangeEvent e);
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class ComposerDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnBirth;
            
            private DataColumn columnCountry;
            
            private DataColumn columnDeath;
            
            private DataColumn columnFirst;
            
            private DataColumn columnLast;
            
            internal ComposerDataTable() : 
                    base("Composer") {
                this.InitClass();
            }
            
            internal ComposerDataTable(DataTable table) : 
                    base(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;
                this.DisplayExpression = table.DisplayExpression;
            }
            
            [System.ComponentModel.Browsable(false)]
            public int Count {
                get {
                    return this.Rows.Count;
                }
            }
            
            internal DataColumn BirthColumn {
                get {
                    return this.columnBirth;
                }
            }
            
            internal DataColumn CountryColumn {
                get {
                    return this.columnCountry;
                }
            }
            
            internal DataColumn DeathColumn {
                get {
                    return this.columnDeath;
                }
            }
            
            internal DataColumn FirstColumn {
                get {
                    return this.columnFirst;
                }
            }
            
            internal DataColumn LastColumn {
                get {
                    return this.columnLast;
                }
            }
            
            public ComposerRow this[int index] {
                get {
                    return ((ComposerRow)(this.Rows[index]));
                }
            }
            
            public event ComposerRowChangeEventHandler ComposerRowChanged;
            
            public event ComposerRowChangeEventHandler ComposerRowChanging;
            
            public event ComposerRowChangeEventHandler ComposerRowDeleted;
            
            public event ComposerRowChangeEventHandler ComposerRowDeleting;
            
            public void AddComposerRow(ComposerRow row) {
                this.Rows.Add(row);
            }
            
            public ComposerRow AddComposerRow(System.DateTime Birth, string Country, System.DateTime Death, string First, string Last) {
                ComposerRow rowComposerRow = ((ComposerRow)(this.NewRow()));
                rowComposerRow.ItemArray = new object[] {
                        Birth,
                        Country,
                        Death,
                        First,
                        Last};
                this.Rows.Add(rowComposerRow);
                return rowComposerRow;
            }
            
            public ComposerRow FindByLast(string Last) {
                return ((ComposerRow)(this.Rows.Find(new object[] {
                            Last})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                ComposerDataTable cln = ((ComposerDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new ComposerDataTable();
            }
            
            internal void InitVars() {
                this.columnBirth = this.Columns["Birth"];
                this.columnCountry = this.Columns["Country"];
                this.columnDeath = this.Columns["Death"];
                this.columnFirst = this.Columns["First"];
                this.columnLast = this.Columns["Last"];
            }
            
            private void InitClass() {
                this.columnBirth = new DataColumn("Birth", typeof(System.DateTime), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnBirth);
                this.columnCountry = new DataColumn("Country", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnCountry);
                this.columnDeath = new DataColumn("Death", typeof(System.DateTime), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDeath);
                this.columnFirst = new DataColumn("First", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnFirst);
                this.columnLast = new DataColumn("Last", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnLast);
                this.Constraints.Add(new UniqueConstraint("Constraint1", new DataColumn[] {
                                this.columnLast}, true));
                this.columnLast.AllowDBNull = false;
                this.columnLast.Unique = true;
            }
            
            public ComposerRow NewComposerRow() {
                return ((ComposerRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new ComposerRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(ComposerRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.ComposerRowChanged != null)) {
                    this.ComposerRowChanged(this, new ComposerRowChangeEvent(((ComposerRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.ComposerRowChanging != null)) {
                    this.ComposerRowChanging(this, new ComposerRowChangeEvent(((ComposerRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.ComposerRowDeleted != null)) {
                    this.ComposerRowDeleted(this, new ComposerRowChangeEvent(((ComposerRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.ComposerRowDeleting != null)) {
                    this.ComposerRowDeleting(this, new ComposerRowChangeEvent(((ComposerRow)(e.Row)), e.Action));
                }
            }
            
            public void RemoveComposerRow(ComposerRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class ComposerRow : DataRow {
            
            private ComposerDataTable tableComposer;
            
            internal ComposerRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tableComposer = ((ComposerDataTable)(this.Table));
            }
            
            public System.DateTime Birth {
                get {
                    try {
                        return ((System.DateTime)(this[this.tableComposer.BirthColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableComposer.BirthColumn] = value;
                }
            }
            
            public string Country {
                get {
                    try {
                        return ((string)(this[this.tableComposer.CountryColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableComposer.CountryColumn] = value;
                }
            }
            
            public System.DateTime Death {
                get {
                    try {
                        return ((System.DateTime)(this[this.tableComposer.DeathColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableComposer.DeathColumn] = value;
                }
            }
            
            public string First {
                get {
                    try {
                        return ((string)(this[this.tableComposer.FirstColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableComposer.FirstColumn] = value;
                }
            }
            
            public string Last {
                get {
                    return ((string)(this[this.tableComposer.LastColumn]));
                }
                set {
                    this[this.tableComposer.LastColumn] = value;
                }
            }
            
            public bool IsBirthNull() {
                return this.IsNull(this.tableComposer.BirthColumn);
            }
            
            public void SetBirthNull() {
                this[this.tableComposer.BirthColumn] = System.Convert.DBNull;
            }
            
            public bool IsCountryNull() {
                return this.IsNull(this.tableComposer.CountryColumn);
            }
            
            public void SetCountryNull() {
                this[this.tableComposer.CountryColumn] = System.Convert.DBNull;
            }
            
            public bool IsDeathNull() {
                return this.IsNull(this.tableComposer.DeathColumn);
            }
            
            public void SetDeathNull() {
                this[this.tableComposer.DeathColumn] = System.Convert.DBNull;
            }
            
            public bool IsFirstNull() {
                return this.IsNull(this.tableComposer.FirstColumn);
            }
            
            public void SetFirstNull() {
                this[this.tableComposer.FirstColumn] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class ComposerRowChangeEvent : EventArgs {
            
            private ComposerRow eventRow;
            
            private DataRowAction eventAction;
            
            public ComposerRowChangeEvent(ComposerRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public ComposerRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}
