product.cs
上传用户:lxycoco
上传日期:2022-07-21
资源大小:38457k
文件大小:21k
源码类别:

C#编程

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. // <autogenerated>
  3. //     This code was generated by a tool.
  4. //     Runtime Version: 1.1.4322.573
  5. //
  6. //     Changes to this file may cause incorrect behavior and will be lost if 
  7. //     the code is regenerated.
  8. // </autogenerated>
  9. //------------------------------------------------------------------------------
  10. // 
  11. // This source code was auto-generated by xsd, Version=1.1.4322.573.
  12. // 
  13. using System;
  14. using System.Data;
  15. using System.Xml;
  16. using System.Runtime.Serialization;
  17. [Serializable()]
  18. [System.ComponentModel.DesignerCategoryAttribute("code")]
  19. [System.Diagnostics.DebuggerStepThrough()]
  20. [System.ComponentModel.ToolboxItem(true)]
  21. public class Products : DataSet {
  22.     
  23.     private ProductDataTable tableProduct;
  24.     
  25.     public Products() {
  26.         this.InitClass();
  27.         System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
  28.         this.Tables.CollectionChanged += schemaChangedHandler;
  29.         this.Relations.CollectionChanged += schemaChangedHandler;
  30.     }
  31.     
  32.     protected Products(SerializationInfo info, StreamingContext context) {
  33.         string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
  34.         if ((strSchema != null)) {
  35.             DataSet ds = new DataSet();
  36.             ds.ReadXmlSchema(new XmlTextReader(new System.IO.StringReader(strSchema)));
  37.             if ((ds.Tables["Product"] != null)) {
  38.                 this.Tables.Add(new ProductDataTable(ds.Tables["Product"]));
  39.             }
  40.             this.DataSetName = ds.DataSetName;
  41.             this.Prefix = ds.Prefix;
  42.             this.Namespace = ds.Namespace;
  43.             this.Locale = ds.Locale;
  44.             this.CaseSensitive = ds.CaseSensitive;
  45.             this.EnforceConstraints = ds.EnforceConstraints;
  46.             this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
  47.             this.InitVars();
  48.         }
  49.         else {
  50.             this.InitClass();
  51.         }
  52.         this.GetSerializationData(info, context);
  53.         System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
  54.         this.Tables.CollectionChanged += schemaChangedHandler;
  55.         this.Relations.CollectionChanged += schemaChangedHandler;
  56.     }
  57.     
  58.     [System.ComponentModel.Browsable(false)]
  59.     [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)]
  60.     public ProductDataTable Product {
  61.         get {
  62.             return this.tableProduct;
  63.         }
  64.     }
  65.     
  66.     public override DataSet Clone() {
  67.         Products cln = ((Products)(base.Clone()));
  68.         cln.InitVars();
  69.         return cln;
  70.     }
  71.     
  72.     protected override bool ShouldSerializeTables() {
  73.         return false;
  74.     }
  75.     
  76.     protected override bool ShouldSerializeRelations() {
  77.         return false;
  78.     }
  79.     
  80.     protected override void ReadXmlSerializable(XmlReader reader) {
  81.         this.Reset();
  82.         DataSet ds = new DataSet();
  83.         ds.ReadXml(reader);
  84.         if ((ds.Tables["Product"] != null)) {
  85.             this.Tables.Add(new ProductDataTable(ds.Tables["Product"]));
  86.         }
  87.         this.DataSetName = ds.DataSetName;
  88.         this.Prefix = ds.Prefix;
  89.         this.Namespace = ds.Namespace;
  90.         this.Locale = ds.Locale;
  91.         this.CaseSensitive = ds.CaseSensitive;
  92.         this.EnforceConstraints = ds.EnforceConstraints;
  93.         this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
  94.         this.InitVars();
  95.     }
  96.     
  97.     protected override System.Xml.Schema.XmlSchema GetSchemaSerializable() {
  98.         System.IO.MemoryStream stream = new System.IO.MemoryStream();
  99.         this.WriteXmlSchema(new XmlTextWriter(stream, null));
  100.         stream.Position = 0;
  101.         return System.Xml.Schema.XmlSchema.Read(new XmlTextReader(stream), null);
  102.     }
  103.     
  104.     internal void InitVars() {
  105.         this.tableProduct = ((ProductDataTable)(this.Tables["Product"]));
  106.         if ((this.tableProduct != null)) {
  107.             this.tableProduct.InitVars();
  108.         }
  109.     }
  110.     
  111.     private void InitClass() {
  112.         this.DataSetName = "Products";
  113.         this.Prefix = "";
  114.         this.Namespace = "http://tempuri.org/XMLSchema1.xsd";
  115.         this.Locale = new System.Globalization.CultureInfo("en-GB");
  116.         this.CaseSensitive = false;
  117.         this.EnforceConstraints = true;
  118.         this.tableProduct = new ProductDataTable();
  119.         this.Tables.Add(this.tableProduct);
  120.     }
  121.     
  122.     private bool ShouldSerializeProduct() {
  123.         return false;
  124.     }
  125.     
  126.     private void SchemaChanged(object sender, System.ComponentModel.CollectionChangeEventArgs e) {
  127.         if ((e.Action == System.ComponentModel.CollectionChangeAction.Remove)) {
  128.             this.InitVars();
  129.         }
  130.     }
  131.     
  132.     public delegate void ProductRowChangeEventHandler(object sender, ProductRowChangeEvent e);
  133.     
  134.     [System.Diagnostics.DebuggerStepThrough()]
  135.     public class ProductDataTable : DataTable, System.Collections.IEnumerable {
  136.         
  137.         private DataColumn columnProductID;
  138.         
  139.         private DataColumn columnProductName;
  140.         
  141.         private DataColumn columnSupplierID;
  142.         
  143.         private DataColumn columnCategoryID;
  144.         
  145.         private DataColumn columnQuantityPerUnit;
  146.         
  147.         private DataColumn columnUnitPrice;
  148.         
  149.         private DataColumn columnUnitsInStock;
  150.         
  151.         private DataColumn columnUnitsOnOrder;
  152.         
  153.         private DataColumn columnReorderLevel;
  154.         
  155.         private DataColumn columnDiscontinued;
  156.         
  157.         internal ProductDataTable() : 
  158.                 base("Product") {
  159.             this.InitClass();
  160.         }
  161.         
  162.         internal ProductDataTable(DataTable table) : 
  163.                 base(table.TableName) {
  164.             if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
  165.                 this.CaseSensitive = table.CaseSensitive;
  166.             }
  167.             if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
  168.                 this.Locale = table.Locale;
  169.             }
  170.             if ((table.Namespace != table.DataSet.Namespace)) {
  171.                 this.Namespace = table.Namespace;
  172.             }
  173.             this.Prefix = table.Prefix;
  174.             this.MinimumCapacity = table.MinimumCapacity;
  175.             this.DisplayExpression = table.DisplayExpression;
  176.         }
  177.         
  178.         [System.ComponentModel.Browsable(false)]
  179.         public int Count {
  180.             get {
  181.                 return this.Rows.Count;
  182.             }
  183.         }
  184.         
  185.         internal DataColumn ProductIDColumn {
  186.             get {
  187.                 return this.columnProductID;
  188.             }
  189.         }
  190.         
  191.         internal DataColumn ProductNameColumn {
  192.             get {
  193.                 return this.columnProductName;
  194.             }
  195.         }
  196.         
  197.         internal DataColumn SupplierIDColumn {
  198.             get {
  199.                 return this.columnSupplierID;
  200.             }
  201.         }
  202.         
  203.         internal DataColumn CategoryIDColumn {
  204.             get {
  205.                 return this.columnCategoryID;
  206.             }
  207.         }
  208.         
  209.         internal DataColumn QuantityPerUnitColumn {
  210.             get {
  211.                 return this.columnQuantityPerUnit;
  212.             }
  213.         }
  214.         
  215.         internal DataColumn UnitPriceColumn {
  216.             get {
  217.                 return this.columnUnitPrice;
  218.             }
  219.         }
  220.         
  221.         internal DataColumn UnitsInStockColumn {
  222.             get {
  223.                 return this.columnUnitsInStock;
  224.             }
  225.         }
  226.         
  227.         internal DataColumn UnitsOnOrderColumn {
  228.             get {
  229.                 return this.columnUnitsOnOrder;
  230.             }
  231.         }
  232.         
  233.         internal DataColumn ReorderLevelColumn {
  234.             get {
  235.                 return this.columnReorderLevel;
  236.             }
  237.         }
  238.         
  239.         internal DataColumn DiscontinuedColumn {
  240.             get {
  241.                 return this.columnDiscontinued;
  242.             }
  243.         }
  244.         
  245.         public ProductRow this[int index] {
  246.             get {
  247.                 return ((ProductRow)(this.Rows[index]));
  248.             }
  249.         }
  250.         
  251.         public event ProductRowChangeEventHandler ProductRowChanged;
  252.         
  253.         public event ProductRowChangeEventHandler ProductRowChanging;
  254.         
  255.         public event ProductRowChangeEventHandler ProductRowDeleted;
  256.         
  257.         public event ProductRowChangeEventHandler ProductRowDeleting;
  258.         
  259.         public void AddProductRow(ProductRow row) {
  260.             this.Rows.Add(row);
  261.         }
  262.         
  263.         public ProductRow AddProductRow(string ProductName, int SupplierID, int CategoryID, string QuantityPerUnit, System.Decimal UnitPrice, short UnitsInStock, short UnitsOnOrder, short ReorderLevel, bool Discontinued) {
  264.             ProductRow rowProductRow = ((ProductRow)(this.NewRow()));
  265.             rowProductRow.ItemArray = new object[] {
  266.                     null,
  267.                     ProductName,
  268.                     SupplierID,
  269.                     CategoryID,
  270.                     QuantityPerUnit,
  271.                     UnitPrice,
  272.                     UnitsInStock,
  273.                     UnitsOnOrder,
  274.                     ReorderLevel,
  275.                     Discontinued};
  276.             this.Rows.Add(rowProductRow);
  277.             return rowProductRow;
  278.         }
  279.         
  280.         public System.Collections.IEnumerator GetEnumerator() {
  281.             return this.Rows.GetEnumerator();
  282.         }
  283.         
  284.         public override DataTable Clone() {
  285.             ProductDataTable cln = ((ProductDataTable)(base.Clone()));
  286.             cln.InitVars();
  287.             return cln;
  288.         }
  289.         
  290.         protected override DataTable CreateInstance() {
  291.             return new ProductDataTable();
  292.         }
  293.         
  294.         internal void InitVars() {
  295.             this.columnProductID = this.Columns["ProductID"];
  296.             this.columnProductName = this.Columns["ProductName"];
  297.             this.columnSupplierID = this.Columns["SupplierID"];
  298.             this.columnCategoryID = this.Columns["CategoryID"];
  299.             this.columnQuantityPerUnit = this.Columns["QuantityPerUnit"];
  300.             this.columnUnitPrice = this.Columns["UnitPrice"];
  301.             this.columnUnitsInStock = this.Columns["UnitsInStock"];
  302.             this.columnUnitsOnOrder = this.Columns["UnitsOnOrder"];
  303.             this.columnReorderLevel = this.Columns["ReorderLevel"];
  304.             this.columnDiscontinued = this.Columns["Discontinued"];
  305.         }
  306.         
  307.         private void InitClass() {
  308.             this.columnProductID = new DataColumn("ProductID", typeof(int), null, System.Data.MappingType.Element);
  309.             this.Columns.Add(this.columnProductID);
  310.             this.columnProductName = new DataColumn("ProductName", typeof(string), null, System.Data.MappingType.Element);
  311.             this.Columns.Add(this.columnProductName);
  312.             this.columnSupplierID = new DataColumn("SupplierID", typeof(int), null, System.Data.MappingType.Element);
  313.             this.Columns.Add(this.columnSupplierID);
  314.             this.columnCategoryID = new DataColumn("CategoryID", typeof(int), null, System.Data.MappingType.Element);
  315.             this.Columns.Add(this.columnCategoryID);
  316.             this.columnQuantityPerUnit = new DataColumn("QuantityPerUnit", typeof(string), null, System.Data.MappingType.Element);
  317.             this.Columns.Add(this.columnQuantityPerUnit);
  318.             this.columnUnitPrice = new DataColumn("UnitPrice", typeof(System.Decimal), null, System.Data.MappingType.Element);
  319.             this.Columns.Add(this.columnUnitPrice);
  320.             this.columnUnitsInStock = new DataColumn("UnitsInStock", typeof(short), null, System.Data.MappingType.Element);
  321.             this.Columns.Add(this.columnUnitsInStock);
  322.             this.columnUnitsOnOrder = new DataColumn("UnitsOnOrder", typeof(short), null, System.Data.MappingType.Element);
  323.             this.Columns.Add(this.columnUnitsOnOrder);
  324.             this.columnReorderLevel = new DataColumn("ReorderLevel", typeof(short), null, System.Data.MappingType.Element);
  325.             this.Columns.Add(this.columnReorderLevel);
  326.             this.columnDiscontinued = new DataColumn("Discontinued", typeof(bool), null, System.Data.MappingType.Element);
  327.             this.Columns.Add(this.columnDiscontinued);
  328.             this.columnProductID.AutoIncrement = true;
  329.             this.columnProductID.AllowDBNull = false;
  330.             this.columnProductID.ReadOnly = true;
  331.             this.columnProductName.AllowDBNull = false;
  332.             this.columnDiscontinued.AllowDBNull = false;
  333.         }
  334.         
  335.         public ProductRow NewProductRow() {
  336.             return ((ProductRow)(this.NewRow()));
  337.         }
  338.         
  339.         protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
  340.             return new ProductRow(builder);
  341.         }
  342.         
  343.         protected override System.Type GetRowType() {
  344.             return typeof(ProductRow);
  345.         }
  346.         
  347.         protected override void OnRowChanged(DataRowChangeEventArgs e) {
  348.             base.OnRowChanged(e);
  349.             if ((this.ProductRowChanged != null)) {
  350.                 this.ProductRowChanged(this, new ProductRowChangeEvent(((ProductRow)(e.Row)), e.Action));
  351.             }
  352.         }
  353.         
  354.         protected override void OnRowChanging(DataRowChangeEventArgs e) {
  355.             base.OnRowChanging(e);
  356.             if ((this.ProductRowChanging != null)) {
  357.                 this.ProductRowChanging(this, new ProductRowChangeEvent(((ProductRow)(e.Row)), e.Action));
  358.             }
  359.         }
  360.         
  361.         protected override void OnRowDeleted(DataRowChangeEventArgs e) {
  362.             base.OnRowDeleted(e);
  363.             if ((this.ProductRowDeleted != null)) {
  364.                 this.ProductRowDeleted(this, new ProductRowChangeEvent(((ProductRow)(e.Row)), e.Action));
  365.             }
  366.         }
  367.         
  368.         protected override void OnRowDeleting(DataRowChangeEventArgs e) {
  369.             base.OnRowDeleting(e);
  370.             if ((this.ProductRowDeleting != null)) {
  371.                 this.ProductRowDeleting(this, new ProductRowChangeEvent(((ProductRow)(e.Row)), e.Action));
  372.             }
  373.         }
  374.         
  375.         public void RemoveProductRow(ProductRow row) {
  376.             this.Rows.Remove(row);
  377.         }
  378.     }
  379.     
  380.     [System.Diagnostics.DebuggerStepThrough()]
  381.     public class ProductRow : DataRow {
  382.         
  383.         private ProductDataTable tableProduct;
  384.         
  385.         internal ProductRow(DataRowBuilder rb) : 
  386.                 base(rb) {
  387.             this.tableProduct = ((ProductDataTable)(this.Table));
  388.         }
  389.         
  390.         public int ProductID {
  391.             get {
  392.                 return ((int)(this[this.tableProduct.ProductIDColumn]));
  393.             }
  394.             set {
  395.                 this[this.tableProduct.ProductIDColumn] = value;
  396.             }
  397.         }
  398.         
  399.         public string ProductName {
  400.             get {
  401.                 return ((string)(this[this.tableProduct.ProductNameColumn]));
  402.             }
  403.             set {
  404.                 this[this.tableProduct.ProductNameColumn] = value;
  405.             }
  406.         }
  407.         
  408.         public int SupplierID {
  409.             get {
  410.                 try {
  411.                     return ((int)(this[this.tableProduct.SupplierIDColumn]));
  412.                 }
  413.                 catch (InvalidCastException e) {
  414.                     throw new StrongTypingException("Cannot get value because it is DBNull.", e);
  415.                 }
  416.             }
  417.             set {
  418.                 this[this.tableProduct.SupplierIDColumn] = value;
  419.             }
  420.         }
  421.         
  422.         public int CategoryID {
  423.             get {
  424.                 try {
  425.                     return ((int)(this[this.tableProduct.CategoryIDColumn]));
  426.                 }
  427.                 catch (InvalidCastException e) {
  428.                     throw new StrongTypingException("Cannot get value because it is DBNull.", e);
  429.                 }
  430.             }
  431.             set {
  432.                 this[this.tableProduct.CategoryIDColumn] = value;
  433.             }
  434.         }
  435.         
  436.         public string QuantityPerUnit {
  437.             get {
  438.                 try {
  439.                     return ((string)(this[this.tableProduct.QuantityPerUnitColumn]));
  440.                 }
  441.                 catch (InvalidCastException e) {
  442.                     throw new StrongTypingException("Cannot get value because it is DBNull.", e);
  443.                 }
  444.             }
  445.             set {
  446.                 this[this.tableProduct.QuantityPerUnitColumn] = value;
  447.             }
  448.         }
  449.         
  450.         public System.Decimal UnitPrice {
  451.             get {
  452.                 try {
  453.                     return ((System.Decimal)(this[this.tableProduct.UnitPriceColumn]));
  454.                 }
  455.                 catch (InvalidCastException e) {
  456.                     throw new StrongTypingException("Cannot get value because it is DBNull.", e);
  457.                 }
  458.             }
  459.             set {
  460.                 this[this.tableProduct.UnitPriceColumn] = value;
  461.             }
  462.         }
  463.         
  464.         public short UnitsInStock {
  465.             get {
  466.                 try {
  467.                     return ((short)(this[this.tableProduct.UnitsInStockColumn]));
  468.                 }
  469.                 catch (InvalidCastException e) {
  470.                     throw new StrongTypingException("Cannot get value because it is DBNull.", e);
  471.                 }
  472.             }
  473.             set {
  474.                 this[this.tableProduct.UnitsInStockColumn] = value;
  475.             }
  476.         }
  477.         
  478.         public short UnitsOnOrder {
  479.             get {
  480.                 try {
  481.                     return ((short)(this[this.tableProduct.UnitsOnOrderColumn]));
  482.                 }
  483.                 catch (InvalidCastException e) {
  484.                     throw new StrongTypingException("Cannot get value because it is DBNull.", e);
  485.                 }
  486.             }
  487.             set {
  488.                 this[this.tableProduct.UnitsOnOrderColumn] = value;
  489.             }
  490.         }
  491.         
  492.         public short ReorderLevel {
  493.             get {
  494.                 try {
  495.                     return ((short)(this[this.tableProduct.ReorderLevelColumn]));
  496.                 }
  497.                 catch (InvalidCastException e) {
  498.                     throw new StrongTypingException("Cannot get value because it is DBNull.", e);
  499.                 }
  500.             }
  501.             set {
  502.                 this[this.tableProduct.ReorderLevelColumn] = value;
  503.             }
  504.         }
  505.         
  506.         public bool Discontinued {
  507.             get {
  508.                 return ((bool)(this[this.tableProduct.DiscontinuedColumn]));
  509.             }
  510.             set {
  511.                 this[this.tableProduct.DiscontinuedColumn] = value;
  512.             }
  513.         }
  514.         
  515.         public bool IsSupplierIDNull() {
  516.             return this.IsNull(this.tableProduct.SupplierIDColumn);
  517.         }
  518.         
  519.         public void SetSupplierIDNull() {
  520.             this[this.tableProduct.SupplierIDColumn] = System.Convert.DBNull;
  521.         }
  522.         
  523.         public bool IsCategoryIDNull() {
  524.             return this.IsNull(this.tableProduct.CategoryIDColumn);
  525.         }
  526.         
  527.         public void SetCategoryIDNull() {
  528.             this[this.tableProduct.CategoryIDColumn] = System.Convert.DBNull;
  529.         }
  530.         
  531.         public bool IsQuantityPerUnitNull() {
  532.             return this.IsNull(this.tableProduct.QuantityPerUnitColumn);
  533.         }
  534.         
  535.         public void SetQuantityPerUnitNull() {
  536.             this[this.tableProduct.QuantityPerUnitColumn] = System.Convert.DBNull;
  537.         }
  538.         
  539.         public bool IsUnitPriceNull() {
  540.             return this.IsNull(this.tableProduct.UnitPriceColumn);
  541.         }
  542.         
  543.         public void SetUnitPriceNull() {
  544.             this[this.tableProduct.UnitPriceColumn] = System.Convert.DBNull;
  545.         }
  546.         
  547.         public bool IsUnitsInStockNull() {
  548.             return this.IsNull(this.tableProduct.UnitsInStockColumn);
  549.         }
  550.         
  551.         public void SetUnitsInStockNull() {
  552.             this[this.tableProduct.UnitsInStockColumn] = System.Convert.DBNull;
  553.         }
  554.         
  555.         public bool IsUnitsOnOrderNull() {
  556.             return this.IsNull(this.tableProduct.UnitsOnOrderColumn);
  557.         }
  558.         
  559.         public void SetUnitsOnOrderNull() {
  560.             this[this.tableProduct.UnitsOnOrderColumn] = System.Convert.DBNull;
  561.         }
  562.         
  563.         public bool IsReorderLevelNull() {
  564.             return this.IsNull(this.tableProduct.ReorderLevelColumn);
  565.         }
  566.         
  567.         public void SetReorderLevelNull() {
  568.             this[this.tableProduct.ReorderLevelColumn] = System.Convert.DBNull;
  569.         }
  570.     }
  571.     
  572.     [System.Diagnostics.DebuggerStepThrough()]
  573.     public class ProductRowChangeEvent : EventArgs {
  574.         
  575.         private ProductRow eventRow;
  576.         
  577.         private DataRowAction eventAction;
  578.         
  579.         public ProductRowChangeEvent(ProductRow row, DataRowAction action) {
  580.             this.eventRow = row;
  581.             this.eventAction = action;
  582.         }
  583.         
  584.         public ProductRow Row {
  585.             get {
  586.                 return this.eventRow;
  587.             }
  588.         }
  589.         
  590.         public DataRowAction Action {
  591.             get {
  592.                 return this.eventAction;
  593.             }
  594.         }
  595.     }
  596. }