//------------------------------------------------------------------------------
// <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 Prescriptions : DataSet {
        
        private t_PrescriptionDetailDataTable tablet_PrescriptionDetail;
        
        private t_PrescriptionMasterDataTable tablet_PrescriptionMaster;
        
        public Prescriptions() {
            this.InitClass();
            System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            this.Tables.CollectionChanged += schemaChangedHandler;
            this.Relations.CollectionChanged += schemaChangedHandler;
        }
        
        protected Prescriptions(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_PrescriptionDetail"] != null)) {
                    this.Tables.Add(new t_PrescriptionDetailDataTable(ds.Tables["t_PrescriptionDetail"]));
                }
                if ((ds.Tables["t_PrescriptionMaster"] != null)) {
                    this.Tables.Add(new t_PrescriptionMasterDataTable(ds.Tables["t_PrescriptionMaster"]));
                }
                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_PrescriptionDetailDataTable t_PrescriptionDetail {
            get {
                return this.tablet_PrescriptionDetail;
            }
        }
        
        [System.ComponentModel.Browsable(false)]
        [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)]
        public t_PrescriptionMasterDataTable t_PrescriptionMaster {
            get {
                return this.tablet_PrescriptionMaster;
            }
        }
        
        public override DataSet Clone() {
            Prescriptions cln = ((Prescriptions)(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_PrescriptionDetail"] != null)) {
                this.Tables.Add(new t_PrescriptionDetailDataTable(ds.Tables["t_PrescriptionDetail"]));
            }
            if ((ds.Tables["t_PrescriptionMaster"] != null)) {
                this.Tables.Add(new t_PrescriptionMasterDataTable(ds.Tables["t_PrescriptionMaster"]));
            }
            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_PrescriptionDetail = ((t_PrescriptionDetailDataTable)(this.Tables["t_PrescriptionDetail"]));
            if ((this.tablet_PrescriptionDetail != null)) {
                this.tablet_PrescriptionDetail.InitVars();
            }
            this.tablet_PrescriptionMaster = ((t_PrescriptionMasterDataTable)(this.Tables["t_PrescriptionMaster"]));
            if ((this.tablet_PrescriptionMaster != null)) {
                this.tablet_PrescriptionMaster.InitVars();
            }
        }
        
        private void InitClass() {
            this.DataSetName = "Prescriptions";
            this.Prefix = "";
            this.Namespace = "http://tempuri.org/Prescriptions.xsd";
            this.Locale = new System.Globalization.CultureInfo("en-US");
            this.CaseSensitive = false;
            this.EnforceConstraints = true;
            this.tablet_PrescriptionDetail = new t_PrescriptionDetailDataTable();
            this.Tables.Add(this.tablet_PrescriptionDetail);
            this.tablet_PrescriptionMaster = new t_PrescriptionMasterDataTable();
            this.Tables.Add(this.tablet_PrescriptionMaster);
        }
        
        private bool ShouldSerializet_PrescriptionDetail() {
            return false;
        }
        
        private bool ShouldSerializet_PrescriptionMaster() {
            return false;
        }
        
        private void SchemaChanged(object sender, System.ComponentModel.CollectionChangeEventArgs e) {
            if ((e.Action == System.ComponentModel.CollectionChangeAction.Remove)) {
                this.InitVars();
            }
        }
        
        public delegate void t_PrescriptionDetailRowChangeEventHandler(object sender, t_PrescriptionDetailRowChangeEvent e);
        
        public delegate void t_PrescriptionMasterRowChangeEventHandler(object sender, t_PrescriptionMasterRowChangeEvent e);
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_PrescriptionDetailDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnRxID;
            
            private DataColumn columnLineNumber;
            
            private DataColumn columnMedicineID;
            
            private DataColumn columnMedicineName;
            
            private DataColumn columnMedicineSpec;
            
            private DataColumn columnDailyTimes;
            
            private DataColumn columnDosageEverytime;
            
            private DataColumn columnUnitName;
            
            private DataColumn columnCommomUsage;
            
            private DataColumn columnQuantity;
            
            private DataColumn columnUnitPrice;
            
            private DataColumn columnSubTotal;
            
            internal t_PrescriptionDetailDataTable() : 
                    base("t_PrescriptionDetail") {
                this.InitClass();
            }
            
            internal t_PrescriptionDetailDataTable(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 RxIDColumn {
                get {
                    return this.columnRxID;
                }
            }
            
            internal DataColumn LineNumberColumn {
                get {
                    return this.columnLineNumber;
                }
            }
            
            internal DataColumn MedicineIDColumn {
                get {
                    return this.columnMedicineID;
                }
            }
            
            internal DataColumn MedicineNameColumn {
                get {
                    return this.columnMedicineName;
                }
            }
            
            internal DataColumn MedicineSpecColumn {
                get {
                    return this.columnMedicineSpec;
                }
            }
            
            internal DataColumn DailyTimesColumn {
                get {
                    return this.columnDailyTimes;
                }
            }
            
            internal DataColumn DosageEverytimeColumn {
                get {
                    return this.columnDosageEverytime;
                }
            }
            
            internal DataColumn UnitNameColumn {
                get {
                    return this.columnUnitName;
                }
            }
            
            internal DataColumn CommomUsageColumn {
                get {
                    return this.columnCommomUsage;
                }
            }
            
            internal DataColumn QuantityColumn {
                get {
                    return this.columnQuantity;
                }
            }
            
            internal DataColumn UnitPriceColumn {
                get {
                    return this.columnUnitPrice;
                }
            }
            
            internal DataColumn SubTotalColumn {
                get {
                    return this.columnSubTotal;
                }
            }
            
            public t_PrescriptionDetailRow this[int index] {
                get {
                    return ((t_PrescriptionDetailRow)(this.Rows[index]));
                }
            }
            
            public event t_PrescriptionDetailRowChangeEventHandler t_PrescriptionDetailRowChanged;
            
            public event t_PrescriptionDetailRowChangeEventHandler t_PrescriptionDetailRowChanging;
            
            public event t_PrescriptionDetailRowChangeEventHandler t_PrescriptionDetailRowDeleted;
            
            public event t_PrescriptionDetailRowChangeEventHandler t_PrescriptionDetailRowDeleting;
            
            public void Addt_PrescriptionDetailRow(t_PrescriptionDetailRow row) {
                this.Rows.Add(row);
            }
            
            public t_PrescriptionDetailRow Addt_PrescriptionDetailRow(long RxID, short LineNumber, int MedicineID, string MedicineName, string MedicineSpec, System.Byte DailyTimes, int DosageEverytime, string UnitName, string CommomUsage, int Quantity, System.Decimal UnitPrice, System.Decimal SubTotal) {
                t_PrescriptionDetailRow rowt_PrescriptionDetailRow = ((t_PrescriptionDetailRow)(this.NewRow()));
                rowt_PrescriptionDetailRow.ItemArray = new object[] {
                        RxID,
                        LineNumber,
                        MedicineID,
                        MedicineName,
                        MedicineSpec,
                        DailyTimes,
                        DosageEverytime,
                        UnitName,
                        CommomUsage,
                        Quantity,
                        UnitPrice,
                        SubTotal};
                this.Rows.Add(rowt_PrescriptionDetailRow);
                return rowt_PrescriptionDetailRow;
            }
            
            public t_PrescriptionDetailRow FindByRxIDLineNumber(long RxID, short LineNumber) {
                return ((t_PrescriptionDetailRow)(this.Rows.Find(new object[] {
                            RxID,
                            LineNumber})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                t_PrescriptionDetailDataTable cln = ((t_PrescriptionDetailDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new t_PrescriptionDetailDataTable();
            }
            
            internal void InitVars() {
                this.columnRxID = this.Columns["RxID"];
                this.columnLineNumber = this.Columns["LineNumber"];
                this.columnMedicineID = this.Columns["MedicineID"];
                this.columnMedicineName = this.Columns["MedicineName"];
                this.columnMedicineSpec = this.Columns["MedicineSpec"];
                this.columnDailyTimes = this.Columns["DailyTimes"];
                this.columnDosageEverytime = this.Columns["DosageEverytime"];
                this.columnUnitName = this.Columns["UnitName"];
                this.columnCommomUsage = this.Columns["CommomUsage"];
                this.columnQuantity = this.Columns["Quantity"];
                this.columnUnitPrice = this.Columns["UnitPrice"];
                this.columnSubTotal = this.Columns["SubTotal"];
            }
            
            private void InitClass() {
                this.columnRxID = new DataColumn("RxID", typeof(long), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnRxID);
                this.columnLineNumber = new DataColumn("LineNumber", typeof(short), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnLineNumber);
                this.columnMedicineID = new DataColumn("MedicineID", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnMedicineID);
                this.columnMedicineName = new DataColumn("MedicineName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnMedicineName);
                this.columnMedicineSpec = new DataColumn("MedicineSpec", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnMedicineSpec);
                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.columnUnitName = new DataColumn("UnitName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnUnitName);
                this.columnCommomUsage = new DataColumn("CommomUsage", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnCommomUsage);
                this.columnQuantity = new DataColumn("Quantity", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnQuantity);
                this.columnUnitPrice = new DataColumn("UnitPrice", typeof(System.Decimal), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnUnitPrice);
                this.columnSubTotal = new DataColumn("SubTotal", typeof(System.Decimal), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnSubTotal);
                this.Constraints.Add(new UniqueConstraint("PrescriptionsKey2", new DataColumn[] {
                                this.columnRxID,
                                this.columnLineNumber}, true));
                this.columnRxID.AllowDBNull = false;
                this.columnLineNumber.AllowDBNull = false;
                this.columnMedicineID.AllowDBNull = false;
                this.columnMedicineName.AllowDBNull = false;
                this.columnMedicineSpec.AllowDBNull = false;
                this.columnQuantity.AllowDBNull = false;
            }
            
            public t_PrescriptionDetailRow Newt_PrescriptionDetailRow() {
                return ((t_PrescriptionDetailRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new t_PrescriptionDetailRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(t_PrescriptionDetailRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.t_PrescriptionDetailRowChanged != null)) {
                    this.t_PrescriptionDetailRowChanged(this, new t_PrescriptionDetailRowChangeEvent(((t_PrescriptionDetailRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.t_PrescriptionDetailRowChanging != null)) {
                    this.t_PrescriptionDetailRowChanging(this, new t_PrescriptionDetailRowChangeEvent(((t_PrescriptionDetailRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.t_PrescriptionDetailRowDeleted != null)) {
                    this.t_PrescriptionDetailRowDeleted(this, new t_PrescriptionDetailRowChangeEvent(((t_PrescriptionDetailRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.t_PrescriptionDetailRowDeleting != null)) {
                    this.t_PrescriptionDetailRowDeleting(this, new t_PrescriptionDetailRowChangeEvent(((t_PrescriptionDetailRow)(e.Row)), e.Action));
                }
            }
            
            public void Removet_PrescriptionDetailRow(t_PrescriptionDetailRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_PrescriptionDetailRow : DataRow {
            
            private t_PrescriptionDetailDataTable tablet_PrescriptionDetail;
            
            internal t_PrescriptionDetailRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tablet_PrescriptionDetail = ((t_PrescriptionDetailDataTable)(this.Table));
            }
            
            public long RxID {
                get {
                    return ((long)(this[this.tablet_PrescriptionDetail.RxIDColumn]));
                }
                set {
                    this[this.tablet_PrescriptionDetail.RxIDColumn] = value;
                }
            }
            
            public short LineNumber {
                get {
                    return ((short)(this[this.tablet_PrescriptionDetail.LineNumberColumn]));
                }
                set {
                    this[this.tablet_PrescriptionDetail.LineNumberColumn] = value;
                }
            }
            
            public int MedicineID {
                get {
                    return ((int)(this[this.tablet_PrescriptionDetail.MedicineIDColumn]));
                }
                set {
                    this[this.tablet_PrescriptionDetail.MedicineIDColumn] = value;
                }
            }
            
            public string MedicineName {
                get {
                    return ((string)(this[this.tablet_PrescriptionDetail.MedicineNameColumn]));
                }
                set {
                    this[this.tablet_PrescriptionDetail.MedicineNameColumn] = value;
                }
            }
            
            public string MedicineSpec {
                get {
                    return ((string)(this[this.tablet_PrescriptionDetail.MedicineSpecColumn]));
                }
                set {
                    this[this.tablet_PrescriptionDetail.MedicineSpecColumn] = value;
                }
            }
            
            public System.Byte DailyTimes {
                get {
                    try {
                        return ((System.Byte)(this[this.tablet_PrescriptionDetail.DailyTimesColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_PrescriptionDetail.DailyTimesColumn] = value;
                }
            }
            
            public int DosageEverytime {
                get {
                    try {
                        return ((int)(this[this.tablet_PrescriptionDetail.DosageEverytimeColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_PrescriptionDetail.DosageEverytimeColumn] = value;
                }
            }
            
            public string UnitName {
                get {
                    try {
                        return ((string)(this[this.tablet_PrescriptionDetail.UnitNameColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_PrescriptionDetail.UnitNameColumn] = value;
                }
            }
            
            public string CommomUsage {
                get {
                    try {
                        return ((string)(this[this.tablet_PrescriptionDetail.CommomUsageColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_PrescriptionDetail.CommomUsageColumn] = value;
                }
            }
            
            public int Quantity {
                get {
                    return ((int)(this[this.tablet_PrescriptionDetail.QuantityColumn]));
                }
                set {
                    this[this.tablet_PrescriptionDetail.QuantityColumn] = value;
                }
            }
            
            public System.Decimal UnitPrice {
                get {
                    try {
                        return ((System.Decimal)(this[this.tablet_PrescriptionDetail.UnitPriceColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_PrescriptionDetail.UnitPriceColumn] = value;
                }
            }
            
            public System.Decimal SubTotal {
                get {
                    try {
                        return ((System.Decimal)(this[this.tablet_PrescriptionDetail.SubTotalColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_PrescriptionDetail.SubTotalColumn] = value;
                }
            }
            
            public bool IsDailyTimesNull() {
                return this.IsNull(this.tablet_PrescriptionDetail.DailyTimesColumn);
            }
            
            public void SetDailyTimesNull() {
                this[this.tablet_PrescriptionDetail.DailyTimesColumn] = System.Convert.DBNull;
            }
            
            public bool IsDosageEverytimeNull() {
                return this.IsNull(this.tablet_PrescriptionDetail.DosageEverytimeColumn);
            }
            
            public void SetDosageEverytimeNull() {
                this[this.tablet_PrescriptionDetail.DosageEverytimeColumn] = System.Convert.DBNull;
            }
            
            public bool IsUnitNameNull() {
                return this.IsNull(this.tablet_PrescriptionDetail.UnitNameColumn);
            }
            
            public void SetUnitNameNull() {
                this[this.tablet_PrescriptionDetail.UnitNameColumn] = System.Convert.DBNull;
            }
            
            public bool IsCommomUsageNull() {
                return this.IsNull(this.tablet_PrescriptionDetail.CommomUsageColumn);
            }
            
            public void SetCommomUsageNull() {
                this[this.tablet_PrescriptionDetail.CommomUsageColumn] = System.Convert.DBNull;
            }
            
            public bool IsUnitPriceNull() {
                return this.IsNull(this.tablet_PrescriptionDetail.UnitPriceColumn);
            }
            
            public void SetUnitPriceNull() {
                this[this.tablet_PrescriptionDetail.UnitPriceColumn] = System.Convert.DBNull;
            }
            
            public bool IsSubTotalNull() {
                return this.IsNull(this.tablet_PrescriptionDetail.SubTotalColumn);
            }
            
            public void SetSubTotalNull() {
                this[this.tablet_PrescriptionDetail.SubTotalColumn] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_PrescriptionDetailRowChangeEvent : EventArgs {
            
            private t_PrescriptionDetailRow eventRow;
            
            private DataRowAction eventAction;
            
            public t_PrescriptionDetailRowChangeEvent(t_PrescriptionDetailRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public t_PrescriptionDetailRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_PrescriptionMasterDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnRxID;
            
            private DataColumn columnPatientID;
            
            private DataColumn columnPatientName;
            
            private DataColumn columnFirstVisit;
            
            private DataColumn columnDepartmentID;
            
            private DataColumn columnDepartmentName;
            
            private DataColumn columnPrescriberID;
            
            private DataColumn columnPrescriberName;
            
            private DataColumn columnMakeDate;
            
            private DataColumn columnDiagnosis1ID;
            
            private DataColumn columnDiagnosis1Name;
            
            private DataColumn columnDiagnosis2ID;
            
            private DataColumn columnDiagnosis2Name;
            
            private DataColumn columnBillOfRxID;
            
            private DataColumn columnStatus;
            
            private DataColumn columnSumTotal;
            
            internal t_PrescriptionMasterDataTable() : 
                    base("t_PrescriptionMaster") {
                this.InitClass();
            }
            
            internal t_PrescriptionMasterDataTable(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 RxIDColumn {
                get {
                    return this.columnRxID;
                }
            }
            
            internal DataColumn PatientIDColumn {
                get {
                    return this.columnPatientID;
                }
            }
            
            internal DataColumn PatientNameColumn {
                get {
                    return this.columnPatientName;
                }
            }
            
            internal DataColumn FirstVisitColumn {
                get {
                    return this.columnFirstVisit;
                }
            }
            
            internal DataColumn DepartmentIDColumn {
                get {
                    return this.columnDepartmentID;
                }
            }
            
            internal DataColumn DepartmentNameColumn {
                get {
                    return this.columnDepartmentName;
                }
            }
            
            internal DataColumn PrescriberIDColumn {
                get {
                    return this.columnPrescriberID;
                }
            }
            
            internal DataColumn PrescriberNameColumn {
                get {
                    return this.columnPrescriberName;
                }
            }
            
            internal DataColumn MakeDateColumn {
                get {
                    return this.columnMakeDate;
                }
            }
            
            internal DataColumn Diagnosis1IDColumn {
                get {
                    return this.columnDiagnosis1ID;
                }
            }
            
            internal DataColumn Diagnosis1NameColumn {
                get {
                    return this.columnDiagnosis1Name;
                }
            }
            
            internal DataColumn Diagnosis2IDColumn {
                get {
                    return this.columnDiagnosis2ID;
                }
            }
            
            internal DataColumn Diagnosis2NameColumn {
                get {
                    return this.columnDiagnosis2Name;
                }
            }
            
            internal DataColumn BillOfRxIDColumn {
                get {
                    return this.columnBillOfRxID;
                }
            }
            
            internal DataColumn StatusColumn {
                get {
                    return this.columnStatus;
                }
            }
            
            internal DataColumn SumTotalColumn {
                get {
                    return this.columnSumTotal;
                }
            }
            
            public t_PrescriptionMasterRow this[int index] {
                get {
                    return ((t_PrescriptionMasterRow)(this.Rows[index]));
                }
            }
            
            public event t_PrescriptionMasterRowChangeEventHandler t_PrescriptionMasterRowChanged;
            
            public event t_PrescriptionMasterRowChangeEventHandler t_PrescriptionMasterRowChanging;
            
            public event t_PrescriptionMasterRowChangeEventHandler t_PrescriptionMasterRowDeleted;
            
            public event t_PrescriptionMasterRowChangeEventHandler t_PrescriptionMasterRowDeleting;
            
            public void Addt_PrescriptionMasterRow(t_PrescriptionMasterRow row) {
                this.Rows.Add(row);
            }
            
            public t_PrescriptionMasterRow Addt_PrescriptionMasterRow(int PatientID, string PatientName, bool FirstVisit, short DepartmentID, string DepartmentName, int PrescriberID, string PrescriberName, System.DateTime MakeDate, int Diagnosis1ID, string Diagnosis1Name, int Diagnosis2ID, string Diagnosis2Name, long BillOfRxID, short Status, System.Decimal SumTotal) {
                t_PrescriptionMasterRow rowt_PrescriptionMasterRow = ((t_PrescriptionMasterRow)(this.NewRow()));
                rowt_PrescriptionMasterRow.ItemArray = new object[] {
                        null,
                        PatientID,
                        PatientName,
                        FirstVisit,
                        DepartmentID,
                        DepartmentName,
                        PrescriberID,
                        PrescriberName,
                        MakeDate,
                        Diagnosis1ID,
                        Diagnosis1Name,
                        Diagnosis2ID,
                        Diagnosis2Name,
                        BillOfRxID,
                        Status,
                        SumTotal};
                this.Rows.Add(rowt_PrescriptionMasterRow);
                return rowt_PrescriptionMasterRow;
            }
            
            public t_PrescriptionMasterRow FindByRxID(long RxID) {
                return ((t_PrescriptionMasterRow)(this.Rows.Find(new object[] {
                            RxID})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                t_PrescriptionMasterDataTable cln = ((t_PrescriptionMasterDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new t_PrescriptionMasterDataTable();
            }
            
            internal void InitVars() {
                this.columnRxID = this.Columns["RxID"];
                this.columnPatientID = this.Columns["PatientID"];
                this.columnPatientName = this.Columns["PatientName"];
                this.columnFirstVisit = this.Columns["FirstVisit"];
                this.columnDepartmentID = this.Columns["DepartmentID"];
                this.columnDepartmentName = this.Columns["DepartmentName"];
                this.columnPrescriberID = this.Columns["PrescriberID"];
                this.columnPrescriberName = this.Columns["PrescriberName"];
                this.columnMakeDate = this.Columns["MakeDate"];
                this.columnDiagnosis1ID = this.Columns["Diagnosis1ID"];
                this.columnDiagnosis1Name = this.Columns["Diagnosis1Name"];
                this.columnDiagnosis2ID = this.Columns["Diagnosis2ID"];
                this.columnDiagnosis2Name = this.Columns["Diagnosis2Name"];
                this.columnBillOfRxID = this.Columns["BillOfRxID"];
                this.columnStatus = this.Columns["Status"];
                this.columnSumTotal = this.Columns["SumTotal"];
            }
            
            private void InitClass() {
                this.columnRxID = new DataColumn("RxID", typeof(long), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnRxID);
                this.columnPatientID = new DataColumn("PatientID", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnPatientID);
                this.columnPatientName = new DataColumn("PatientName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnPatientName);
                this.columnFirstVisit = new DataColumn("FirstVisit", typeof(bool), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnFirstVisit);
                this.columnDepartmentID = new DataColumn("DepartmentID", typeof(short), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDepartmentID);
                this.columnDepartmentName = new DataColumn("DepartmentName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDepartmentName);
                this.columnPrescriberID = new DataColumn("PrescriberID", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnPrescriberID);
                this.columnPrescriberName = new DataColumn("PrescriberName", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnPrescriberName);
                this.columnMakeDate = new DataColumn("MakeDate", typeof(System.DateTime), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnMakeDate);
                this.columnDiagnosis1ID = new DataColumn("Diagnosis1ID", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDiagnosis1ID);
                this.columnDiagnosis1Name = new DataColumn("Diagnosis1Name", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDiagnosis1Name);
                this.columnDiagnosis2ID = new DataColumn("Diagnosis2ID", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDiagnosis2ID);
                this.columnDiagnosis2Name = new DataColumn("Diagnosis2Name", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDiagnosis2Name);
                this.columnBillOfRxID = new DataColumn("BillOfRxID", typeof(long), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnBillOfRxID);
                this.columnStatus = new DataColumn("Status", typeof(short), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnStatus);
                this.columnSumTotal = new DataColumn("SumTotal", typeof(System.Decimal), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnSumTotal);
                this.Constraints.Add(new UniqueConstraint("PrescriptionsKey1", new DataColumn[] {
                                this.columnRxID}, true));
                this.columnRxID.AutoIncrement = true;
                this.columnRxID.AllowDBNull = false;
                this.columnRxID.ReadOnly = true;
                this.columnRxID.Unique = true;
                this.columnPatientID.AllowDBNull = false;
                this.columnPatientName.AllowDBNull = false;
                this.columnFirstVisit.AllowDBNull = false;
                this.columnDepartmentID.AllowDBNull = false;
                this.columnPrescriberID.AllowDBNull = false;
                this.columnPrescriberName.AllowDBNull = false;
                this.columnMakeDate.AllowDBNull = false;
                this.columnStatus.AllowDBNull = false;
            }
            
            public t_PrescriptionMasterRow Newt_PrescriptionMasterRow() {
                return ((t_PrescriptionMasterRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new t_PrescriptionMasterRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(t_PrescriptionMasterRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.t_PrescriptionMasterRowChanged != null)) {
                    this.t_PrescriptionMasterRowChanged(this, new t_PrescriptionMasterRowChangeEvent(((t_PrescriptionMasterRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.t_PrescriptionMasterRowChanging != null)) {
                    this.t_PrescriptionMasterRowChanging(this, new t_PrescriptionMasterRowChangeEvent(((t_PrescriptionMasterRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.t_PrescriptionMasterRowDeleted != null)) {
                    this.t_PrescriptionMasterRowDeleted(this, new t_PrescriptionMasterRowChangeEvent(((t_PrescriptionMasterRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.t_PrescriptionMasterRowDeleting != null)) {
                    this.t_PrescriptionMasterRowDeleting(this, new t_PrescriptionMasterRowChangeEvent(((t_PrescriptionMasterRow)(e.Row)), e.Action));
                }
            }
            
            public void Removet_PrescriptionMasterRow(t_PrescriptionMasterRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_PrescriptionMasterRow : DataRow {
            
            private t_PrescriptionMasterDataTable tablet_PrescriptionMaster;
            
            internal t_PrescriptionMasterRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tablet_PrescriptionMaster = ((t_PrescriptionMasterDataTable)(this.Table));
            }
            
            public long RxID {
                get {
                    return ((long)(this[this.tablet_PrescriptionMaster.RxIDColumn]));
                }
                set {
                    this[this.tablet_PrescriptionMaster.RxIDColumn] = value;
                }
            }
            
            public int PatientID {
                get {
                    return ((int)(this[this.tablet_PrescriptionMaster.PatientIDColumn]));
                }
                set {
                    this[this.tablet_PrescriptionMaster.PatientIDColumn] = value;
                }
            }
            
            public string PatientName {
                get {
                    return ((string)(this[this.tablet_PrescriptionMaster.PatientNameColumn]));
                }
                set {
                    this[this.tablet_PrescriptionMaster.PatientNameColumn] = value;
                }
            }
            
            public bool FirstVisit {
                get {
                    return ((bool)(this[this.tablet_PrescriptionMaster.FirstVisitColumn]));
                }
                set {
                    this[this.tablet_PrescriptionMaster.FirstVisitColumn] = value;
                }
            }
            
            public short DepartmentID {
                get {
                    return ((short)(this[this.tablet_PrescriptionMaster.DepartmentIDColumn]));
                }
                set {
                    this[this.tablet_PrescriptionMaster.DepartmentIDColumn] = value;
                }
            }
            
            public string DepartmentName {
                get {
                    try {
                        return ((string)(this[this.tablet_PrescriptionMaster.DepartmentNameColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_PrescriptionMaster.DepartmentNameColumn] = value;
                }
            }
            
            public int PrescriberID {
                get {
                    return ((int)(this[this.tablet_PrescriptionMaster.PrescriberIDColumn]));
                }
                set {
                    this[this.tablet_PrescriptionMaster.PrescriberIDColumn] = value;
                }
            }
            
            public string PrescriberName {
                get {
                    return ((string)(this[this.tablet_PrescriptionMaster.PrescriberNameColumn]));
                }
                set {
                    this[this.tablet_PrescriptionMaster.PrescriberNameColumn] = value;
                }
            }
            
            public System.DateTime MakeDate {
                get {
                    return ((System.DateTime)(this[this.tablet_PrescriptionMaster.MakeDateColumn]));
                }
                set {
                    this[this.tablet_PrescriptionMaster.MakeDateColumn] = value;
                }
            }
            
            public int Diagnosis1ID {
                get {
                    try {
                        return ((int)(this[this.tablet_PrescriptionMaster.Diagnosis1IDColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_PrescriptionMaster.Diagnosis1IDColumn] = value;
                }
            }
            
            public string Diagnosis1Name {
                get {
                    try {
                        return ((string)(this[this.tablet_PrescriptionMaster.Diagnosis1NameColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_PrescriptionMaster.Diagnosis1NameColumn] = value;
                }
            }
            
            public int Diagnosis2ID {
                get {
                    try {
                        return ((int)(this[this.tablet_PrescriptionMaster.Diagnosis2IDColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_PrescriptionMaster.Diagnosis2IDColumn] = value;
                }
            }
            
            public string Diagnosis2Name {
                get {
                    try {
                        return ((string)(this[this.tablet_PrescriptionMaster.Diagnosis2NameColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_PrescriptionMaster.Diagnosis2NameColumn] = value;
                }
            }
            
            public long BillOfRxID {
                get {
                    try {
                        return ((long)(this[this.tablet_PrescriptionMaster.BillOfRxIDColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_PrescriptionMaster.BillOfRxIDColumn] = value;
                }
            }
            
            public short Status {
                get {
                    return ((short)(this[this.tablet_PrescriptionMaster.StatusColumn]));
                }
                set {
                    this[this.tablet_PrescriptionMaster.StatusColumn] = value;
                }
            }
            
            public System.Decimal SumTotal {
                get {
                    try {
                        return ((System.Decimal)(this[this.tablet_PrescriptionMaster.SumTotalColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值，因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablet_PrescriptionMaster.SumTotalColumn] = value;
                }
            }
            
            public bool IsDepartmentNameNull() {
                return this.IsNull(this.tablet_PrescriptionMaster.DepartmentNameColumn);
            }
            
            public void SetDepartmentNameNull() {
                this[this.tablet_PrescriptionMaster.DepartmentNameColumn] = System.Convert.DBNull;
            }
            
            public bool IsDiagnosis1IDNull() {
                return this.IsNull(this.tablet_PrescriptionMaster.Diagnosis1IDColumn);
            }
            
            public void SetDiagnosis1IDNull() {
                this[this.tablet_PrescriptionMaster.Diagnosis1IDColumn] = System.Convert.DBNull;
            }
            
            public bool IsDiagnosis1NameNull() {
                return this.IsNull(this.tablet_PrescriptionMaster.Diagnosis1NameColumn);
            }
            
            public void SetDiagnosis1NameNull() {
                this[this.tablet_PrescriptionMaster.Diagnosis1NameColumn] = System.Convert.DBNull;
            }
            
            public bool IsDiagnosis2IDNull() {
                return this.IsNull(this.tablet_PrescriptionMaster.Diagnosis2IDColumn);
            }
            
            public void SetDiagnosis2IDNull() {
                this[this.tablet_PrescriptionMaster.Diagnosis2IDColumn] = System.Convert.DBNull;
            }
            
            public bool IsDiagnosis2NameNull() {
                return this.IsNull(this.tablet_PrescriptionMaster.Diagnosis2NameColumn);
            }
            
            public void SetDiagnosis2NameNull() {
                this[this.tablet_PrescriptionMaster.Diagnosis2NameColumn] = System.Convert.DBNull;
            }
            
            public bool IsBillOfRxIDNull() {
                return this.IsNull(this.tablet_PrescriptionMaster.BillOfRxIDColumn);
            }
            
            public void SetBillOfRxIDNull() {
                this[this.tablet_PrescriptionMaster.BillOfRxIDColumn] = System.Convert.DBNull;
            }
            
            public bool IsSumTotalNull() {
                return this.IsNull(this.tablet_PrescriptionMaster.SumTotalColumn);
            }
            
            public void SetSumTotalNull() {
                this[this.tablet_PrescriptionMaster.SumTotalColumn] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class t_PrescriptionMasterRowChangeEvent : EventArgs {
            
            private t_PrescriptionMasterRow eventRow;
            
            private DataRowAction eventAction;
            
            public t_PrescriptionMasterRowChangeEvent(t_PrescriptionMasterRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public t_PrescriptionMasterRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}
