//------------------------------------------------------------------------------
// <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 Medicines : DataSet {
        
        private t_MedicineDataTable tablet_Medicine;
        
        public Medicines() {
            this.InitClass();
            System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            this.Tables.CollectionChanged += schemaChangedHandler;
            this.Relations.CollectionChanged += schemaChangedHandler;
        }
        
        protected Medicines(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_Medicine"] != null)) {
                    this.Tables.Add(new t_MedicineDataTable(ds.Tables["t_Medicine"]));
                }
                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_MedicineDataTable t_Medicine {
            get {
                return this.tablet_Medicine;
            }
        }
        
        public override DataSet Clone() {
            Medicines cln = ((Medicines)(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_Medicine"] != null)) {
                this.Tables.Add(new t_MedicineDataTable(ds.Tables["t_Medicine"]));
            }
            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_Medicine = ((t_MedicineDataTable)(this.Tables["t_Medicine"]));
            if ((this.tablet_Medicine != null)) {
                this.tablet_Medicine.InitVars();
            }
        }
        
        private void InitClass() {
            this.DataSetName = "Medicines";
            this.Prefix = "";
            this.Namespace = "http://tempuri.org/Medicines.xsd";
            this.Locale = new System.Globalization.CultureInfo("en-US");
            this.CaseSensitive = false;
            this.EnforceConstraints = true;
            this.tablet_Medicine = new t_MedicineDataTable();
            this.Tables.Add(this.tablet_Medicine);
        }
        
        private bool ShouldSerializet_Medicine() {
            return false;
        }
        
        private void SchemaChanged(object sender, System.ComponentModel.CollectionChangeEventArgs e) {
            if ((e.Action == System.ComponentModel.CollectionChangeAction.Remove)) {
                this.InitVars();
            }
        }
        
        public delegate void t_MedicineRowChangeEventHandler(object sender, t_MedicineRowChangeEvent e);
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_MedicineDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnMedicineID;
            
            private DataColumn columnName;
            
            private DataColumn columnBopomofo;
            
            private DataColumn columnSpec;
            
            private DataColumn columnMedicineCategoryID;
            
            private DataColumn columnDailyTimes;
            
            private DataColumn columnDosageEverytime;
            
            private DataColumn columnUnitMeasureID;
            
            private DataColumn columnCommonUsageID;
            
            private DataColumn columnUnitPrice;
            
            private DataColumn columnMedicineCategoryName;
            
            private DataColumn columnUnitName;
            
            private DataColumn columnCommonUsageName;
            
            private DataColumn columnCommonUseQuantity;
            
            internal t_MedicineDataTable() : 
                    base("t_Medicine") {
                this.InitClass();
            }
            
            internal t_MedicineDataTable(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 MedicineIDColumn {
                get {
                    return this.columnMedicineID;
                }
            }
            
            internal DataColumn NameColumn {
                get {
                    return this.columnName;
                }
            }
            
            internal DataColumn BopomofoColumn {
                get {
                    return this.columnBopomofo;
                }
            }
            
            internal DataColumn SpecColumn {
                get {
                    return this.columnSpec;
                }
            }
            
            internal DataColumn MedicineCategoryIDColumn {
                get {
                    return this.columnMedicineCategoryID;
                }
            }
            
            internal DataColumn DailyTimesColumn {
                get {
                    return this.columnDailyTimes;
                }
            }
            
            internal DataColumn DosageEverytimeColumn {
                get {
                    return this.columnDosageEverytime;
                }
            }
            
            internal DataColumn UnitMeasureIDColumn {
                get {
                    return this.columnUnitMeasureID;
                }
            }
            
            internal DataColumn CommonUsageIDColumn {
                get {
                    return this.columnCommonUsageID;
                }
            }
            
            internal DataColumn UnitPriceColumn {
                get {
                    return this.columnUnitPrice;
                }
            }
            
            internal DataColumn MedicineCategoryNameColumn {
                get {
                    return this.columnMedicineCategoryName;
                }
            }
            
            internal DataColumn UnitNameColumn {
                get {
                    return this.columnUnitName;
                }
            }
            
            internal DataColumn CommonUsageNameColumn {
                get {
                    return this.columnCommonUsageName;
                }
            }
            
            internal DataColumn CommonUseQuantityColumn {
                get {
                    return this.columnCommonUseQuantity;
                }
            }
            
            public t_MedicineRow this[int index] {
                get {
                    return ((t_MedicineRow)(this.Rows[index]));
                }
            }
            
            public event t_MedicineRowChangeEventHandler t_MedicineRowChanged;
            
            public event t_MedicineRowChangeEventHandler t_MedicineRowChanging;
            
            public event t_MedicineRowChangeEventHandler t_MedicineRowDeleted;
            
            public event t_MedicineRowChangeEventHandler t_MedicineRowDeleting;
            
            public void Addt_MedicineRow(t_MedicineRow row) {
                this.Rows.Add(row);
            }
            
            public t_MedicineRow Addt_MedicineRow(string Name, string Bopomofo, string Spec, short MedicineCategoryID, System.Byte DailyTimes, int DosageEverytime, short UnitMeasureID, short CommonUsageID, System.Decimal UnitPrice, string MedicineCategoryName, string UnitName, string CommonUsageName, int CommonUseQuantity) {
                t_MedicineRow rowt_MedicineRow = ((t_MedicineRow)(this.NewRow()));
                rowt_MedicineRow.ItemArray = new object[] {
                        null,
                        Name,
                        Bopomofo,
                        Spec,
                        MedicineCategoryID,
                        DailyTimes,
                        DosageEverytime,
                        UnitMeasureID,
                        CommonUsageID,
                        UnitPrice,
                        MedicineCategoryName,
                        UnitName,
                        CommonUsageName,
                        CommonUseQuantity};
                this.Rows.Add(rowt_MedicineRow);
                return rowt_MedicineRow;
            }
            
            public t_MedicineRow FindByMedicineID(int MedicineID) {
                return ((t_MedicineRow)(this.Rows.Find(new object[] {
                            MedicineID})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                t_MedicineDataTable cln = ((t_MedicineDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new t_MedicineDataTable();
            }
            
            internal void InitVars() {
                this.columnMedicineID = this.Columns["MedicineID"];
                this.columnName = this.Columns["Name"];
                this.columnBopomofo = this.Columns["Bopomofo"];
                this.columnSpec = this.Columns["Spec"];
                this.columnMedicineCategoryID = this.Columns["MedicineCategoryID"];
                this.columnDailyTimes = this.Columns["DailyTimes"];
                this.columnDosageEverytime = this.Columns["DosageEverytime"];
                this.columnUnitMeasureID = this.Columns["UnitMeasureID"];
                this.columnCommonUsageID = this.Columns["CommonUsageID"];
                this.columnUnitPrice = this.Columns["UnitPrice"];
                this.columnMedicineCategoryName = this.Columns["MedicineCategoryName"];
                this.columnUnitName = this.Columns["UnitName"];
                this.columnCommonUsageName = this.Columns["CommonUsageName"];
                this.columnCommonUseQuantity = this.Columns["CommonUseQuantity"];
            }
            
            private void InitClass() {
                this.columnMedicineID = new DataColumn("MedicineID", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnMedicineID);
                this.columnName = new DataColumn("Name", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnName);
                this.columnBopomofo = new DataColumn("Bopomofo", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnBopomofo);
                this.columnSpec = new DataColumn("Spec", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnSpec);
                this.columnMedicineCategoryID = new DataColumn("MedicineCategoryID", typeof(short), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnMedicineCategoryID);
                this.columnDailyTimes = new DataColumn("DailyTimes", typeof(System.Byte), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDailyTimes);
                this.columnDosageEverytime = new DataColumn("DosageEverytime", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDosageEverytime);
                this.columnUnitMeasureID = new DataColumn("UnitMeasureID", typeof(short), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnUnitMeasureID);
                this.columnCommonUsageID = new DataColumn("CommonUsageID", typeof(short), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnCommonUsageID);
                this.columnUnitPrice = new DataColumn("UnitPrice", typeof(System.Decimal), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnUnitPrice);
                this.columnMedicineCategoryName = new DataColumn("MedicineCategoryName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnMedicineCategoryName);
                this.columnUnitName = new DataColumn("UnitName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnUnitName);
                this.columnCommonUsageName = new DataColumn("CommonUsageName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnCommonUsageName);
                this.columnCommonUseQuantity = new DataColumn("CommonUseQuantity", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnCommonUseQuantity);
                this.Constraints.Add(new UniqueConstraint("MedicinesKey1", new DataColumn[] {
                                this.columnMedicineID}, true));
                this.columnMedicineID.AutoIncrement = true;
                this.columnMedicineID.AllowDBNull = false;
                this.columnMedicineID.ReadOnly = true;
                this.columnMedicineID.Unique = true;
                this.columnName.AllowDBNull = false;
                this.columnMedicineCategoryID.AllowDBNull = false;
                this.columnDailyTimes.AllowDBNull = false;
                this.columnDosageEverytime.AllowDBNull = false;
                this.columnUnitPrice.AllowDBNull = false;
            }
            
            public t_MedicineRow Newt_MedicineRow() {
                return ((t_MedicineRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new t_MedicineRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(t_MedicineRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.t_MedicineRowChanged != null)) {
                    this.t_MedicineRowChanged(this, new t_MedicineRowChangeEvent(((t_MedicineRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.t_MedicineRowChanging != null)) {
                    this.t_MedicineRowChanging(this, new t_MedicineRowChangeEvent(((t_MedicineRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.t_MedicineRowDeleted != null)) {
                    this.t_MedicineRowDeleted(this, new t_MedicineRowChangeEvent(((t_MedicineRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.t_MedicineRowDeleting != null)) {
                    this.t_MedicineRowDeleting(this, new t_MedicineRowChangeEvent(((t_MedicineRow)(e.Row)), e.Action));
                }
            }
            
            public void Removet_MedicineRow(t_MedicineRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_MedicineRow : DataRow {
            
            private t_MedicineDataTable tablet_Medicine;
            
            internal t_MedicineRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tablet_Medicine = ((t_MedicineDataTable)(this.Table));
            }
            
            public int MedicineID {
                get {
                    return ((int)(this[this.tablet_Medicine.MedicineIDColumn]));
                }
                set {
                    this[this.tablet_Medicine.MedicineIDColumn] = value;
                }
            }
            
            public string Name {
                get {
                    return ((string)(this[this.tablet_Medicine.NameColumn]));
                }
                set {
                    this[this.tablet_Medicine.NameColumn] = value;
                }
            }
            
            public string Bopomofo {
                get {
                    try {
                        return ((string)(this[this.tablet_Medicine.BopomofoColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_Medicine.BopomofoColumn] = value;
                }
            }
            
            public string Spec {
                get {
                    try {
                        return ((string)(this[this.tablet_Medicine.SpecColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_Medicine.SpecColumn] = value;
                }
            }
            
            public short MedicineCategoryID {
                get {
                    return ((short)(this[this.tablet_Medicine.MedicineCategoryIDColumn]));
                }
                set {
                    this[this.tablet_Medicine.MedicineCategoryIDColumn] = value;
                }
            }
            
            public System.Byte DailyTimes {
                get {
                    return ((System.Byte)(this[this.tablet_Medicine.DailyTimesColumn]));
                }
                set {
                    this[this.tablet_Medicine.DailyTimesColumn] = value;
                }
            }
            
            public int DosageEverytime {
                get {
                    return ((int)(this[this.tablet_Medicine.DosageEverytimeColumn]));
                }
                set {
                    this[this.tablet_Medicine.DosageEverytimeColumn] = value;
                }
            }
            
            public short UnitMeasureID {
                get {
                    try {
                        return ((short)(this[this.tablet_Medicine.UnitMeasureIDColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_Medicine.UnitMeasureIDColumn] = value;
                }
            }
            
            public short CommonUsageID {
                get {
                    try {
                        return ((short)(this[this.tablet_Medicine.CommonUsageIDColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_Medicine.CommonUsageIDColumn] = value;
                }
            }
            
            public System.Decimal UnitPrice {
                get {
                    return ((System.Decimal)(this[this.tablet_Medicine.UnitPriceColumn]));
                }
                set {
                    this[this.tablet_Medicine.UnitPriceColumn] = value;
                }
            }
            
            public string MedicineCategoryName {
                get {
                    try {
                        return ((string)(this[this.tablet_Medicine.MedicineCategoryNameColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_Medicine.MedicineCategoryNameColumn] = value;
                }
            }
            
            public string UnitName {
                get {
                    try {
                        return ((string)(this[this.tablet_Medicine.UnitNameColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_Medicine.UnitNameColumn] = value;
                }
            }
            
            public string CommonUsageName {
                get {
                    try {
                        return ((string)(this[this.tablet_Medicine.CommonUsageNameColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_Medicine.CommonUsageNameColumn] = value;
                }
            }
            
            public int CommonUseQuantity {
                get {
                    try {
                        return ((int)(this[this.tablet_Medicine.CommonUseQuantityColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_Medicine.CommonUseQuantityColumn] = value;
                }
            }
            
            public bool IsBopomofoNull() {
                return this.IsNull(this.tablet_Medicine.BopomofoColumn);
            }
            
            public void SetBopomofoNull() {
                this[this.tablet_Medicine.BopomofoColumn] = System.Convert.DBNull;
            }
            
            public bool IsSpecNull() {
                return this.IsNull(this.tablet_Medicine.SpecColumn);
            }
            
            public void SetSpecNull() {
                this[this.tablet_Medicine.SpecColumn] = System.Convert.DBNull;
            }
            
            public bool IsUnitMeasureIDNull() {
                return this.IsNull(this.tablet_Medicine.UnitMeasureIDColumn);
            }
            
            public void SetUnitMeasureIDNull() {
                this[this.tablet_Medicine.UnitMeasureIDColumn] = System.Convert.DBNull;
            }
            
            public bool IsCommonUsageIDNull() {
                return this.IsNull(this.tablet_Medicine.CommonUsageIDColumn);
            }
            
            public void SetCommonUsageIDNull() {
                this[this.tablet_Medicine.CommonUsageIDColumn] = System.Convert.DBNull;
            }
            
            public bool IsMedicineCategoryNameNull() {
                return this.IsNull(this.tablet_Medicine.MedicineCategoryNameColumn);
            }
            
            public void SetMedicineCategoryNameNull() {
                this[this.tablet_Medicine.MedicineCategoryNameColumn] = System.Convert.DBNull;
            }
            
            public bool IsUnitNameNull() {
                return this.IsNull(this.tablet_Medicine.UnitNameColumn);
            }
            
            public void SetUnitNameNull() {
                this[this.tablet_Medicine.UnitNameColumn] = System.Convert.DBNull;
            }
            
            public bool IsCommonUsageNameNull() {
                return this.IsNull(this.tablet_Medicine.CommonUsageNameColumn);
            }
            
            public void SetCommonUsageNameNull() {
                this[this.tablet_Medicine.CommonUsageNameColumn] = System.Convert.DBNull;
            }
            
            public bool IsCommonUseQuantityNull() {
                return this.IsNull(this.tablet_Medicine.CommonUseQuantityColumn);
            }
            
            public void SetCommonUseQuantityNull() {
                this[this.tablet_Medicine.CommonUseQuantityColumn] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_MedicineRowChangeEvent : EventArgs {
            
            private t_MedicineRow eventRow;
            
            private DataRowAction eventAction;
            
            public t_MedicineRowChangeEvent(t_MedicineRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public t_MedicineRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}
