⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 product.cs

📁 C#高级编程第四版 第十九章源代码 敬请下载
💻 CS
📖 第 1 页 / 共 4 页
字号:
            }
        }
        
        [System.ComponentModel.Browsable(false)]
        public int Count {
            get {
                return this.Rows.Count;
            }
        }
        
        public ProductRow this[int index] {
            get {
                return ((ProductRow)(this.Rows[index]));
            }
        }
        
        public bool SuspendValidation {
            get {
                return this.m_suspendValidation;
            }
            set {
                this.m_suspendValidation = value;
            }
        }
        
        public event ProductIDChangeEventHandler ProductIDChanging;
        
        public event ProductIDChangeEventHandler ProductIDChanged;
        
        public event ProductNameChangeEventHandler ProductNameChanging;
        
        public event ProductNameChangeEventHandler ProductNameChanged;
        
        public event SupplierIDChangeEventHandler SupplierIDChanging;
        
        public event SupplierIDChangeEventHandler SupplierIDChanged;
        
        public event CategoryIDChangeEventHandler CategoryIDChanging;
        
        public event CategoryIDChangeEventHandler CategoryIDChanged;
        
        public event QuantityPerUnitChangeEventHandler QuantityPerUnitChanging;
        
        public event QuantityPerUnitChangeEventHandler QuantityPerUnitChanged;
        
        public event UnitPriceChangeEventHandler UnitPriceChanging;
        
        public event UnitPriceChangeEventHandler UnitPriceChanged;
        
        public event UnitsInStockChangeEventHandler UnitsInStockChanging;
        
        public event UnitsInStockChangeEventHandler UnitsInStockChanged;
        
        public event UnitsOnOrderChangeEventHandler UnitsOnOrderChanging;
        
        public event UnitsOnOrderChangeEventHandler UnitsOnOrderChanged;
        
        public event ReorderLevelChangeEventHandler ReorderLevelChanging;
        
        public event ReorderLevelChangeEventHandler ReorderLevelChanged;
        
        public event DiscontinuedChangeEventHandler DiscontinuedChanging;
        
        public event DiscontinuedChangeEventHandler DiscontinuedChanged;
        
        public event ProductRowChangeEventHandler ProductRowChanged;
        
        public event ProductRowChangeEventHandler ProductRowChanging;
        
        public event ProductRowChangeEventHandler ProductRowDeleted;
        
        public event ProductRowChangeEventHandler ProductRowDeleting;
        
        protected override void OnColumnChanging(System.Data.DataColumnChangeEventArgs e) {
            base.OnColumnChanging(e);
            if ((this.SuspendValidation == true)) {
                return;
            }
            if ((e.Column.ColumnName == "ProductID")) {
                if ((this.ProductIDChanging != null)) {
                    this.ProductIDChanging(this, new ProductIDChangeEventArg(e));
                }
            }
            else {
                if ((e.Column.ColumnName == "ProductName")) {
                    if ((this.ProductNameChanging != null)) {
                        this.ProductNameChanging(this, new ProductNameChangeEventArg(e));
                    }
                }
                else {
                    if ((e.Column.ColumnName == "SupplierID")) {
                        if ((this.SupplierIDChanging != null)) {
                            this.SupplierIDChanging(this, new SupplierIDChangeEventArg(e));
                        }
                    }
                    else {
                        if ((e.Column.ColumnName == "CategoryID")) {
                            if ((this.CategoryIDChanging != null)) {
                                this.CategoryIDChanging(this, new CategoryIDChangeEventArg(e));
                            }
                        }
                        else {
                            if ((e.Column.ColumnName == "QuantityPerUnit")) {
                                if ((this.QuantityPerUnitChanging != null)) {
                                    this.QuantityPerUnitChanging(this, new QuantityPerUnitChangeEventArg(e));
                                }
                            }
                            else {
                                if ((e.Column.ColumnName == "UnitPrice")) {
                                    if ((this.UnitPriceChanging != null)) {
                                        this.UnitPriceChanging(this, new UnitPriceChangeEventArg(e));
                                    }
                                }
                                else {
                                    if ((e.Column.ColumnName == "UnitsInStock")) {
                                        if ((this.UnitsInStockChanging != null)) {
                                            this.UnitsInStockChanging(this, new UnitsInStockChangeEventArg(e));
                                        }
                                    }
                                    else {
                                        if ((e.Column.ColumnName == "UnitsOnOrder")) {
                                            if ((this.UnitsOnOrderChanging != null)) {
                                                this.UnitsOnOrderChanging(this, new UnitsOnOrderChangeEventArg(e));
                                            }
                                        }
                                        else {
                                            if ((e.Column.ColumnName == "ReorderLevel")) {
                                                if ((this.ReorderLevelChanging != null)) {
                                                    this.ReorderLevelChanging(this, new ReorderLevelChangeEventArg(e));
                                                }
                                            }
                                            else {
                                                if ((e.Column.ColumnName == "Discontinued")) {
                                                    if ((this.DiscontinuedChanging != null)) {
                                                        this.DiscontinuedChanging(this, new DiscontinuedChangeEventArg(e));
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        
        protected override void OnColumnChanged(System.Data.DataColumnChangeEventArgs e) {
            base.OnColumnChanged(e);
            if ((this.SuspendValidation == true)) {
                return;
            }
            if ((e.Column.ColumnName == "ProductID")) {
                if ((this.ProductIDChanged != null)) {
                    this.ProductIDChanged(this, new ProductIDChangeEventArg(e));
                }
            }
            else {
                if ((e.Column.ColumnName == "ProductName")) {
                    if ((this.ProductNameChanged != null)) {
                        this.ProductNameChanged(this, new ProductNameChangeEventArg(e));
                    }
                }
                else {
                    if ((e.Column.ColumnName == "SupplierID")) {
                        if ((this.SupplierIDChanged != null)) {
                            this.SupplierIDChanged(this, new SupplierIDChangeEventArg(e));
                        }
                    }
                    else {
                        if ((e.Column.ColumnName == "CategoryID")) {
                            if ((this.CategoryIDChanged != null)) {
                                this.CategoryIDChanged(this, new CategoryIDChangeEventArg(e));
                            }
                        }
                        else {
                            if ((e.Column.ColumnName == "QuantityPerUnit")) {
                                if ((this.QuantityPerUnitChanged != null)) {
                                    this.QuantityPerUnitChanged(this, new QuantityPerUnitChangeEventArg(e));
                                }
                            }
                            else {
                                if ((e.Column.ColumnName == "UnitPrice")) {
                                    if ((this.UnitPriceChanged != null)) {
                                        this.UnitPriceChanged(this, new UnitPriceChangeEventArg(e));
                                    }
                                }
                                else {
                                    if ((e.Column.ColumnName == "UnitsInStock")) {
                                        if ((this.UnitsInStockChanged != null)) {
                                            this.UnitsInStockChanged(this, new UnitsInStockChangeEventArg(e));
                                        }
                                    }
                                    else {
                                        if ((e.Column.ColumnName == "UnitsOnOrder")) {
                                            if ((this.UnitsOnOrderChanged != null)) {
                                                this.UnitsOnOrderChanged(this, new UnitsOnOrderChangeEventArg(e));
                                            }
                                        }
                                        else {
                                            if ((e.Column.ColumnName == "ReorderLevel")) {
                                                if ((this.ReorderLevelChanged != null)) {
                                                    this.ReorderLevelChanged(this, new ReorderLevelChangeEventArg(e));
                                                }
                                            }
                                            else {
                                                if ((e.Column.ColumnName == "Discontinued")) {
                                                    if ((this.DiscontinuedChanged != null)) {
                                                        this.DiscontinuedChanged(this, new DiscontinuedChangeEventArg(e));
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        
        public void AddProductRow(ProductRow row) {
            this.Rows.Add(row);
        }
        
        public ProductRow AddProductRow(string ProductName, int SupplierID, int CategoryID, string QuantityPerUnit, System.Decimal UnitPrice, short UnitsInStock, short UnitsOnOrder, short ReorderLevel, bool Discontinued) {
            ProductRow rowProductRow = ((ProductRow)(this.NewRow()));
            rowProductRow.ItemArray = new object[] {
                    null,
                    ProductName,
                    SupplierID,
                    CategoryID,
                    QuantityPerUnit,
                    UnitPrice,
                    UnitsInStock,
                    UnitsOnOrder,
                    ReorderLevel,
                    Discontinued};
            this.Rows.Add(rowProductRow);
            return rowProductRow;
        }
        
        public System.Collections.IEnumerator GetEnumerator() {
            return this.Rows.GetEnumerator();
        }
        
        public override System.Data.DataTable Clone() {
            ProductDataTable cln = ((ProductDataTable)(base.Clone()));
            cln.InitVars();
            return cln;
        }
        
        protected override System.Data.DataTable CreateInstance() {
            return new ProductDataTable();
        }
        
        internal void InitVars() {
            this.columnProductID = base.Columns["ProductID"];
            this.columnProductName = base.Columns["ProductName"];
            this.columnSupplierID = base.Columns["SupplierID"];
            this.columnCategoryID = base.Columns["CategoryID"];
            this.columnQuantityPerUnit = base.Columns["QuantityPerUnit"];
            this.columnUnitPrice = base.Columns["UnitPrice"];
            this.columnUnitsInStock = base.Columns["UnitsInStock"];
            this.columnUnitsOnOrder = base.Columns["UnitsOnOrder"];
            this.columnReorderLevel = base.Columns["ReorderLevel"];
            this.columnDiscontinued = base.Columns["Discontinued"];
        }
        
        private void InitClass() {
            this.columnProductID = new System.Data.DataColumn("ProductID", typeof(int), null, System.Data.MappingType.Element);
            this.columnProductID.ExtendedProperties.Add("Generator_ChangedEventName", "ProductIDChanged");
            this.columnProductID.ExtendedProperties.Add("Generator_ChangingEventName", "ProductIDChanging");
            this.columnProductID.ExtendedProperties.Add("Generator_ColumnPropNameInRow", "ProductID");
            this.columnProductID.ExtendedProperties.Add("Generator_ColumnPropNameInTable", "ProductIDColumn");
            this.columnProductID.ExtendedProperties.Add("Generator_ColumnVarNameInTable", "columnProductID");
            this.columnProductID.ExtendedProperties.Add("Generator_DelegateName", "ProductIDChangeEventHandler");
            this.columnProductID.ExtendedProperties.Add("Generator_EventArgName", "ProductIDChangeEventArg");
            base.Columns.Add(this.columnProductID);
            this.columnProductName = new System.Data.DataColumn("ProductName", typeof(string), null, System.Data.MappingType.Element);
            this.columnProductName.ExtendedProperties.Add("Generator_ChangedEventName", "ProductNameChanged");
            this.columnProductName.ExtendedProperties.Add("Generator_ChangingEventName", "ProductNameChanging");
            this.columnProductName.ExtendedProperties.Add("Generator_ColumnPropNameInRow", "ProductName");
            this.columnProductName.ExtendedProperties.Add("Generator_ColumnPropNameInTable", "ProductNameColumn");
            this.columnProductName.ExtendedProperties.Add("Generator_ColumnVarNameInTable", "columnProductName");
            this.columnProductName.ExtendedProperties.Add("Generator_DelegateName", "ProductNameChangeEventHandler");
            this.columnProductName.ExtendedProperties.Add("Generator_EventArgName", "ProductNameChangeEventArg");
            base.Columns.Add(this.columnProductName);
            this.columnSupplierID = new System.Data.DataColumn("SupplierID", typeof(int), null, System.Data.MappingType.Element);
            this.columnSupplierID.ExtendedProperties.Add("Generator_ChangedEventName", "SupplierIDChanged");
            this.columnSupplierID.ExtendedProperties.Add("Generator_ChangingEventName", "SupplierIDChanging");
            this.columnSupplierID.ExtendedProperties.Add("Generator_ColumnPropNameInRow", "SupplierID");
            this.columnSupplierID.ExtendedProperties.Add("Generator_ColumnPropNameInTable", "SupplierIDColumn");
            this.columnSupplierID.ExtendedProperties.Add("Generator_ColumnVarNameInTable", "columnSupplierID");
            this.columnSupplierID.ExtendedProperties.Add("Generator_DelegateName", "SupplierIDChangeEventHandler");
            this.columnSupplierID.ExtendedProperties.Add("Generator_EventArgName", "SupplierIDChangeEventArg");
            base.Columns.Add(this.columnSupplierID);
            this.columnCategoryID = new System.Data.DataColumn("CategoryID", typeof(int), null, System.Data.MappingType.Element);
            this.columnCategoryID.ExtendedProperties.Add("Generator_ChangedEventName", "CategoryIDChanged");
            this.columnCategoryID.ExtendedProperties.Add("Generator_ChangingEventName", "CategoryIDChanging");
            this.columnCategoryID.ExtendedProperties.Add("Generator_ColumnPropNameInRow", "CategoryID");
            this.columnCategoryID.ExtendedProperties.Add("Generator_ColumnPropNameInTable", "CategoryIDColumn");
            this.columnCategoryID.ExtendedProperties.Add("Generator_ColumnVarNameInTable", "columnCategoryID");
            this.columnCategoryID.ExtendedProperties.Add("Generator_DelegateName", "CategoryIDChangeEventHandler");
            this.columnCategoryID.ExtendedProperties.Add("Generator_EventArgName", "CategoryIDChangeEventArg");
            base.Columns.Add(this.columnCategoryID);
            this.columnQuantityPerUnit = new System.Data.DataColumn("QuantityPerUnit", typeof(string), null, System.Data.MappingType.Element);
            this.columnQuantityPerUnit.ExtendedProperties.Add("Generator_ChangedEventName", "QuantityPerUnitChanged");
            this.columnQuantityPerUnit.ExtendedProperties.Add("Generator_ChangingEventName", "QuantityPerUnitChanging");
            this.columnQuantityPerUnit.ExtendedProperties.Add("Generator_ColumnPropNameInRow", "QuantityPerUnit");
            this.columnQuantityPerUnit.ExtendedProperties.Add("Generator_ColumnPropNameInTable", "QuantityPerUnitColumn");
            this.columnQuantityPerUnit.ExtendedProperties.Add("Generator_ColumnVarNameInTable", "columnQuantityPerUnit");
            this.columnQuantityPerUnit.ExtendedProperties.Add("Generator_DelegateName", "QuantityPerUnitChangeEventHandler");
            this.columnQuantityPerUnit.ExtendedProperties.Add("Generator_EventArgName", "QuantityPerUnitChangeEventArg");
            base.Columns.Add(this.columnQuantityPerUnit);
            this.columnUnitPrice = new System.Data.DataColumn("UnitPrice", typeof(System.Decimal), null, System.Data.MappingType.Element);
            this.columnUnitPrice.ExtendedProperties.Add("Generator_ChangedEventName", "UnitPriceChanged");
            this.columnUnitPrice.ExtendedProperties.Add("Generator_ChangingEventName", "UnitPriceChanging");
            this.columnUnitPrice.ExtendedProperties.Add("Generator_ColumnPropNameInRow", "UnitPrice");
            this.columnUnitPrice.ExtendedProperties.Add("Generator_ColumnPropNameInTable", "UnitPriceColumn");
            this.columnUnitPrice.ExtendedProperties.Add("Generator_ColumnVarNameInTable", "columnUnitPrice");
            this.columnUnitPrice.ExtendedProperties.Add("Generator_DelegateName", "UnitPriceChangeEventHandler");
            this.columnUnitPrice.ExtendedProperties.Add("Generator_EventArgName", "UnitPriceChangeEventArg");
            base.Columns.Add(this.columnUnitPrice);
            this.columnUnitsInStock = new System.Data.DataColumn("UnitsInStock", typeof(short), null, System.Data.MappingType.Element);
            this.columnUnitsInStock.ExtendedProperties.Add("Generator_ChangedEventName", "UnitsInStockChanged");
            this.columnUnitsInStock.ExtendedProperties.Add("Generator_ChangingEventName", "UnitsInStockChanging");
            this.columnUnitsInStock.ExtendedProperties.Add("Generator_ColumnPropNameInRow", "UnitsInStock");
            this.columnUnitsInStock.ExtendedProperties.Add("Generator_ColumnPropNameInTable", "UnitsInStockColumn");
            this.columnUnitsInStock.ExtendedProperties.Add("Generator_ColumnVarNameInTable", "columnUnitsInStock");
            this.columnUnitsInStock.ExtendedProperties.Add("Generator_DelegateName", "UnitsInStockChangeEventHandler");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -