//------------------------------------------------------------------------------
// <autogenerated>
//     This code was generated by a tool.
//     Runtime Version: 1.0.2914.16
//
//     Changes to this file may cause incorrect behavior and will be lost if 
//     the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------

namespace Chapter30 {
    using System;
    using System.Data;
    using System.Xml;
    using System.Runtime.Serialization;
    
    
    [Serializable()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public class dsStock : System.Data.DataSet {
        
        private stock_masterDataTable tablestock_master;
        
        public dsStock() {
            this.InitClass();
        }
        
        private dsStock(SerializationInfo info, StreamingContext context) {
            this.InitClass();
            this.GetSerializationData(info, context);
        }
        
        [System.ComponentModel.Browsable(false)]
        [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)]
        public stock_masterDataTable stock_master {
            get {
                return this.tablestock_master;
            }
        }
        
        protected override bool ShouldSerializeTables() {
            return false;
        }
        
        protected override bool ShouldSerializeRelations() {
            return false;
        }
        
        protected override void ReadXmlSerializable(XmlReader reader) {
            this.ReadXml(reader, XmlReadMode.IgnoreSchema);
        }
        
        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);
        }
        
        private void InitClass() {
            this.DataSetName = "dsStock";
            this.Namespace = "http://www.tempuri.org/dsStock.xsd";
            this.tablestock_master = new stock_masterDataTable();
            this.Tables.Add(this.tablestock_master);
        }
        
        private bool ShouldSerializestock_master() {
            return false;
        }
        
        public delegate void stock_masterRowChangeEventHandler(object sender, stock_masterRowChangeEvent e);
        
        public class stock_masterDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columncode_value;
            
            private DataColumn columncode_display;
            
            private DataColumn columnrate;
            
            private DataColumn columnuom;
            
            private DataColumn columnclosing;
            
            private DataColumn columnopening;
            
            internal stock_masterDataTable() : 
                    base("stock_master") {
                this.InitClass();
            }
            
            [System.ComponentModel.Browsable(false)]
            public int Count {
                get {
                    return this.Rows.Count;
                }
            }
            
            internal DataColumn code_valueColumn {
                get {
                    return this.columncode_value;
                }
            }
            
            internal DataColumn code_displayColumn {
                get {
                    return this.columncode_display;
                }
            }
            
            internal DataColumn rateColumn {
                get {
                    return this.columnrate;
                }
            }
            
            internal DataColumn uomColumn {
                get {
                    return this.columnuom;
                }
            }
            
            internal DataColumn closingColumn {
                get {
                    return this.columnclosing;
                }
            }
            
            internal DataColumn openingColumn {
                get {
                    return this.columnopening;
                }
            }
            
            public stock_masterRow this[int index] {
                get {
                    return ((stock_masterRow)(this.Rows[index]));
                }
            }
            
            public event stock_masterRowChangeEventHandler stock_masterRowChanged;
            
            public event stock_masterRowChangeEventHandler stock_masterRowChanging;
            
            public event stock_masterRowChangeEventHandler stock_masterRowDeleted;
            
            public event stock_masterRowChangeEventHandler stock_masterRowDeleting;
            
            public void Addstock_masterRow(stock_masterRow row) {
                this.Rows.Add(row);
            }
            
            public stock_masterRow Addstock_masterRow(string code_display, System.Decimal rate, string uom, System.Decimal closing, System.Decimal opening) {
                stock_masterRow rowstock_masterRow = ((stock_masterRow)(this.NewRow()));
                rowstock_masterRow.ItemArray = new object[] {
                        null,
                        code_display,
                        rate,
                        uom,
                        closing,
                        opening};
                this.Rows.Add(rowstock_masterRow);
                return rowstock_masterRow;
            }
            
            public stock_masterRow FindBycode_value(int code_value) {
                return ((stock_masterRow)(this.Rows.Find(new object[] {
                            code_value})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            private void InitClass() {
                this.columncode_value = new DataColumn("code_value", typeof(int), "", System.Data.MappingType.Element);
                this.columncode_value.AutoIncrement = true;
                this.columncode_value.AllowDBNull = false;
                this.columncode_value.ReadOnly = true;
                this.columncode_value.Unique = true;
                this.Columns.Add(this.columncode_value);
                this.columncode_display = new DataColumn("code_display", typeof(string), "", System.Data.MappingType.Element);
                this.columncode_display.AllowDBNull = false;
                this.Columns.Add(this.columncode_display);
                this.columnrate = new DataColumn("rate", typeof(System.Decimal), "", System.Data.MappingType.Element);
                this.Columns.Add(this.columnrate);
                this.columnuom = new DataColumn("uom", typeof(string), "", System.Data.MappingType.Element);
                this.Columns.Add(this.columnuom);
                this.columnclosing = new DataColumn("closing", typeof(System.Decimal), "", System.Data.MappingType.Element);
                this.Columns.Add(this.columnclosing);
                this.columnopening = new DataColumn("opening", typeof(System.Decimal), "", System.Data.MappingType.Element);
                this.Columns.Add(this.columnopening);
                this.PrimaryKey = new DataColumn[] {
                        this.columncode_value};
            }
            
            public stock_masterRow Newstock_masterRow() {
                return ((stock_masterRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                // We need to ensure that all Rows in the tabled are typed rows.
                // Table calls newRow whenever it needs to create a row.
                // So the following conditions are covered by Row newRow(Record record)
                // * Cursor calls table.addRecord(record) 
                // * table.addRow(object[] values) calls newRow(record)    
                return new stock_masterRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(stock_masterRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.stock_masterRowChanged != null)) {
                    this.stock_masterRowChanged(this, new stock_masterRowChangeEvent(((stock_masterRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.stock_masterRowChanging != null)) {
                    this.stock_masterRowChanging(this, new stock_masterRowChangeEvent(((stock_masterRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.stock_masterRowDeleted != null)) {
                    this.stock_masterRowDeleted(this, new stock_masterRowChangeEvent(((stock_masterRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.stock_masterRowDeleting != null)) {
                    this.stock_masterRowDeleting(this, new stock_masterRowChangeEvent(((stock_masterRow)(e.Row)), e.Action));
                }
            }
            
            public void Removestock_masterRow(stock_masterRow row) {
                this.Rows.Remove(row);
            }
        }
        
        public class stock_masterRow : DataRow {
            
            private stock_masterDataTable tablestock_master;
            
            internal stock_masterRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tablestock_master = ((stock_masterDataTable)(this.Table));
            }
            
            public int code_value {
                get {
                    return ((int)(this[this.tablestock_master.code_valueColumn]));
                }
                set {
                    this[this.tablestock_master.code_valueColumn] = value;
                }
            }
            
            public string code_display {
                get {
                    return ((string)(this[this.tablestock_master.code_displayColumn]));
                }
                set {
                    this[this.tablestock_master.code_displayColumn] = value;
                }
            }
            
            public System.Decimal rate {
                get {
                    try {
                        return ((System.Decimal)(this[this.tablestock_master.rateColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tablestock_master.rateColumn] = value;
                }
            }
            
            public string uom {
                get {
                    try {
                        return ((string)(this[this.tablestock_master.uomColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tablestock_master.uomColumn] = value;
                }
            }
            
            public System.Decimal closing {
                get {
                    try {
                        return ((System.Decimal)(this[this.tablestock_master.closingColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tablestock_master.closingColumn] = value;
                }
            }
            
            public System.Decimal opening {
                get {
                    try {
                        return ((System.Decimal)(this[this.tablestock_master.openingColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tablestock_master.openingColumn] = value;
                }
            }
            
            public bool IsrateNull() {
                return this.IsNull(this.tablestock_master.rateColumn);
            }
            
            public void SetrateNull() {
                this[this.tablestock_master.rateColumn] = System.Convert.DBNull;
            }
            
            public bool IsuomNull() {
                return this.IsNull(this.tablestock_master.uomColumn);
            }
            
            public void SetuomNull() {
                this[this.tablestock_master.uomColumn] = System.Convert.DBNull;
            }
            
            public bool IsclosingNull() {
                return this.IsNull(this.tablestock_master.closingColumn);
            }
            
            public void SetclosingNull() {
                this[this.tablestock_master.closingColumn] = System.Convert.DBNull;
            }
            
            public bool IsopeningNull() {
                return this.IsNull(this.tablestock_master.openingColumn);
            }
            
            public void SetopeningNull() {
                this[this.tablestock_master.openingColumn] = System.Convert.DBNull;
            }
        }
        
        public class stock_masterRowChangeEvent : EventArgs {
            
            private stock_masterRow eventRow;
            
            private System.Data.DataRowAction eventAction;
            
            public stock_masterRowChangeEvent(stock_masterRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public stock_masterRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}
