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

namespace Chapter30 {
    using System;
    using System.Data;
    using System.Xml;
    using System.Runtime.Serialization;
    
    
    [Serializable()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public class dsPubs : System.Data.DataSet {
        
        private authorsDataTable tableauthors;
        
        public dsPubs() {
            this.InitClass();
        }
        
        private dsPubs(SerializationInfo info, StreamingContext context) {
            this.InitClass();
            this.GetSerializationData(info, context);
        }
        
        [System.ComponentModel.Browsable(false)]
        [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)]
        public authorsDataTable authors {
            get {
                return this.tableauthors;
            }
        }
        
        protected override bool ShouldSerializeTables() {
            return false;
        }
        
        protected override bool ShouldSerializeRelations() {
            return false;
        }
        
        protected override void ReadXmlSerializable(XmlReader reader) {
            this.ReadXml(reader, XmlReadMode.IgnoreSchema);
        }
        
        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);
        }
        
        private void InitClass() {
            this.DataSetName = "dsPubs";
            this.Namespace = "http://www.tempuri.org/dsPubs.xsd";
            this.tableauthors = new authorsDataTable();
            this.Tables.Add(this.tableauthors);
        }
        
        private bool ShouldSerializeauthors() {
            return false;
        }
        
        public delegate void authorsRowChangeEventHandler(object sender, authorsRowChangeEvent e);
        
        public class authorsDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnau_id;
            
            private DataColumn columnau_lname;
            
            private DataColumn columnau_fname;
            
            private DataColumn columnphone;
            
            private DataColumn columnaddress;
            
            private DataColumn columncity;
            
            private DataColumn columnstate;
            
            private DataColumn columnzip;
            
            private DataColumn columncontract;
            
            internal authorsDataTable() : 
                    base("authors") {
                this.InitClass();
            }
            
            [System.ComponentModel.Browsable(false)]
            public int Count {
                get {
                    return this.Rows.Count;
                }
            }
            
            internal DataColumn au_idColumn {
                get {
                    return this.columnau_id;
                }
            }
            
            internal DataColumn au_lnameColumn {
                get {
                    return this.columnau_lname;
                }
            }
            
            internal DataColumn au_fnameColumn {
                get {
                    return this.columnau_fname;
                }
            }
            
            internal DataColumn phoneColumn {
                get {
                    return this.columnphone;
                }
            }
            
            internal DataColumn addressColumn {
                get {
                    return this.columnaddress;
                }
            }
            
            internal DataColumn cityColumn {
                get {
                    return this.columncity;
                }
            }
            
            internal DataColumn stateColumn {
                get {
                    return this.columnstate;
                }
            }
            
            internal DataColumn zipColumn {
                get {
                    return this.columnzip;
                }
            }
            
            internal DataColumn contractColumn {
                get {
                    return this.columncontract;
                }
            }
            
            public authorsRow this[int index] {
                get {
                    return ((authorsRow)(this.Rows[index]));
                }
            }
            
            public event authorsRowChangeEventHandler authorsRowChanged;
            
            public event authorsRowChangeEventHandler authorsRowChanging;
            
            public event authorsRowChangeEventHandler authorsRowDeleted;
            
            public event authorsRowChangeEventHandler authorsRowDeleting;
            
            public void AddauthorsRow(authorsRow row) {
                this.Rows.Add(row);
            }
            
            public authorsRow AddauthorsRow(string au_id, string au_lname, string au_fname, string phone, string address, string city, string state, string zip, bool contract) {
                authorsRow rowauthorsRow = ((authorsRow)(this.NewRow()));
                rowauthorsRow.ItemArray = new object[] {
                        au_id,
                        au_lname,
                        au_fname,
                        phone,
                        address,
                        city,
                        state,
                        zip,
                        contract};
                this.Rows.Add(rowauthorsRow);
                return rowauthorsRow;
            }
            
            public authorsRow FindByau_id(string au_id) {
                return ((authorsRow)(this.Rows.Find(new object[] {
                            au_id})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            private void InitClass() {
                this.columnau_id = new DataColumn("au_id", typeof(string), "", System.Data.MappingType.Element);
                this.columnau_id.AllowDBNull = false;
                this.columnau_id.Unique = true;
                this.Columns.Add(this.columnau_id);
                this.columnau_lname = new DataColumn("au_lname", typeof(string), "", System.Data.MappingType.Element);
                this.columnau_lname.AllowDBNull = false;
                this.Columns.Add(this.columnau_lname);
                this.columnau_fname = new DataColumn("au_fname", typeof(string), "", System.Data.MappingType.Element);
                this.columnau_fname.AllowDBNull = false;
                this.Columns.Add(this.columnau_fname);
                this.columnphone = new DataColumn("phone", typeof(string), "", System.Data.MappingType.Element);
                this.columnphone.AllowDBNull = false;
                this.Columns.Add(this.columnphone);
                this.columnaddress = new DataColumn("address", typeof(string), "", System.Data.MappingType.Element);
                this.Columns.Add(this.columnaddress);
                this.columncity = new DataColumn("city", typeof(string), "", System.Data.MappingType.Element);
                this.Columns.Add(this.columncity);
                this.columnstate = new DataColumn("state", typeof(string), "", System.Data.MappingType.Element);
                this.Columns.Add(this.columnstate);
                this.columnzip = new DataColumn("zip", typeof(string), "", System.Data.MappingType.Element);
                this.Columns.Add(this.columnzip);
                this.columncontract = new DataColumn("contract", typeof(bool), "", System.Data.MappingType.Element);
                this.columncontract.AllowDBNull = false;
                this.Columns.Add(this.columncontract);
                this.PrimaryKey = new DataColumn[] {
                        this.columnau_id};
            }
            
            public authorsRow NewauthorsRow() {
                return ((authorsRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                // We need to ensure that all Rows in the tabled are typed rows.
                // Table calls newRow whenever it needs to create a row.
                // So the following conditions are covered by Row newRow(Record record)
                // * Cursor calls table.addRecord(record) 
                // * table.addRow(object[] values) calls newRow(record)    
                return new authorsRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(authorsRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.authorsRowChanged != null)) {
                    this.authorsRowChanged(this, new authorsRowChangeEvent(((authorsRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.authorsRowChanging != null)) {
                    this.authorsRowChanging(this, new authorsRowChangeEvent(((authorsRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.authorsRowDeleted != null)) {
                    this.authorsRowDeleted(this, new authorsRowChangeEvent(((authorsRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.authorsRowDeleting != null)) {
                    this.authorsRowDeleting(this, new authorsRowChangeEvent(((authorsRow)(e.Row)), e.Action));
                }
            }
            
            public void RemoveauthorsRow(authorsRow row) {
                this.Rows.Remove(row);
            }
        }
        
        public class authorsRow : DataRow {
            
            private authorsDataTable tableauthors;
            
            internal authorsRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tableauthors = ((authorsDataTable)(this.Table));
            }
            
            public string au_id {
                get {
                    return ((string)(this[this.tableauthors.au_idColumn]));
                }
                set {
                    this[this.tableauthors.au_idColumn] = value;
                }
            }
            
            public string au_lname {
                get {
                    return ((string)(this[this.tableauthors.au_lnameColumn]));
                }
                set {
                    this[this.tableauthors.au_lnameColumn] = value;
                }
            }
            
            public string au_fname {
                get {
                    return ((string)(this[this.tableauthors.au_fnameColumn]));
                }
                set {
                    this[this.tableauthors.au_fnameColumn] = value;
                }
            }
            
            public string phone {
                get {
                    return ((string)(this[this.tableauthors.phoneColumn]));
                }
                set {
                    this[this.tableauthors.phoneColumn] = value;
                }
            }
            
            public string address {
                get {
                    try {
                        return ((string)(this[this.tableauthors.addressColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableauthors.addressColumn] = value;
                }
            }
            
            public string city {
                get {
                    try {
                        return ((string)(this[this.tableauthors.cityColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableauthors.cityColumn] = value;
                }
            }
            
            public string state {
                get {
                    try {
                        return ((string)(this[this.tableauthors.stateColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableauthors.stateColumn] = value;
                }
            }
            
            public string zip {
                get {
                    try {
                        return ((string)(this[this.tableauthors.zipColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableauthors.zipColumn] = value;
                }
            }
            
            public bool contract {
                get {
                    return ((bool)(this[this.tableauthors.contractColumn]));
                }
                set {
                    this[this.tableauthors.contractColumn] = value;
                }
            }
            
            public bool IsaddressNull() {
                return this.IsNull(this.tableauthors.addressColumn);
            }
            
            public void SetaddressNull() {
                this[this.tableauthors.addressColumn] = System.Convert.DBNull;
            }
            
            public bool IscityNull() {
                return this.IsNull(this.tableauthors.cityColumn);
            }
            
            public void SetcityNull() {
                this[this.tableauthors.cityColumn] = System.Convert.DBNull;
            }
            
            public bool IsstateNull() {
                return this.IsNull(this.tableauthors.stateColumn);
            }
            
            public void SetstateNull() {
                this[this.tableauthors.stateColumn] = System.Convert.DBNull;
            }
            
            public bool IszipNull() {
                return this.IsNull(this.tableauthors.zipColumn);
            }
            
            public void SetzipNull() {
                this[this.tableauthors.zipColumn] = System.Convert.DBNull;
            }
        }
        
        public class authorsRowChangeEvent : EventArgs {
            
            private authorsRow eventRow;
            
            private System.Data.DataRowAction eventAction;
            
            public authorsRowChangeEvent(authorsRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public authorsRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}
