📄 dataset1.cs
字号:
rowProductsRow.ItemArray = new object[] {
null,
ProductName,
UnitPrice,
UnitsInStock,
SupplierID};
this.Rows.Add(rowProductsRow);
return rowProductsRow;
}
public ProductsRow FindByProductID(int ProductID) {
return ((ProductsRow)(this.Rows.Find(new object[] {
ProductID})));
}
public System.Collections.IEnumerator GetEnumerator() {
return this.Rows.GetEnumerator();
}
public override DataTable Clone() {
ProductsDataTable cln = ((ProductsDataTable)(base.Clone()));
cln.InitVars();
return cln;
}
protected override DataTable CreateInstance() {
return new ProductsDataTable();
}
internal void InitVars() {
this.columnProductID = this.Columns["ProductID"];
this.columnProductName = this.Columns["ProductName"];
this.columnUnitPrice = this.Columns["UnitPrice"];
this.columnUnitsInStock = this.Columns["UnitsInStock"];
this.columnSupplierID = this.Columns["SupplierID"];
}
private void InitClass() {
this.columnProductID = new DataColumn("ProductID", typeof(int), null, System.Data.MappingType.Element);
this.Columns.Add(this.columnProductID);
this.columnProductName = new DataColumn("ProductName", typeof(string), null, System.Data.MappingType.Element);
this.Columns.Add(this.columnProductName);
this.columnUnitPrice = new DataColumn("UnitPrice", typeof(System.Decimal), null, System.Data.MappingType.Element);
this.Columns.Add(this.columnUnitPrice);
this.columnUnitsInStock = new DataColumn("UnitsInStock", typeof(short), null, System.Data.MappingType.Element);
this.Columns.Add(this.columnUnitsInStock);
this.columnSupplierID = new DataColumn("SupplierID", typeof(int), null, System.Data.MappingType.Element);
this.Columns.Add(this.columnSupplierID);
this.Constraints.Add(new UniqueConstraint("Constraint1", new DataColumn[] {
this.columnProductID}, true));
this.columnProductID.AutoIncrement = true;
this.columnProductID.AllowDBNull = false;
this.columnProductID.ReadOnly = true;
this.columnProductID.Unique = true;
this.columnProductName.AllowDBNull = false;
}
public ProductsRow NewProductsRow() {
return ((ProductsRow)(this.NewRow()));
}
protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
return new ProductsRow(builder);
}
protected override System.Type GetRowType() {
return typeof(ProductsRow);
}
protected override void OnRowChanged(DataRowChangeEventArgs e) {
base.OnRowChanged(e);
if ((this.ProductsRowChanged != null)) {
this.ProductsRowChanged(this, new ProductsRowChangeEvent(((ProductsRow)(e.Row)), e.Action));
}
}
protected override void OnRowChanging(DataRowChangeEventArgs e) {
base.OnRowChanging(e);
if ((this.ProductsRowChanging != null)) {
this.ProductsRowChanging(this, new ProductsRowChangeEvent(((ProductsRow)(e.Row)), e.Action));
}
}
protected override void OnRowDeleted(DataRowChangeEventArgs e) {
base.OnRowDeleted(e);
if ((this.ProductsRowDeleted != null)) {
this.ProductsRowDeleted(this, new ProductsRowChangeEvent(((ProductsRow)(e.Row)), e.Action));
}
}
protected override void OnRowDeleting(DataRowChangeEventArgs e) {
base.OnRowDeleting(e);
if ((this.ProductsRowDeleting != null)) {
this.ProductsRowDeleting(this, new ProductsRowChangeEvent(((ProductsRow)(e.Row)), e.Action));
}
}
public void RemoveProductsRow(ProductsRow row) {
this.Rows.Remove(row);
}
}
[System.Diagnostics.DebuggerStepThrough()]
public class ProductsRow : DataRow {
private ProductsDataTable tableProducts;
internal ProductsRow(DataRowBuilder rb) :
base(rb) {
this.tableProducts = ((ProductsDataTable)(this.Table));
}
public int ProductID {
get {
return ((int)(this[this.tableProducts.ProductIDColumn]));
}
set {
this[this.tableProducts.ProductIDColumn] = value;
}
}
public string ProductName {
get {
return ((string)(this[this.tableProducts.ProductNameColumn]));
}
set {
this[this.tableProducts.ProductNameColumn] = value;
}
}
public System.Decimal UnitPrice {
get {
try {
return ((System.Decimal)(this[this.tableProducts.UnitPriceColumn]));
}
catch (InvalidCastException e) {
throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
}
}
set {
this[this.tableProducts.UnitPriceColumn] = value;
}
}
public short UnitsInStock {
get {
try {
return ((short)(this[this.tableProducts.UnitsInStockColumn]));
}
catch (InvalidCastException e) {
throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
}
}
set {
this[this.tableProducts.UnitsInStockColumn] = value;
}
}
public int SupplierID {
get {
try {
return ((int)(this[this.tableProducts.SupplierIDColumn]));
}
catch (InvalidCastException e) {
throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
}
}
set {
this[this.tableProducts.SupplierIDColumn] = value;
}
}
public bool IsUnitPriceNull() {
return this.IsNull(this.tableProducts.UnitPriceColumn);
}
public void SetUnitPriceNull() {
this[this.tableProducts.UnitPriceColumn] = System.Convert.DBNull;
}
public bool IsUnitsInStockNull() {
return this.IsNull(this.tableProducts.UnitsInStockColumn);
}
public void SetUnitsInStockNull() {
this[this.tableProducts.UnitsInStockColumn] = System.Convert.DBNull;
}
public bool IsSupplierIDNull() {
return this.IsNull(this.tableProducts.SupplierIDColumn);
}
public void SetSupplierIDNull() {
this[this.tableProducts.SupplierIDColumn] = System.Convert.DBNull;
}
}
[System.Diagnostics.DebuggerStepThrough()]
public class ProductsRowChangeEvent : EventArgs {
private ProductsRow eventRow;
private DataRowAction eventAction;
public ProductsRowChangeEvent(ProductsRow row, DataRowAction action) {
this.eventRow = row;
this.eventAction = action;
}
public ProductsRow Row {
get {
return this.eventRow;
}
}
public DataRowAction Action {
get {
return this.eventAction;
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -