//------------------------------------------------------------------------------
// <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 Departments : DataSet {
        
        private t_DepartmentDataTable tablet_Department;
        
        public Departments() {
            this.InitClass();
            System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            this.Tables.CollectionChanged += schemaChangedHandler;
            this.Relations.CollectionChanged += schemaChangedHandler;
        }
        
        protected Departments(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_Department"] != null)) {
                    this.Tables.Add(new t_DepartmentDataTable(ds.Tables["t_Department"]));
                }
                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_DepartmentDataTable t_Department {
            get {
                return this.tablet_Department;
            }
        }
        
        public override DataSet Clone() {
            Departments cln = ((Departments)(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_Department"] != null)) {
                this.Tables.Add(new t_DepartmentDataTable(ds.Tables["t_Department"]));
            }
            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_Department = ((t_DepartmentDataTable)(this.Tables["t_Department"]));
            if ((this.tablet_Department != null)) {
                this.tablet_Department.InitVars();
            }
        }
        
        private void InitClass() {
            this.DataSetName = "Departments";
            this.Prefix = "";
            this.Namespace = "http://tempuri.org/Departments.xsd";
            this.Locale = new System.Globalization.CultureInfo("en-US");
            this.CaseSensitive = false;
            this.EnforceConstraints = true;
            this.tablet_Department = new t_DepartmentDataTable();
            this.Tables.Add(this.tablet_Department);
        }
        
        private bool ShouldSerializet_Department() {
            return false;
        }
        
        private void SchemaChanged(object sender, System.ComponentModel.CollectionChangeEventArgs e) {
            if ((e.Action == System.ComponentModel.CollectionChangeAction.Remove)) {
                this.InitVars();
            }
        }
        
        public delegate void t_DepartmentRowChangeEventHandler(object sender, t_DepartmentRowChangeEvent e);
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_DepartmentDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnDepartmentID;
            
            private DataColumn columnName;
            
            internal t_DepartmentDataTable() : 
                    base("t_Department") {
                this.InitClass();
            }
            
            internal t_DepartmentDataTable(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 DepartmentIDColumn {
                get {
                    return this.columnDepartmentID;
                }
            }
            
            internal DataColumn NameColumn {
                get {
                    return this.columnName;
                }
            }
            
            public t_DepartmentRow this[int index] {
                get {
                    return ((t_DepartmentRow)(this.Rows[index]));
                }
            }
            
            public event t_DepartmentRowChangeEventHandler t_DepartmentRowChanged;
            
            public event t_DepartmentRowChangeEventHandler t_DepartmentRowChanging;
            
            public event t_DepartmentRowChangeEventHandler t_DepartmentRowDeleted;
            
            public event t_DepartmentRowChangeEventHandler t_DepartmentRowDeleting;
            
            public void Addt_DepartmentRow(t_DepartmentRow row) {
                this.Rows.Add(row);
            }
            
            public t_DepartmentRow Addt_DepartmentRow(string Name) {
                t_DepartmentRow rowt_DepartmentRow = ((t_DepartmentRow)(this.NewRow()));
                rowt_DepartmentRow.ItemArray = new object[] {
                        null,
                        Name};
                this.Rows.Add(rowt_DepartmentRow);
                return rowt_DepartmentRow;
            }
            
            public t_DepartmentRow FindByDepartmentID(short DepartmentID) {
                return ((t_DepartmentRow)(this.Rows.Find(new object[] {
                            DepartmentID})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                t_DepartmentDataTable cln = ((t_DepartmentDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new t_DepartmentDataTable();
            }
            
            internal void InitVars() {
                this.columnDepartmentID = this.Columns["DepartmentID"];
                this.columnName = this.Columns["Name"];
            }
            
            private void InitClass() {
                this.columnDepartmentID = new DataColumn("DepartmentID", typeof(short), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDepartmentID);
                this.columnName = new DataColumn("Name", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnName);
                this.Constraints.Add(new UniqueConstraint("DepartmentsKey1", new DataColumn[] {
                                this.columnDepartmentID}, true));
                this.columnDepartmentID.AutoIncrement = true;
                this.columnDepartmentID.AllowDBNull = false;
                this.columnDepartmentID.ReadOnly = true;
                this.columnDepartmentID.Unique = true;
                this.columnName.AllowDBNull = false;
            }
            
            public t_DepartmentRow Newt_DepartmentRow() {
                return ((t_DepartmentRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new t_DepartmentRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(t_DepartmentRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.t_DepartmentRowChanged != null)) {
                    this.t_DepartmentRowChanged(this, new t_DepartmentRowChangeEvent(((t_DepartmentRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.t_DepartmentRowChanging != null)) {
                    this.t_DepartmentRowChanging(this, new t_DepartmentRowChangeEvent(((t_DepartmentRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.t_DepartmentRowDeleted != null)) {
                    this.t_DepartmentRowDeleted(this, new t_DepartmentRowChangeEvent(((t_DepartmentRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.t_DepartmentRowDeleting != null)) {
                    this.t_DepartmentRowDeleting(this, new t_DepartmentRowChangeEvent(((t_DepartmentRow)(e.Row)), e.Action));
                }
            }
            
            public void Removet_DepartmentRow(t_DepartmentRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_DepartmentRow : DataRow {
            
            private t_DepartmentDataTable tablet_Department;
            
            internal t_DepartmentRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tablet_Department = ((t_DepartmentDataTable)(this.Table));
            }
            
            public short DepartmentID {
                get {
                    return ((short)(this[this.tablet_Department.DepartmentIDColumn]));
                }
                set {
                    this[this.tablet_Department.DepartmentIDColumn] = value;
                }
            }
            
            public string Name {
                get {
                    return ((string)(this[this.tablet_Department.NameColumn]));
                }
                set {
                    this[this.tablet_Department.NameColumn] = value;
                }
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_DepartmentRowChangeEvent : EventArgs {
            
            private t_DepartmentRow eventRow;
            
            private DataRowAction eventAction;
            
            public t_DepartmentRowChangeEvent(t_DepartmentRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public t_DepartmentRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}
