//------------------------------------------------------------------------------
// <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 CommonUsages : DataSet {
        
        private t_CommonUsageDataTable tablet_CommonUsage;
        
        public CommonUsages() {
            this.InitClass();
            System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            this.Tables.CollectionChanged += schemaChangedHandler;
            this.Relations.CollectionChanged += schemaChangedHandler;
        }
        
        protected CommonUsages(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_CommonUsage"] != null)) {
                    this.Tables.Add(new t_CommonUsageDataTable(ds.Tables["t_CommonUsage"]));
                }
                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_CommonUsageDataTable t_CommonUsage {
            get {
                return this.tablet_CommonUsage;
            }
        }
        
        public override DataSet Clone() {
            CommonUsages cln = ((CommonUsages)(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_CommonUsage"] != null)) {
                this.Tables.Add(new t_CommonUsageDataTable(ds.Tables["t_CommonUsage"]));
            }
            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_CommonUsage = ((t_CommonUsageDataTable)(this.Tables["t_CommonUsage"]));
            if ((this.tablet_CommonUsage != null)) {
                this.tablet_CommonUsage.InitVars();
            }
        }
        
        private void InitClass() {
            this.DataSetName = "CommonUsages";
            this.Prefix = "";
            this.Namespace = "http://tempuri.org/CommonUsages.xsd";
            this.Locale = new System.Globalization.CultureInfo("en-US");
            this.CaseSensitive = false;
            this.EnforceConstraints = true;
            this.tablet_CommonUsage = new t_CommonUsageDataTable();
            this.Tables.Add(this.tablet_CommonUsage);
        }
        
        private bool ShouldSerializet_CommonUsage() {
            return false;
        }
        
        private void SchemaChanged(object sender, System.ComponentModel.CollectionChangeEventArgs e) {
            if ((e.Action == System.ComponentModel.CollectionChangeAction.Remove)) {
                this.InitVars();
            }
        }
        
        public delegate void t_CommonUsageRowChangeEventHandler(object sender, t_CommonUsageRowChangeEvent e);
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_CommonUsageDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnCommonUsageID;
            
            private DataColumn columnName;
            
            internal t_CommonUsageDataTable() : 
                    base("t_CommonUsage") {
                this.InitClass();
            }
            
            internal t_CommonUsageDataTable(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 CommonUsageIDColumn {
                get {
                    return this.columnCommonUsageID;
                }
            }
            
            internal DataColumn NameColumn {
                get {
                    return this.columnName;
                }
            }
            
            public t_CommonUsageRow this[int index] {
                get {
                    return ((t_CommonUsageRow)(this.Rows[index]));
                }
            }
            
            public event t_CommonUsageRowChangeEventHandler t_CommonUsageRowChanged;
            
            public event t_CommonUsageRowChangeEventHandler t_CommonUsageRowChanging;
            
            public event t_CommonUsageRowChangeEventHandler t_CommonUsageRowDeleted;
            
            public event t_CommonUsageRowChangeEventHandler t_CommonUsageRowDeleting;
            
            public void Addt_CommonUsageRow(t_CommonUsageRow row) {
                this.Rows.Add(row);
            }
            
            public t_CommonUsageRow Addt_CommonUsageRow(string Name) {
                t_CommonUsageRow rowt_CommonUsageRow = ((t_CommonUsageRow)(this.NewRow()));
                rowt_CommonUsageRow.ItemArray = new object[] {
                        null,
                        Name};
                this.Rows.Add(rowt_CommonUsageRow);
                return rowt_CommonUsageRow;
            }
            
            public t_CommonUsageRow FindByCommonUsageID(short CommonUsageID) {
                return ((t_CommonUsageRow)(this.Rows.Find(new object[] {
                            CommonUsageID})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                t_CommonUsageDataTable cln = ((t_CommonUsageDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new t_CommonUsageDataTable();
            }
            
            internal void InitVars() {
                this.columnCommonUsageID = this.Columns["CommonUsageID"];
                this.columnName = this.Columns["Name"];
            }
            
            private void InitClass() {
                this.columnCommonUsageID = new DataColumn("CommonUsageID", typeof(short), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnCommonUsageID);
                this.columnName = new DataColumn("Name", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnName);
                this.Constraints.Add(new UniqueConstraint("CommonUsagesKey1", new DataColumn[] {
                                this.columnCommonUsageID}, true));
                this.columnCommonUsageID.AutoIncrement = true;
                this.columnCommonUsageID.AllowDBNull = false;
                this.columnCommonUsageID.ReadOnly = true;
                this.columnCommonUsageID.Unique = true;
                this.columnName.AllowDBNull = false;
            }
            
            public t_CommonUsageRow Newt_CommonUsageRow() {
                return ((t_CommonUsageRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new t_CommonUsageRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(t_CommonUsageRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.t_CommonUsageRowChanged != null)) {
                    this.t_CommonUsageRowChanged(this, new t_CommonUsageRowChangeEvent(((t_CommonUsageRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.t_CommonUsageRowChanging != null)) {
                    this.t_CommonUsageRowChanging(this, new t_CommonUsageRowChangeEvent(((t_CommonUsageRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.t_CommonUsageRowDeleted != null)) {
                    this.t_CommonUsageRowDeleted(this, new t_CommonUsageRowChangeEvent(((t_CommonUsageRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.t_CommonUsageRowDeleting != null)) {
                    this.t_CommonUsageRowDeleting(this, new t_CommonUsageRowChangeEvent(((t_CommonUsageRow)(e.Row)), e.Action));
                }
            }
            
            public void Removet_CommonUsageRow(t_CommonUsageRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_CommonUsageRow : DataRow {
            
            private t_CommonUsageDataTable tablet_CommonUsage;
            
            internal t_CommonUsageRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tablet_CommonUsage = ((t_CommonUsageDataTable)(this.Table));
            }
            
            public short CommonUsageID {
                get {
                    return ((short)(this[this.tablet_CommonUsage.CommonUsageIDColumn]));
                }
                set {
                    this[this.tablet_CommonUsage.CommonUsageIDColumn] = value;
                }
            }
            
            public string Name {
                get {
                    return ((string)(this[this.tablet_CommonUsage.NameColumn]));
                }
                set {
                    this[this.tablet_CommonUsage.NameColumn] = value;
                }
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_CommonUsageRowChangeEvent : EventArgs {
            
            private t_CommonUsageRow eventRow;
            
            private DataRowAction eventAction;
            
            public t_CommonUsageRowChangeEvent(t_CommonUsageRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public t_CommonUsageRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}
