//------------------------------------------------------------------------------
// <autogenerated>
//     This code was generated by a tool.
//     Runtime Version: 1.1.4322.2032
//
//     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 Registrations : DataSet {
        
        private t_RegistrationDataTable tablet_Registration;
        
        public Registrations() {
            this.InitClass();
            System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            this.Tables.CollectionChanged += schemaChangedHandler;
            this.Relations.CollectionChanged += schemaChangedHandler;
        }
        
        protected Registrations(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_Registration"] != null)) {
                    this.Tables.Add(new t_RegistrationDataTable(ds.Tables["t_Registration"]));
                }
                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_RegistrationDataTable t_Registration {
            get {
                return this.tablet_Registration;
            }
        }
        
        public override DataSet Clone() {
            Registrations cln = ((Registrations)(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_Registration"] != null)) {
                this.Tables.Add(new t_RegistrationDataTable(ds.Tables["t_Registration"]));
            }
            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_Registration = ((t_RegistrationDataTable)(this.Tables["t_Registration"]));
            if ((this.tablet_Registration != null)) {
                this.tablet_Registration.InitVars();
            }
        }
        
        private void InitClass() {
            this.DataSetName = "Registrations";
            this.Prefix = "";
            this.Namespace = "http://tempuri.org/Registrations.xsd";
            this.Locale = new System.Globalization.CultureInfo("en-US");
            this.CaseSensitive = false;
            this.EnforceConstraints = true;
            this.tablet_Registration = new t_RegistrationDataTable();
            this.Tables.Add(this.tablet_Registration);
        }
        
        private bool ShouldSerializet_Registration() {
            return false;
        }
        
        private void SchemaChanged(object sender, System.ComponentModel.CollectionChangeEventArgs e) {
            if ((e.Action == System.ComponentModel.CollectionChangeAction.Remove)) {
                this.InitVars();
            }
        }
        
        public delegate void t_RegistrationRowChangeEventHandler(object sender, t_RegistrationRowChangeEvent e);
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_RegistrationDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnRegistrationID;
            
            private DataColumn columnPatientID;
            
            private DataColumn columnRegistrationTypeID;
            
            private DataColumn columnDeparptmentID;
            
            private DataColumn columnRegisterDate;
            
            private DataColumn columnRegistrarID;
            
            private DataColumn columnDoctorID;
            
            private DataColumn columnSeeDoctorDate;
            
            private DataColumn columnStatus;
            
            private DataColumn columnPatientName;
            
            private DataColumn columnRegistrationTypeName;
            
            private DataColumn columnDepartmentName;
            
            private DataColumn columnRegistrarName;
            
            private DataColumn columnDoctorName;
            
            internal t_RegistrationDataTable() : 
                    base("t_Registration") {
                this.InitClass();
            }
            
            internal t_RegistrationDataTable(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 RegistrationIDColumn {
                get {
                    return this.columnRegistrationID;
                }
            }
            
            internal DataColumn PatientIDColumn {
                get {
                    return this.columnPatientID;
                }
            }
            
            internal DataColumn RegistrationTypeIDColumn {
                get {
                    return this.columnRegistrationTypeID;
                }
            }
            
            internal DataColumn DeparptmentIDColumn {
                get {
                    return this.columnDeparptmentID;
                }
            }
            
            internal DataColumn RegisterDateColumn {
                get {
                    return this.columnRegisterDate;
                }
            }
            
            internal DataColumn RegistrarIDColumn {
                get {
                    return this.columnRegistrarID;
                }
            }
            
            internal DataColumn DoctorIDColumn {
                get {
                    return this.columnDoctorID;
                }
            }
            
            internal DataColumn SeeDoctorDateColumn {
                get {
                    return this.columnSeeDoctorDate;
                }
            }
            
            internal DataColumn StatusColumn {
                get {
                    return this.columnStatus;
                }
            }
            
            internal DataColumn PatientNameColumn {
                get {
                    return this.columnPatientName;
                }
            }
            
            internal DataColumn RegistrationTypeNameColumn {
                get {
                    return this.columnRegistrationTypeName;
                }
            }
            
            internal DataColumn DepartmentNameColumn {
                get {
                    return this.columnDepartmentName;
                }
            }
            
            internal DataColumn RegistrarNameColumn {
                get {
                    return this.columnRegistrarName;
                }
            }
            
            internal DataColumn DoctorNameColumn {
                get {
                    return this.columnDoctorName;
                }
            }
            
            public t_RegistrationRow this[int index] {
                get {
                    return ((t_RegistrationRow)(this.Rows[index]));
                }
            }
            
            public event t_RegistrationRowChangeEventHandler t_RegistrationRowChanged;
            
            public event t_RegistrationRowChangeEventHandler t_RegistrationRowChanging;
            
            public event t_RegistrationRowChangeEventHandler t_RegistrationRowDeleted;
            
            public event t_RegistrationRowChangeEventHandler t_RegistrationRowDeleting;
            
            public void Addt_RegistrationRow(t_RegistrationRow row) {
                this.Rows.Add(row);
            }
            
            public t_RegistrationRow Addt_RegistrationRow(int PatientID, short RegistrationTypeID, short DeparptmentID, System.DateTime RegisterDate, int RegistrarID, int DoctorID, System.DateTime SeeDoctorDate, System.Byte Status, string PatientName, string RegistrationTypeName, string DepartmentName, string RegistrarName, string DoctorName) {
                t_RegistrationRow rowt_RegistrationRow = ((t_RegistrationRow)(this.NewRow()));
                rowt_RegistrationRow.ItemArray = new object[] {
                        null,
                        PatientID,
                        RegistrationTypeID,
                        DeparptmentID,
                        RegisterDate,
                        RegistrarID,
                        DoctorID,
                        SeeDoctorDate,
                        Status,
                        PatientName,
                        RegistrationTypeName,
                        DepartmentName,
                        RegistrarName,
                        DoctorName};
                this.Rows.Add(rowt_RegistrationRow);
                return rowt_RegistrationRow;
            }
            
            public t_RegistrationRow FindByRegistrationID(long RegistrationID) {
                return ((t_RegistrationRow)(this.Rows.Find(new object[] {
                            RegistrationID})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                t_RegistrationDataTable cln = ((t_RegistrationDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new t_RegistrationDataTable();
            }
            
            internal void InitVars() {
                this.columnRegistrationID = this.Columns["RegistrationID"];
                this.columnPatientID = this.Columns["PatientID"];
                this.columnRegistrationTypeID = this.Columns["RegistrationTypeID"];
                this.columnDeparptmentID = this.Columns["DeparptmentID"];
                this.columnRegisterDate = this.Columns["RegisterDate"];
                this.columnRegistrarID = this.Columns["RegistrarID"];
                this.columnDoctorID = this.Columns["DoctorID"];
                this.columnSeeDoctorDate = this.Columns["SeeDoctorDate"];
                this.columnStatus = this.Columns["Status"];
                this.columnPatientName = this.Columns["PatientName"];
                this.columnRegistrationTypeName = this.Columns["RegistrationTypeName"];
                this.columnDepartmentName = this.Columns["DepartmentName"];
                this.columnRegistrarName = this.Columns["RegistrarName"];
                this.columnDoctorName = this.Columns["DoctorName"];
            }
            
            private void InitClass() {
                this.columnRegistrationID = new DataColumn("RegistrationID", typeof(long), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnRegistrationID);
                this.columnPatientID = new DataColumn("PatientID", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnPatientID);
                this.columnRegistrationTypeID = new DataColumn("RegistrationTypeID", typeof(short), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnRegistrationTypeID);
                this.columnDeparptmentID = new DataColumn("DeparptmentID", typeof(short), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDeparptmentID);
                this.columnRegisterDate = new DataColumn("RegisterDate", typeof(System.DateTime), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnRegisterDate);
                this.columnRegistrarID = new DataColumn("RegistrarID", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnRegistrarID);
                this.columnDoctorID = new DataColumn("DoctorID", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDoctorID);
                this.columnSeeDoctorDate = new DataColumn("SeeDoctorDate", typeof(System.DateTime), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnSeeDoctorDate);
                this.columnStatus = new DataColumn("Status", typeof(System.Byte), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnStatus);
                this.columnPatientName = new DataColumn("PatientName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnPatientName);
                this.columnRegistrationTypeName = new DataColumn("RegistrationTypeName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnRegistrationTypeName);
                this.columnDepartmentName = new DataColumn("DepartmentName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDepartmentName);
                this.columnRegistrarName = new DataColumn("RegistrarName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnRegistrarName);
                this.columnDoctorName = new DataColumn("DoctorName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDoctorName);
                this.Constraints.Add(new UniqueConstraint("RegistrationsKey1", new DataColumn[] {
                                this.columnRegistrationID}, true));
                this.columnRegistrationID.AutoIncrement = true;
                this.columnRegistrationID.AllowDBNull = false;
                this.columnRegistrationID.ReadOnly = true;
                this.columnRegistrationID.Unique = true;
                this.columnPatientID.AllowDBNull = false;
                this.columnRegistrationTypeID.AllowDBNull = false;
                this.columnDeparptmentID.AllowDBNull = false;
                this.columnRegistrarID.AllowDBNull = false;
                this.columnDoctorID.AllowDBNull = false;
                this.columnStatus.AllowDBNull = false;
            }
            
            public t_RegistrationRow Newt_RegistrationRow() {
                return ((t_RegistrationRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new t_RegistrationRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(t_RegistrationRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.t_RegistrationRowChanged != null)) {
                    this.t_RegistrationRowChanged(this, new t_RegistrationRowChangeEvent(((t_RegistrationRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.t_RegistrationRowChanging != null)) {
                    this.t_RegistrationRowChanging(this, new t_RegistrationRowChangeEvent(((t_RegistrationRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.t_RegistrationRowDeleted != null)) {
                    this.t_RegistrationRowDeleted(this, new t_RegistrationRowChangeEvent(((t_RegistrationRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.t_RegistrationRowDeleting != null)) {
                    this.t_RegistrationRowDeleting(this, new t_RegistrationRowChangeEvent(((t_RegistrationRow)(e.Row)), e.Action));
                }
            }
            
            public void Removet_RegistrationRow(t_RegistrationRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_RegistrationRow : DataRow {
            
            private t_RegistrationDataTable tablet_Registration;
            
            internal t_RegistrationRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tablet_Registration = ((t_RegistrationDataTable)(this.Table));
            }
            
            public long RegistrationID {
                get {
                    return ((long)(this[this.tablet_Registration.RegistrationIDColumn]));
                }
                set {
                    this[this.tablet_Registration.RegistrationIDColumn] = value;
                }
            }
            
            public int PatientID {
                get {
                    return ((int)(this[this.tablet_Registration.PatientIDColumn]));
                }
                set {
                    this[this.tablet_Registration.PatientIDColumn] = value;
                }
            }
            
            public short RegistrationTypeID {
                get {
                    return ((short)(this[this.tablet_Registration.RegistrationTypeIDColumn]));
                }
                set {
                    this[this.tablet_Registration.RegistrationTypeIDColumn] = value;
                }
            }
            
            public short DeparptmentID {
                get {
                    return ((short)(this[this.tablet_Registration.DeparptmentIDColumn]));
                }
                set {
                    this[this.tablet_Registration.DeparptmentIDColumn] = value;
                }
            }
            
            public System.DateTime RegisterDate {
                get {
                    try {
                        return ((System.DateTime)(this[this.tablet_Registration.RegisterDateColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_Registration.RegisterDateColumn] = value;
                }
            }
            
            public int RegistrarID {
                get {
                    return ((int)(this[this.tablet_Registration.RegistrarIDColumn]));
                }
                set {
                    this[this.tablet_Registration.RegistrarIDColumn] = value;
                }
            }
            
            public int DoctorID {
                get {
                    return ((int)(this[this.tablet_Registration.DoctorIDColumn]));
                }
                set {
                    this[this.tablet_Registration.DoctorIDColumn] = value;
                }
            }
            
            public System.DateTime SeeDoctorDate {
                get {
                    try {
                        return ((System.DateTime)(this[this.tablet_Registration.SeeDoctorDateColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_Registration.SeeDoctorDateColumn] = value;
                }
            }
            
            public System.Byte Status {
                get {
                    return ((System.Byte)(this[this.tablet_Registration.StatusColumn]));
                }
                set {
                    this[this.tablet_Registration.StatusColumn] = value;
                }
            }
            
            public string PatientName {
                get {
                    if (this.IsPatientNameNull()) {
                        return null;
                    }
                    else {
                        return ((string)(this[this.tablet_Registration.PatientNameColumn]));
                    }
                }
                set {
                    this[this.tablet_Registration.PatientNameColumn] = value;
                }
            }
            
            public string RegistrationTypeName {
                get {
                    if (this.IsRegistrationTypeNameNull()) {
                        return null;
                    }
                    else {
                        return ((string)(this[this.tablet_Registration.RegistrationTypeNameColumn]));
                    }
                }
                set {
                    this[this.tablet_Registration.RegistrationTypeNameColumn] = value;
                }
            }
            
            public string DepartmentName {
                get {
                    if (this.IsDepartmentNameNull()) {
                        return null;
                    }
                    else {
                        return ((string)(this[this.tablet_Registration.DepartmentNameColumn]));
                    }
                }
                set {
                    this[this.tablet_Registration.DepartmentNameColumn] = value;
                }
            }
            
            public string RegistrarName {
                get {
                    if (this.IsRegistrarNameNull()) {
                        return null;
                    }
                    else {
                        return ((string)(this[this.tablet_Registration.RegistrarNameColumn]));
                    }
                }
                set {
                    this[this.tablet_Registration.RegistrarNameColumn] = value;
                }
            }
            
            public string DoctorName {
                get {
                    if (this.IsDoctorNameNull()) {
                        return null;
                    }
                    else {
                        return ((string)(this[this.tablet_Registration.DoctorNameColumn]));
                    }
                }
                set {
                    this[this.tablet_Registration.DoctorNameColumn] = value;
                }
            }
            
            public bool IsRegisterDateNull() {
                return this.IsNull(this.tablet_Registration.RegisterDateColumn);
            }
            
            public void SetRegisterDateNull() {
                this[this.tablet_Registration.RegisterDateColumn] = System.Convert.DBNull;
            }
            
            public bool IsSeeDoctorDateNull() {
                return this.IsNull(this.tablet_Registration.SeeDoctorDateColumn);
            }
            
            public void SetSeeDoctorDateNull() {
                this[this.tablet_Registration.SeeDoctorDateColumn] = System.Convert.DBNull;
            }
            
            public bool IsPatientNameNull() {
                return this.IsNull(this.tablet_Registration.PatientNameColumn);
            }
            
            public void SetPatientNameNull() {
                this[this.tablet_Registration.PatientNameColumn] = System.Convert.DBNull;
            }
            
            public bool IsRegistrationTypeNameNull() {
                return this.IsNull(this.tablet_Registration.RegistrationTypeNameColumn);
            }
            
            public void SetRegistrationTypeNameNull() {
                this[this.tablet_Registration.RegistrationTypeNameColumn] = System.Convert.DBNull;
            }
            
            public bool IsDepartmentNameNull() {
                return this.IsNull(this.tablet_Registration.DepartmentNameColumn);
            }
            
            public void SetDepartmentNameNull() {
                this[this.tablet_Registration.DepartmentNameColumn] = System.Convert.DBNull;
            }
            
            public bool IsRegistrarNameNull() {
                return this.IsNull(this.tablet_Registration.RegistrarNameColumn);
            }
            
            public void SetRegistrarNameNull() {
                this[this.tablet_Registration.RegistrarNameColumn] = System.Convert.DBNull;
            }
            
            public bool IsDoctorNameNull() {
                return this.IsNull(this.tablet_Registration.DoctorNameColumn);
            }
            
            public void SetDoctorNameNull() {
                this[this.tablet_Registration.DoctorNameColumn] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_RegistrationRowChangeEvent : EventArgs {
            
            private t_RegistrationRow eventRow;
            
            private DataRowAction eventAction;
            
            public t_RegistrationRowChangeEvent(t_RegistrationRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public t_RegistrationRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}
