//------------------------------------------------------------------------------
// <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 Users : DataSet {
        
        private t_UserDataTable tablet_User;
        
        public Users() {
            this.InitClass();
            System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            this.Tables.CollectionChanged += schemaChangedHandler;
            this.Relations.CollectionChanged += schemaChangedHandler;
        }
        
        protected Users(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_User"] != null)) {
                    this.Tables.Add(new t_UserDataTable(ds.Tables["t_User"]));
                }
                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_UserDataTable t_User {
            get {
                return this.tablet_User;
            }
        }
        
        public override DataSet Clone() {
            Users cln = ((Users)(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_User"] != null)) {
                this.Tables.Add(new t_UserDataTable(ds.Tables["t_User"]));
            }
            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_User = ((t_UserDataTable)(this.Tables["t_User"]));
            if ((this.tablet_User != null)) {
                this.tablet_User.InitVars();
            }
        }
        
        private void InitClass() {
            this.DataSetName = "Users";
            this.Prefix = "";
            this.Namespace = "http://tempuri.org/Users.xsd";
            this.Locale = new System.Globalization.CultureInfo("en-US");
            this.CaseSensitive = false;
            this.EnforceConstraints = true;
            this.tablet_User = new t_UserDataTable();
            this.Tables.Add(this.tablet_User);
        }
        
        private bool ShouldSerializet_User() {
            return false;
        }
        
        private void SchemaChanged(object sender, System.ComponentModel.CollectionChangeEventArgs e) {
            if ((e.Action == System.ComponentModel.CollectionChangeAction.Remove)) {
                this.InitVars();
            }
        }
        
        public delegate void t_UserRowChangeEventHandler(object sender, t_UserRowChangeEvent e);
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_UserDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnUserID;
            
            private DataColumn columnName;
            
            private DataColumn columnDepartmentID;
            
            private DataColumn columnRoleID;
            
            private DataColumn columnDepartmentName;
            
            private DataColumn columnRoleName;
            
            internal t_UserDataTable() : 
                    base("t_User") {
                this.InitClass();
            }
            
            internal t_UserDataTable(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 DepartmentIDColumn {
                get {
                    return this.columnDepartmentID;
                }
            }
            
            internal DataColumn RoleIDColumn {
                get {
                    return this.columnRoleID;
                }
            }
            
            internal DataColumn DepartmentNameColumn {
                get {
                    return this.columnDepartmentName;
                }
            }
            
            internal DataColumn RoleNameColumn {
                get {
                    return this.columnRoleName;
                }
            }
            
            public t_UserRow this[int index] {
                get {
                    return ((t_UserRow)(this.Rows[index]));
                }
            }
            
            public event t_UserRowChangeEventHandler t_UserRowChanged;
            
            public event t_UserRowChangeEventHandler t_UserRowChanging;
            
            public event t_UserRowChangeEventHandler t_UserRowDeleted;
            
            public event t_UserRowChangeEventHandler t_UserRowDeleting;
            
            public void Addt_UserRow(t_UserRow row) {
                this.Rows.Add(row);
            }
            
            public t_UserRow Addt_UserRow(string Name, short DepartmentID, short RoleID, string DepartmentName, string RoleName) {
                t_UserRow rowt_UserRow = ((t_UserRow)(this.NewRow()));
                rowt_UserRow.ItemArray = new object[] {
                        null,
                        Name,
                        DepartmentID,
                        RoleID,
                        DepartmentName,
                        RoleName};
                this.Rows.Add(rowt_UserRow);
                return rowt_UserRow;
            }
            
            public t_UserRow FindByUserID(int UserID) {
                return ((t_UserRow)(this.Rows.Find(new object[] {
                            UserID})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                t_UserDataTable cln = ((t_UserDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new t_UserDataTable();
            }
            
            internal void InitVars() {
                this.columnUserID = this.Columns["UserID"];
                this.columnName = this.Columns["Name"];
                this.columnDepartmentID = this.Columns["DepartmentID"];
                this.columnRoleID = this.Columns["RoleID"];
                this.columnDepartmentName = this.Columns["DepartmentName"];
                this.columnRoleName = this.Columns["RoleName"];
            }
            
            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.columnDepartmentID = new DataColumn("DepartmentID", typeof(short), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDepartmentID);
                this.columnRoleID = new DataColumn("RoleID", typeof(short), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnRoleID);
                this.columnDepartmentName = new DataColumn("DepartmentName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDepartmentName);
                this.columnRoleName = new DataColumn("RoleName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnRoleName);
                this.Constraints.Add(new UniqueConstraint("UsersKey1", 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;
            }
            
            public t_UserRow Newt_UserRow() {
                return ((t_UserRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new t_UserRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(t_UserRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.t_UserRowChanged != null)) {
                    this.t_UserRowChanged(this, new t_UserRowChangeEvent(((t_UserRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.t_UserRowChanging != null)) {
                    this.t_UserRowChanging(this, new t_UserRowChangeEvent(((t_UserRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.t_UserRowDeleted != null)) {
                    this.t_UserRowDeleted(this, new t_UserRowChangeEvent(((t_UserRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.t_UserRowDeleting != null)) {
                    this.t_UserRowDeleting(this, new t_UserRowChangeEvent(((t_UserRow)(e.Row)), e.Action));
                }
            }
            
            public void Removet_UserRow(t_UserRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_UserRow : DataRow {
            
            private t_UserDataTable tablet_User;
            
            internal t_UserRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tablet_User = ((t_UserDataTable)(this.Table));
            }
            
            public int UserID {
                get {
                    return ((int)(this[this.tablet_User.UserIDColumn]));
                }
                set {
                    this[this.tablet_User.UserIDColumn] = value;
                }
            }
            
            public string Name {
                get {
                    return ((string)(this[this.tablet_User.NameColumn]));
                }
                set {
                    this[this.tablet_User.NameColumn] = value;
                }
            }
            
            public short DepartmentID {
                get {
                    try {
                        return ((short)(this[this.tablet_User.DepartmentIDColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_User.DepartmentIDColumn] = value;
                }
            }
            
            public short RoleID {
                get {
                    try {
                        return ((short)(this[this.tablet_User.RoleIDColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_User.RoleIDColumn] = value;
                }
            }
            
            public string DepartmentName {
                get {
                    try {
                        return ((string)(this[this.tablet_User.DepartmentNameColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_User.DepartmentNameColumn] = value;
                }
            }
            
            public string RoleName {
                get {
                    try {
                        return ((string)(this[this.tablet_User.RoleNameColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_User.RoleNameColumn] = value;
                }
            }
            
            public bool IsDepartmentIDNull() {
                return this.IsNull(this.tablet_User.DepartmentIDColumn);
            }
            
            public void SetDepartmentIDNull() {
                this[this.tablet_User.DepartmentIDColumn] = System.Convert.DBNull;
            }
            
            public bool IsRoleIDNull() {
                return this.IsNull(this.tablet_User.RoleIDColumn);
            }
            
            public void SetRoleIDNull() {
                this[this.tablet_User.RoleIDColumn] = System.Convert.DBNull;
            }
            
            public bool IsDepartmentNameNull() {
                return this.IsNull(this.tablet_User.DepartmentNameColumn);
            }
            
            public void SetDepartmentNameNull() {
                this[this.tablet_User.DepartmentNameColumn] = System.Convert.DBNull;
            }
            
            public bool IsRoleNameNull() {
                return this.IsNull(this.tablet_User.RoleNameColumn);
            }
            
            public void SetRoleNameNull() {
                this[this.tablet_User.RoleNameColumn] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_UserRowChangeEvent : EventArgs {
            
            private t_UserRow eventRow;
            
            private DataRowAction eventAction;
            
            public t_UserRowChangeEvent(t_UserRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public t_UserRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}
