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

namespace HISClinic.DataModel {
    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 Diseases : DataSet {
        
        private t_DiseaseDataTable tablet_Disease;
        
        public Diseases() {
            this.InitClass();
            System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            this.Tables.CollectionChanged += schemaChangedHandler;
            this.Relations.CollectionChanged += schemaChangedHandler;
        }
        
        protected Diseases(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["t_Disease"] != null)) {
                    this.Tables.Add(new t_DiseaseDataTable(ds.Tables["t_Disease"]));
                }
                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 t_DiseaseDataTable t_Disease {
            get {
                return this.tablet_Disease;
            }
        }
        
        public override DataSet Clone() {
            Diseases cln = ((Diseases)(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["t_Disease"] != null)) {
                this.Tables.Add(new t_DiseaseDataTable(ds.Tables["t_Disease"]));
            }
            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.tablet_Disease = ((t_DiseaseDataTable)(this.Tables["t_Disease"]));
            if ((this.tablet_Disease != null)) {
                this.tablet_Disease.InitVars();
            }
        }
        
        private void InitClass() {
            this.DataSetName = "Diseases";
            this.Prefix = "";
            this.Namespace = "http://tempuri.org/Diseases.xsd";
            this.Locale = new System.Globalization.CultureInfo("en-US");
            this.CaseSensitive = false;
            this.EnforceConstraints = true;
            this.tablet_Disease = new t_DiseaseDataTable();
            this.Tables.Add(this.tablet_Disease);
        }
        
        private bool ShouldSerializet_Disease() {
            return false;
        }
        
        private void SchemaChanged(object sender, System.ComponentModel.CollectionChangeEventArgs e) {
            if ((e.Action == System.ComponentModel.CollectionChangeAction.Remove)) {
                this.InitVars();
            }
        }
        
        public delegate void t_DiseaseRowChangeEventHandler(object sender, t_DiseaseRowChangeEvent e);
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_DiseaseDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnDiseaseID;
            
            private DataColumn columnName;
            
            private DataColumn columnBopomofo;
            
            internal t_DiseaseDataTable() : 
                    base("t_Disease") {
                this.InitClass();
            }
            
            internal t_DiseaseDataTable(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 DiseaseIDColumn {
                get {
                    return this.columnDiseaseID;
                }
            }
            
            internal DataColumn NameColumn {
                get {
                    return this.columnName;
                }
            }
            
            internal DataColumn BopomofoColumn {
                get {
                    return this.columnBopomofo;
                }
            }
            
            public t_DiseaseRow this[int index] {
                get {
                    return ((t_DiseaseRow)(this.Rows[index]));
                }
            }
            
            public event t_DiseaseRowChangeEventHandler t_DiseaseRowChanged;
            
            public event t_DiseaseRowChangeEventHandler t_DiseaseRowChanging;
            
            public event t_DiseaseRowChangeEventHandler t_DiseaseRowDeleted;
            
            public event t_DiseaseRowChangeEventHandler t_DiseaseRowDeleting;
            
            public void Addt_DiseaseRow(t_DiseaseRow row) {
                this.Rows.Add(row);
            }
            
            public t_DiseaseRow Addt_DiseaseRow(string Name, string Bopomofo) {
                t_DiseaseRow rowt_DiseaseRow = ((t_DiseaseRow)(this.NewRow()));
                rowt_DiseaseRow.ItemArray = new object[] {
                        null,
                        Name,
                        Bopomofo};
                this.Rows.Add(rowt_DiseaseRow);
                return rowt_DiseaseRow;
            }
            
            public t_DiseaseRow FindByDiseaseID(int DiseaseID) {
                return ((t_DiseaseRow)(this.Rows.Find(new object[] {
                            DiseaseID})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                t_DiseaseDataTable cln = ((t_DiseaseDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new t_DiseaseDataTable();
            }
            
            internal void InitVars() {
                this.columnDiseaseID = this.Columns["DiseaseID"];
                this.columnName = this.Columns["Name"];
                this.columnBopomofo = this.Columns["Bopomofo"];
            }
            
            private void InitClass() {
                this.columnDiseaseID = new DataColumn("DiseaseID", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDiseaseID);
                this.columnName = new DataColumn("Name", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnName);
                this.columnBopomofo = new DataColumn("Bopomofo", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnBopomofo);
                this.Constraints.Add(new UniqueConstraint("DiseasesKey1", new DataColumn[] {
                                this.columnDiseaseID}, true));
                this.columnDiseaseID.AutoIncrement = true;
                this.columnDiseaseID.AllowDBNull = false;
                this.columnDiseaseID.ReadOnly = true;
                this.columnDiseaseID.Unique = true;
                this.columnName.AllowDBNull = false;
            }
            
            public t_DiseaseRow Newt_DiseaseRow() {
                return ((t_DiseaseRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new t_DiseaseRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(t_DiseaseRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.t_DiseaseRowChanged != null)) {
                    this.t_DiseaseRowChanged(this, new t_DiseaseRowChangeEvent(((t_DiseaseRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.t_DiseaseRowChanging != null)) {
                    this.t_DiseaseRowChanging(this, new t_DiseaseRowChangeEvent(((t_DiseaseRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.t_DiseaseRowDeleted != null)) {
                    this.t_DiseaseRowDeleted(this, new t_DiseaseRowChangeEvent(((t_DiseaseRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.t_DiseaseRowDeleting != null)) {
                    this.t_DiseaseRowDeleting(this, new t_DiseaseRowChangeEvent(((t_DiseaseRow)(e.Row)), e.Action));
                }
            }
            
            public void Removet_DiseaseRow(t_DiseaseRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_DiseaseRow : DataRow {
            
            private t_DiseaseDataTable tablet_Disease;
            
            internal t_DiseaseRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tablet_Disease = ((t_DiseaseDataTable)(this.Table));
            }
            
            public int DiseaseID {
                get {
                    return ((int)(this[this.tablet_Disease.DiseaseIDColumn]));
                }
                set {
                    this[this.tablet_Disease.DiseaseIDColumn] = value;
                }
            }
            
            public string Name {
                get {
                    return ((string)(this[this.tablet_Disease.NameColumn]));
                }
                set {
                    this[this.tablet_Disease.NameColumn] = value;
                }
            }
            
            public string Bopomofo {
                get {
                    try {
                        return ((string)(this[this.tablet_Disease.BopomofoColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_Disease.BopomofoColumn] = value;
                }
            }
            
            public bool IsBopomofoNull() {
                return this.IsNull(this.tablet_Disease.BopomofoColumn);
            }
            
            public void SetBopomofoNull() {
                this[this.tablet_Disease.BopomofoColumn] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_DiseaseRowChangeEvent : EventArgs {
            
            private t_DiseaseRow eventRow;
            
            private DataRowAction eventAction;
            
            public t_DiseaseRowChangeEvent(t_DiseaseRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public t_DiseaseRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}
