//------------------------------------------------------------------------------
// <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 Doctors : DataSet {
        
        private t_DoctorDataTable tablet_Doctor;
        
        public Doctors() {
            this.InitClass();
            System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            this.Tables.CollectionChanged += schemaChangedHandler;
            this.Relations.CollectionChanged += schemaChangedHandler;
        }
        
        protected Doctors(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_Doctor"] != null)) {
                    this.Tables.Add(new t_DoctorDataTable(ds.Tables["t_Doctor"]));
                }
                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_DoctorDataTable t_Doctor {
            get {
                return this.tablet_Doctor;
            }
        }
        
        public override DataSet Clone() {
            Doctors cln = ((Doctors)(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_Doctor"] != null)) {
                this.Tables.Add(new t_DoctorDataTable(ds.Tables["t_Doctor"]));
            }
            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_Doctor = ((t_DoctorDataTable)(this.Tables["t_Doctor"]));
            if ((this.tablet_Doctor != null)) {
                this.tablet_Doctor.InitVars();
            }
        }
        
        private void InitClass() {
            this.DataSetName = "Doctors";
            this.Prefix = "";
            this.Namespace = "http://tempuri.org/Doctors.xsd";
            this.Locale = new System.Globalization.CultureInfo("en-US");
            this.CaseSensitive = false;
            this.EnforceConstraints = true;
            this.tablet_Doctor = new t_DoctorDataTable();
            this.Tables.Add(this.tablet_Doctor);
        }
        
        private bool ShouldSerializet_Doctor() {
            return false;
        }
        
        private void SchemaChanged(object sender, System.ComponentModel.CollectionChangeEventArgs e) {
            if ((e.Action == System.ComponentModel.CollectionChangeAction.Remove)) {
                this.InitVars();
            }
        }
        
        public delegate void t_DoctorRowChangeEventHandler(object sender, t_DoctorRowChangeEvent e);
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_DoctorDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnUserID;
            
            private DataColumn columnName;
            
            private DataColumn columnSex;
            
            private DataColumn columnBirthDate;
            
            private DataColumn columnDepartmentID;
            
            private DataColumn columnRegistrationTypeID;
            
            private DataColumn columnDepartmentName;
            
            private DataColumn columnRegistrationTypeName;
            
            internal t_DoctorDataTable() : 
                    base("t_Doctor") {
                this.InitClass();
            }
            
            internal t_DoctorDataTable(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 UserIDColumn {
                get {
                    return this.columnUserID;
                }
            }
            
            internal DataColumn NameColumn {
                get {
                    return this.columnName;
                }
            }
            
            internal DataColumn SexColumn {
                get {
                    return this.columnSex;
                }
            }
            
            internal DataColumn BirthDateColumn {
                get {
                    return this.columnBirthDate;
                }
            }
            
            internal DataColumn DepartmentIDColumn {
                get {
                    return this.columnDepartmentID;
                }
            }
            
            internal DataColumn RegistrationTypeIDColumn {
                get {
                    return this.columnRegistrationTypeID;
                }
            }
            
            internal DataColumn DepartmentNameColumn {
                get {
                    return this.columnDepartmentName;
                }
            }
            
            internal DataColumn RegistrationTypeNameColumn {
                get {
                    return this.columnRegistrationTypeName;
                }
            }
            
            public t_DoctorRow this[int index] {
                get {
                    return ((t_DoctorRow)(this.Rows[index]));
                }
            }
            
            public event t_DoctorRowChangeEventHandler t_DoctorRowChanged;
            
            public event t_DoctorRowChangeEventHandler t_DoctorRowChanging;
            
            public event t_DoctorRowChangeEventHandler t_DoctorRowDeleted;
            
            public event t_DoctorRowChangeEventHandler t_DoctorRowDeleting;
            
            public void Addt_DoctorRow(t_DoctorRow row) {
                this.Rows.Add(row);
            }
            
            public t_DoctorRow Addt_DoctorRow(string Name, bool Sex, System.DateTime BirthDate, short DepartmentID, short RegistrationTypeID, string DepartmentName, string RegistrationTypeName) {
                t_DoctorRow rowt_DoctorRow = ((t_DoctorRow)(this.NewRow()));
                rowt_DoctorRow.ItemArray = new object[] {
                        null,
                        Name,
                        Sex,
                        BirthDate,
                        DepartmentID,
                        RegistrationTypeID,
                        DepartmentName,
                        RegistrationTypeName};
                this.Rows.Add(rowt_DoctorRow);
                return rowt_DoctorRow;
            }
            
            public t_DoctorRow FindByUserID(int UserID) {
                return ((t_DoctorRow)(this.Rows.Find(new object[] {
                            UserID})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                t_DoctorDataTable cln = ((t_DoctorDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new t_DoctorDataTable();
            }
            
            internal void InitVars() {
                this.columnUserID = this.Columns["UserID"];
                this.columnName = this.Columns["Name"];
                this.columnSex = this.Columns["Sex"];
                this.columnBirthDate = this.Columns["BirthDate"];
                this.columnDepartmentID = this.Columns["DepartmentID"];
                this.columnRegistrationTypeID = this.Columns["RegistrationTypeID"];
                this.columnDepartmentName = this.Columns["DepartmentName"];
                this.columnRegistrationTypeName = this.Columns["RegistrationTypeName"];
            }
            
            private void InitClass() {
                this.columnUserID = new DataColumn("UserID", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnUserID);
                this.columnName = new DataColumn("Name", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnName);
                this.columnSex = new DataColumn("Sex", typeof(bool), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnSex);
                this.columnBirthDate = new DataColumn("BirthDate", typeof(System.DateTime), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnBirthDate);
                this.columnDepartmentID = new DataColumn("DepartmentID", typeof(short), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDepartmentID);
                this.columnRegistrationTypeID = new DataColumn("RegistrationTypeID", typeof(short), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnRegistrationTypeID);
                this.columnDepartmentName = new DataColumn("DepartmentName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDepartmentName);
                this.columnRegistrationTypeName = new DataColumn("RegistrationTypeName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnRegistrationTypeName);
                this.Constraints.Add(new UniqueConstraint("DoctorsKey1", new DataColumn[] {
                                this.columnUserID}, true));
                this.columnUserID.AutoIncrement = true;
                this.columnUserID.AllowDBNull = false;
                this.columnUserID.ReadOnly = true;
                this.columnUserID.Unique = true;
                this.columnName.AllowDBNull = false;
                this.columnSex.AllowDBNull = false;
            }
            
            public t_DoctorRow Newt_DoctorRow() {
                return ((t_DoctorRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new t_DoctorRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(t_DoctorRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.t_DoctorRowChanged != null)) {
                    this.t_DoctorRowChanged(this, new t_DoctorRowChangeEvent(((t_DoctorRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.t_DoctorRowChanging != null)) {
                    this.t_DoctorRowChanging(this, new t_DoctorRowChangeEvent(((t_DoctorRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.t_DoctorRowDeleted != null)) {
                    this.t_DoctorRowDeleted(this, new t_DoctorRowChangeEvent(((t_DoctorRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.t_DoctorRowDeleting != null)) {
                    this.t_DoctorRowDeleting(this, new t_DoctorRowChangeEvent(((t_DoctorRow)(e.Row)), e.Action));
                }
            }
            
            public void Removet_DoctorRow(t_DoctorRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_DoctorRow : DataRow {
            
            private t_DoctorDataTable tablet_Doctor;
            
            internal t_DoctorRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tablet_Doctor = ((t_DoctorDataTable)(this.Table));
            }
            
            public int UserID {
                get {
                    return ((int)(this[this.tablet_Doctor.UserIDColumn]));
                }
                set {
                    this[this.tablet_Doctor.UserIDColumn] = value;
                }
            }
            
            public string Name {
                get {
                    return ((string)(this[this.tablet_Doctor.NameColumn]));
                }
                set {
                    this[this.tablet_Doctor.NameColumn] = value;
                }
            }
            
            public bool Sex {
                get {
                    return ((bool)(this[this.tablet_Doctor.SexColumn]));
                }
                set {
                    this[this.tablet_Doctor.SexColumn] = value;
                }
            }
            
            public System.DateTime BirthDate {
                get {
                    try {
                        return ((System.DateTime)(this[this.tablet_Doctor.BirthDateColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_Doctor.BirthDateColumn] = value;
                }
            }
            
            public short DepartmentID {
                get {
                    try {
                        return ((short)(this[this.tablet_Doctor.DepartmentIDColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_Doctor.DepartmentIDColumn] = value;
                }
            }
            
            public short RegistrationTypeID {
                get {
                    try {
                        return ((short)(this[this.tablet_Doctor.RegistrationTypeIDColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_Doctor.RegistrationTypeIDColumn] = value;
                }
            }
            
            public string DepartmentName {
                get {
                    try {
                        return ((string)(this[this.tablet_Doctor.DepartmentNameColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_Doctor.DepartmentNameColumn] = value;
                }
            }
            
            public string RegistrationTypeName {
                get {
                    try {
                        return ((string)(this[this.tablet_Doctor.RegistrationTypeNameColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_Doctor.RegistrationTypeNameColumn] = value;
                }
            }
            
            public bool IsBirthDateNull() {
                return this.IsNull(this.tablet_Doctor.BirthDateColumn);
            }
            
            public void SetBirthDateNull() {
                this[this.tablet_Doctor.BirthDateColumn] = System.Convert.DBNull;
            }
            
            public bool IsDepartmentIDNull() {
                return this.IsNull(this.tablet_Doctor.DepartmentIDColumn);
            }
            
            public void SetDepartmentIDNull() {
                this[this.tablet_Doctor.DepartmentIDColumn] = System.Convert.DBNull;
            }
            
            public bool IsRegistrationTypeIDNull() {
                return this.IsNull(this.tablet_Doctor.RegistrationTypeIDColumn);
            }
            
            public void SetRegistrationTypeIDNull() {
                this[this.tablet_Doctor.RegistrationTypeIDColumn] = System.Convert.DBNull;
            }
            
            public bool IsDepartmentNameNull() {
                return this.IsNull(this.tablet_Doctor.DepartmentNameColumn);
            }
            
            public void SetDepartmentNameNull() {
                this[this.tablet_Doctor.DepartmentNameColumn] = System.Convert.DBNull;
            }
            
            public bool IsRegistrationTypeNameNull() {
                return this.IsNull(this.tablet_Doctor.RegistrationTypeNameColumn);
            }
            
            public void SetRegistrationTypeNameNull() {
                this[this.tablet_Doctor.RegistrationTypeNameColumn] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_DoctorRowChangeEvent : EventArgs {
            
            private t_DoctorRow eventRow;
            
            private DataRowAction eventAction;
            
            public t_DoctorRowChangeEvent(t_DoctorRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public t_DoctorRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}
