Merge pull request #3091 from alexanderkyte/mobile_static_fix_mcs_tests
[mono.git] / mcs / class / System.Data / Test / System.Data / DataSetTypedDataSetTest.cs
1 // Authors:
2 //   Rafael Mizrahi   <rafim@mainsoft.com>
3 //   Erez Lotan       <erezl@mainsoft.com>
4 //   Oren Gurfinkel   <oreng@mainsoft.com>
5 //   Ofer Borstein
6 //
7 // Copyright (c) 2004 Mainsoft Co.
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28
29 using NUnit.Framework;
30 using System;
31 using System.ComponentModel;
32 using System.Data;
33 using MonoTests.System.Data.Utils;
34 using System.Collections;
35 using System.Runtime.Serialization;
36 using System.Xml;
37 using System.Xml.Schema;
38 using System.IO;
39 using System.Globalization;
40
41 namespace MonoTests.System.Data
42 {
43         [TestFixture]
44         public class DataSetTypedDataSetTest
45         {
46                 private string EventStatus = string.Empty ;
47
48                 [Test]
49                 public void TypedDataSet()
50                 {
51                         int i = 0;
52                         //check dataset constructor
53                         myTypedDataSet ds = null;
54                         DataSet unTypedDs = new DataSet();
55                         ds = new myTypedDataSet();
56                         Assert.IsFalse(ds == null ,"TDS0" );
57                         Assert.AreEqual(typeof(myTypedDataSet), ds.GetType() ,"TDS1" );
58                 
59                         // fill dataset
60                         ds.ReadXml("Test/System.Data/TypedDataSet.xml");
61
62                         // check DataSet named property "Orders"
63                         myTypedDataSet.OrdersDataTable tblOrders = null;
64                         tblOrders = ds.Orders; 
65                         Assert.AreEqual(ds.Tables["Orders"],tblOrders ,"TDS2");
66                         
67                         //check DataSet named property Orders - by index");
68                         tblOrders = ds.Orders; 
69                         Assert.AreEqual(ds.Tables[1],tblOrders ,"TDS3");
70                         
71                         //add new row AddTableNameRow, check row count");
72                         i = tblOrders.Rows.Count;
73                         tblOrders.AddOrdersRow("SAVEA",1,new DateTime(1998,05,01,00,00,00,000)
74                                 ,new DateTime(1998,05,29,00,00,00,000)
75                                 ,new DateTime(1998,05,04,00,00,00,000),1,30.0900m
76                                 ,"Save-a-lot Markets","187 Suffolk Ln.","Boise","ID","83720","USA");
77                         Assert.AreEqual(i+1 ,tblOrders.Rows.Count,"TDS5");
78                 
79                         //check the new row AutoIncrement field - AddTableNameRow
80                         i = (int)tblOrders.Rows[tblOrders.Rows.Count-2][0];
81                         Assert.AreEqual(i+1 ,(int)tblOrders.Rows[tblOrders.Rows.Count-1][0],"TDS6");
82
83                         //Create New Row using NewTableNameRow, check row != null
84                         myTypedDataSet.OrdersRow drOrders = null;
85                         drOrders = tblOrders.NewOrdersRow();
86                         Assert.IsFalse(drOrders == null ,"TDS7");
87                         
88                         //Create New Row using NewTableNameRow, check row state
89                         Assert.AreEqual(DataRowState.Detached, drOrders.RowState ,  "TDS8");
90
91                         //add new row NewTableNameRow, check row count
92                         //drOrders.OrderID = DBNull.Value;
93                         drOrders.CustomerID = "GREAL";
94                         drOrders.EmployeeID = 4;
95                         drOrders.OrderDate = new DateTime(1998,04,30,00,00,00,000);
96                         drOrders.RequiredDate = new DateTime(1998,06,11,00,00,00,000);
97                         drOrders["ShippedDate"] = DBNull.Value; 
98                         drOrders.ShipVia = 3;
99                         drOrders.Freight = 14.0100m;
100                         drOrders.ShipName = "Great Lakes";
101                         drOrders.ShipAddress = "Food Market";
102                         drOrders.ShipCity = "Baker Blvd.";
103                         drOrders.ShipRegion = "Eugene";
104                         drOrders.ShipPostalCode = "OR   97403";
105                         drOrders.ShipCountry =  "USA";
106
107                         i = tblOrders.Rows.Count;
108                         tblOrders.AddOrdersRow(drOrders);
109                         Assert.AreEqual(i+1 ,tblOrders.Rows.Count,"TDS9");
110
111                         //check StrongTypingException
112                         try
113                         {
114                                 DateTime d = drOrders.ShippedDate; //drOrders.ShippedDate = null, will raise exception
115                                 Assert.Fail("TDS10: Failed to throw StrongTypingException");
116                         }
117                         catch (StrongTypingException) {}
118                         catch (AssertionException exc) {throw  exc;}
119                         catch (Exception exc)
120                         {
121                                 Assert.Fail("TDS11: Wrong exception type. Got:" + exc);
122                         }
123                 
124                         //check the new row AutoIncrement field - NewTableNameRow
125                         i = (int)tblOrders.Rows[tblOrders.Rows.Count-2][0];
126                         Assert.AreEqual(i+1 ,(int)tblOrders.Rows[tblOrders.Rows.Count-1][0],"TDS12");
127
128                         // convenience IsNull functions
129                         // only if it can be null
130                         Assert.IsFalse(drOrders.IsShipAddressNull() ,"TDS13");
131                         
132                         drOrders.SetShipAddressNull(); 
133                         Assert.IsTrue(drOrders.IsShipAddressNull() ,"TDS14");
134                         
135                         // Table exposes a public property Count == table.Rows.Count
136                         Assert.AreEqual(tblOrders.Count ,tblOrders.Rows.Count , "TDS15");
137
138
139                         // find function
140                         myTypedDataSet.OrdersRow dr = tblOrders[0];
141                         Assert.AreEqual(tblOrders.FindByOrderID(dr.OrderID),dr,"TDS16" );
142
143                         //Remove row and check row count
144                         i = tblOrders.Count; 
145                         myTypedDataSet.OrdersRow drr = tblOrders[0];
146                         tblOrders.RemoveOrdersRow(drr);
147                         Assert.AreEqual(i-1 ,tblOrders.Count,"TDS17");
148
149                         //first column is readonly
150                         Assert.IsTrue(tblOrders.OrderIDColumn.ReadOnly  ,"TDS18");
151
152                         //read only exception
153                         try
154                         {
155                                 tblOrders[0].OrderID = 99;
156                                 Assert.Fail("TDS19: Failed to throw ReadOnlyException");
157                         }
158                         catch (ReadOnlyException) {}
159                         catch (AssertionException exc) {throw  exc;}
160                         catch (Exception exc)
161                         {
162                                 Assert.Fail("TDS20: Wrong exception type. Got:" + exc);
163                         }
164
165                         tblOrders.AcceptChanges();
166
167                         //Check table events
168                         // add event handlers
169                         ds.Orders.OrdersRowChanging += new myTypedDataSet.OrdersRowChangeEventHandler(T_Changing);
170                         ds.Orders.OrdersRowChanged += new myTypedDataSet.OrdersRowChangeEventHandler(T_Changed);
171                         ds.Orders.OrdersRowDeleting += new myTypedDataSet.OrdersRowChangeEventHandler(T_Deleting);
172                         ds.Orders.OrdersRowDeleted += new myTypedDataSet.OrdersRowChangeEventHandler(T_Deleted);
173         
174                         //RowChange event order
175                         tblOrders[0].ShipCity = "Tel Aviv";
176                         Assert.AreEqual("AB",EventStatus  , "TDS21");
177
178                         EventStatus = string.Empty; 
179                         //RowDelet event order
180                         tblOrders[0].Delete(); 
181                         Assert.AreEqual("AB",EventStatus  , "TDS22");
182
183                         //expose DataColumn as property
184                         Assert.AreEqual(ds.Orders.OrderIDColumn ,ds.Tables["Orders"].Columns["OrderID"],"TDS23");
185                 
186                         //Accept changes for all deleted and changedd rows.
187                         ds.AcceptChanges();
188
189                         //check relations
190                         //ChildTableRow has property ParentTableRow
191                         myTypedDataSet.OrdersRow dr1 = ds.Order_Details[0].OrdersRow;
192                         DataRow dr2 = ds.Order_Details[0].GetParentRow(ds.Relations[0]);
193                         Assert.AreEqual(dr1 ,dr2 ,"TDS24");
194                         
195                         //ParentTableRow has property ChildTableRow
196                         myTypedDataSet.Order_DetailsRow[] drArr1 = ds.Orders[0].GetOrder_DetailsRows();
197                         DataRow[] drArr2 = ds.Orders[0].GetChildRows(ds.Relations[0]);
198                         Assert.AreEqual(drArr1 ,drArr2,"TDS25");
199
200                        //now test serialization of a typed dataset generated by microsoft's xsd.exe
201                        DataSet1 ds1 = new DataSet1();
202                        ds1.DataTable1.AddDataTable1Row("test");
203                        ds1.DataTable1.AddDataTable1Row("test2");
204
205                        global::System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter =
206                          new global::System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
207                        MemoryStream stream = new MemoryStream();
208
209                        formatter.Serialize(stream, ds1);
210
211                        stream.Seek(0, SeekOrigin.Begin);
212
213                        DataSet1 ds1load = (DataSet1) formatter.Deserialize(stream);
214
215                        Assert.IsTrue(ds1load.Tables.Contains("DataTable1"));
216                        Assert.AreEqual("DataTable1DataTable", ds1load.Tables["DataTable1"].GetType().Name);
217                        Assert.AreEqual(2, ds1load.DataTable1.Rows.Count);
218                        Assert.AreEqual("DataTable1Row", ds1load.DataTable1[0].GetType().Name);
219                        if (ds1load.DataTable1[0].Column1 == "test") {
220                                Assert.AreEqual("test2", ds1load.DataTable1[1].Column1);
221                        } else if (ds1load.DataTable1[0].Column1 == "test2") {
222                                Assert.AreEqual("test", ds1load.DataTable1[1].Column1);
223                        } else {
224                                Assert.Fail("Invalid entry for Column1");
225                        }
226
227                        //now test when the mode is exclude schema
228                        ds1.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.ExcludeSchema;
229
230                        stream = new MemoryStream();
231
232                        formatter.Serialize(stream, ds1);
233
234                        stream.Seek(0, SeekOrigin.Begin);
235
236                        ds1load = (DataSet1) formatter.Deserialize(stream);
237
238                        Assert.IsTrue(ds1load.Tables.Contains("DataTable1"));
239                        Assert.AreEqual("DataTable1DataTable", ds1load.Tables["DataTable1"].GetType().Name);
240                        Assert.AreEqual(2, ds1load.DataTable1.Rows.Count);
241                        Assert.AreEqual("DataTable1Row", ds1load.DataTable1[0].GetType().Name);
242                        if (ds1load.DataTable1[0].Column1 == "test") {
243                                Assert.AreEqual("test2", ds1load.DataTable1[1].Column1);
244                        } else if (ds1load.DataTable1[0].Column1 == "test2") {
245                                Assert.AreEqual("test", ds1load.DataTable1[1].Column1);
246                        } else {
247                                Assert.Fail("Invalid entry for Column1");
248                        }
249                 }
250         
251                 protected void T_Changing(object sender, myTypedDataSet.OrdersRowChangeEvent e) 
252                 { 
253                         EventStatus += "A";             
254                 }
255
256                 protected void T_Changed(object sender, myTypedDataSet.OrdersRowChangeEvent e) 
257                 { 
258                         EventStatus += "B";
259                 }
260
261                 protected void T_Deleting(object sender, myTypedDataSet.OrdersRowChangeEvent e) 
262                 { 
263                         EventStatus += "A";
264                 }
265
266                 protected void T_Deleted(object sender, myTypedDataSet.OrdersRowChangeEvent e) 
267                 { 
268                         EventStatus += "B";
269                 }
270
271                 [Serializable()]
272                 [DesignerCategoryAttribute("code")]
273                 [ToolboxItem(true)]
274                 public class myTypedDataSet : DataSet 
275                 {        
276                         private Order_DetailsDataTable tableOrder_Details;
277         
278                         private OrdersDataTable tableOrders;
279         
280                         private DataRelation relationOrdersOrder_x0020_Details;
281         
282                         public myTypedDataSet() 
283                         {
284                                 this.InitClass();
285                                 CollectionChangeEventHandler schemaChangedHandler = new CollectionChangeEventHandler(this.SchemaChanged);
286                                 this.Tables.CollectionChanged += schemaChangedHandler;
287                                 this.Relations.CollectionChanged += schemaChangedHandler;
288                         }
289         
290                         protected myTypedDataSet(SerializationInfo info, StreamingContext context) 
291                         {
292                                 string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
293                                 if ((strSchema != null)) 
294                                 {
295                                         DataSet ds = new DataSet();
296                                         ds.ReadXmlSchema(new XmlTextReader(new StringReader(strSchema)));
297                                         if ((ds.Tables["Order Details"] != null)) 
298                                         {
299                                                 this.Tables.Add(new Order_DetailsDataTable(ds.Tables["Order Details"]));
300                                         }
301                                         if ((ds.Tables["Orders"] != null)) 
302                                         {
303                                                 this.Tables.Add(new OrdersDataTable(ds.Tables["Orders"]));
304                                         }
305                                         this.DataSetName = ds.DataSetName;
306                                         this.Prefix = ds.Prefix;
307                                         this.Namespace = ds.Namespace;
308                                         this.Locale = ds.Locale;
309                                         this.CaseSensitive = ds.CaseSensitive;
310                                         this.EnforceConstraints = ds.EnforceConstraints;
311                                         this.Merge(ds, false, MissingSchemaAction.Add);
312                                         this.InitVars();
313                                 }
314                                 else 
315                                 {
316                                         this.InitClass();
317                                 }
318                                 this.GetSerializationData(info, context);
319                                 CollectionChangeEventHandler schemaChangedHandler = new CollectionChangeEventHandler(this.SchemaChanged);
320                                 this.Tables.CollectionChanged += schemaChangedHandler;
321                                 this.Relations.CollectionChanged += schemaChangedHandler;
322                         }
323         
324                         [Browsable(false)]
325                         [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]
326                         public Order_DetailsDataTable Order_Details 
327                         {
328                                 get 
329                                 {
330                                         return this.tableOrder_Details;
331                                 }
332                         }
333         
334                         [Browsable(false)]
335                         [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]
336                         public OrdersDataTable Orders 
337                         {
338                                 get 
339                                 {
340                                         return this.tableOrders;
341                                 }
342                         }
343         
344                         public override DataSet Clone() 
345                         {
346                                 myTypedDataSet cln = ((myTypedDataSet)(base.Clone()));
347                                 cln.InitVars();
348                                 return cln;
349                         }
350         
351                         protected override bool ShouldSerializeTables() 
352                         {
353                                 return false;
354                         }
355         
356                         protected override bool ShouldSerializeRelations() 
357                         {
358                                 return false;
359                         }
360         
361                         protected override void ReadXmlSerializable(XmlReader reader) 
362                         {
363                                 this.Reset();
364                                 DataSet ds = new DataSet();
365                                 ds.ReadXml(reader);
366                                 if ((ds.Tables["Order Details"] != null)) 
367                                 {
368                                         this.Tables.Add(new Order_DetailsDataTable(ds.Tables["Order Details"]));
369                                 }
370                                 if ((ds.Tables["Orders"] != null)) 
371                                 {
372                                         this.Tables.Add(new OrdersDataTable(ds.Tables["Orders"]));
373                                 }
374                                 this.DataSetName = ds.DataSetName;
375                                 this.Prefix = ds.Prefix;
376                                 this.Namespace = ds.Namespace;
377                                 this.Locale = ds.Locale;
378                                 this.CaseSensitive = ds.CaseSensitive;
379                                 this.EnforceConstraints = ds.EnforceConstraints;
380                                 this.Merge(ds, false, MissingSchemaAction.Add);
381                                 this.InitVars();
382                         }
383         
384                         protected override XmlSchema GetSchemaSerializable() 
385                         {
386                                 MemoryStream stream = new MemoryStream();
387                                 this.WriteXmlSchema(new XmlTextWriter(stream, null));
388                                 stream.Position = 0;
389                                 return XmlSchema.Read(new XmlTextReader(stream), null);
390                         }
391         
392                         internal void InitVars() 
393                         {
394                                 this.tableOrder_Details = ((Order_DetailsDataTable)(this.Tables["Order Details"]));
395                                 if ((this.tableOrder_Details != null)) 
396                                 {
397                                         this.tableOrder_Details.InitVars();
398                                 }
399                                 this.tableOrders = ((OrdersDataTable)(this.Tables["Orders"]));
400                                 if ((this.tableOrders != null)) 
401                                 {
402                                         this.tableOrders.InitVars();
403                                 }
404                                 this.relationOrdersOrder_x0020_Details = this.Relations["OrdersOrder_x0020_Details"];
405                         }
406         
407                         private void InitClass() 
408                         {
409                                 this.DataSetName = "myTypedDataSet";
410                                 this.Prefix = "";
411                                 this.Namespace = "http://www.tempuri.org/myTypedDataSet.xsd";
412                                 this.Locale = new CultureInfo("en-US");
413                                 this.CaseSensitive = false;
414                                 this.EnforceConstraints = true;
415                                 this.tableOrder_Details = new Order_DetailsDataTable();
416                                 this.Tables.Add(this.tableOrder_Details);
417                                 this.tableOrders = new OrdersDataTable();
418                                 this.Tables.Add(this.tableOrders);
419                                 ForeignKeyConstraint fkc;
420                                 fkc = new ForeignKeyConstraint("OrdersOrder_x0020_Details", new DataColumn[] {
421                                                                                                                                                                                                  this.tableOrders.OrderIDColumn}, new DataColumn[] {
422                                                                                                                                                                                                                                                                                                            this.tableOrder_Details.OrderIDColumn});
423                                 this.tableOrder_Details.Constraints.Add(fkc);
424                                 fkc.AcceptRejectRule = AcceptRejectRule.None;
425                                 fkc.DeleteRule = Rule.Cascade;
426                                 fkc.UpdateRule = Rule.Cascade;
427                                 this.relationOrdersOrder_x0020_Details = new DataRelation("OrdersOrder_x0020_Details", new DataColumn[] {
428                                                                                                                                                                                                                                                         this.tableOrders.OrderIDColumn}, new DataColumn[] {
429                                                                                                                                                                                                                                                                                                                                                                   this.tableOrder_Details.OrderIDColumn}, false);
430                                 this.Relations.Add(this.relationOrdersOrder_x0020_Details);
431                         }
432         
433                         private bool ShouldSerializeOrder_Details() 
434                         {
435                                 return false;
436                         }
437         
438                         private bool ShouldSerializeOrders() 
439                         {
440                                 return false;
441                         }
442         
443                         private void SchemaChanged(object sender, CollectionChangeEventArgs e) 
444                         {
445                                 if ((e.Action == CollectionChangeAction.Remove)) 
446                                 {
447                                         this.InitVars();
448                                 }
449                         }
450         
451                         public delegate void Order_DetailsRowChangeEventHandler(object sender, Order_DetailsRowChangeEvent e);
452         
453                         public delegate void OrdersRowChangeEventHandler(object sender, OrdersRowChangeEvent e);
454         
455                                 public class Order_DetailsDataTable : DataTable, IEnumerable 
456                         {
457             
458                                 private DataColumn columnOrderID;
459             
460                                 private DataColumn columnProductID;
461             
462                                 private DataColumn columnUnitPrice;
463             
464                                 private DataColumn columnQuantity;
465             
466                                 private DataColumn columnDiscount;
467             
468                                 internal Order_DetailsDataTable() : 
469                                         base("Order Details") 
470                                 {
471                                         this.InitClass();
472                                 }
473             
474                                 internal Order_DetailsDataTable(DataTable table) : 
475                                         base(table.TableName) 
476                                 {
477                                         if ((table.CaseSensitive != table.DataSet.CaseSensitive)) 
478                                         {
479                                                 this.CaseSensitive = table.CaseSensitive;
480                                         }
481                                         if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) 
482                                         {
483                                                 this.Locale = table.Locale;
484                                         }
485                                         if ((table.Namespace != table.DataSet.Namespace)) 
486                                         {
487                                                 this.Namespace = table.Namespace;
488                                         }
489                                         this.Prefix = table.Prefix;
490                                         this.MinimumCapacity = table.MinimumCapacity;
491                                         this.DisplayExpression = table.DisplayExpression;
492                                 }
493             
494                                 [Browsable(false)]
495                                 public int Count 
496                                 {
497                                         get 
498                                         {
499                                                 return this.Rows.Count;
500                                         }
501                                 }
502             
503                                 internal DataColumn OrderIDColumn 
504                                 {
505                                         get 
506                                         {
507                                                 return this.columnOrderID;
508                                         }
509                                 }
510             
511                                 internal DataColumn ProductIDColumn 
512                                 {
513                                         get 
514                                         {
515                                                 return this.columnProductID;
516                                         }
517                                 }
518             
519                                 internal DataColumn UnitPriceColumn 
520                                 {
521                                         get 
522                                         {
523                                                 return this.columnUnitPrice;
524                                         }
525                                 }
526             
527                                 internal DataColumn QuantityColumn 
528                                 {
529                                         get 
530                                         {
531                                                 return this.columnQuantity;
532                                         }
533                                 }
534             
535                                 internal DataColumn DiscountColumn 
536                                 {
537                                         get 
538                                         {
539                                                 return this.columnDiscount;
540                                         }
541                                 }
542             
543                                 public Order_DetailsRow this[int index] 
544                                 {
545                                         get 
546                                         {
547                                                 return ((Order_DetailsRow)(this.Rows[index]));
548                                         }
549                                 }
550             
551                                 public event Order_DetailsRowChangeEventHandler Order_DetailsRowChanged;
552             
553                                 public event Order_DetailsRowChangeEventHandler Order_DetailsRowChanging;
554             
555                                 public event Order_DetailsRowChangeEventHandler Order_DetailsRowDeleted;
556             
557                                 public event Order_DetailsRowChangeEventHandler Order_DetailsRowDeleting;
558             
559                                 public void AddOrder_DetailsRow(Order_DetailsRow row) 
560                                 {
561                                         this.Rows.Add(row);
562                                 }
563             
564                                 public Order_DetailsRow AddOrder_DetailsRow(OrdersRow parentOrdersRowByOrdersOrder_x0020_Details, int ProductID, Decimal UnitPrice, short Quantity, string Discount) 
565                                 {
566                                         Order_DetailsRow rowOrder_DetailsRow = ((Order_DetailsRow)(this.NewRow()));
567                                         rowOrder_DetailsRow.ItemArray = new object[] {
568                                                                                                                                          parentOrdersRowByOrdersOrder_x0020_Details[0],
569                                                                                                                                          ProductID,
570                                                                                                                                          UnitPrice,
571                                                                                                                                          Quantity,
572                                                                                                                                          Discount};
573                                         this.Rows.Add(rowOrder_DetailsRow);
574                                         return rowOrder_DetailsRow;
575                                 }
576             
577                                 public Order_DetailsRow FindByOrderIDProductID(int OrderID, int ProductID) 
578                                 {
579                                         return ((Order_DetailsRow)(this.Rows.Find(new object[] {
580                                                                                                                                                            OrderID,
581                                                                                                                                                            ProductID})));
582                                 }
583             
584                                 public IEnumerator GetEnumerator() 
585                                 {
586                                         return this.Rows.GetEnumerator();
587                                 }
588             
589                                 public override DataTable Clone() 
590                                 {
591                                         Order_DetailsDataTable cln = ((Order_DetailsDataTable)(base.Clone()));
592                                         cln.InitVars();
593                                         return cln;
594                                 }
595             
596                                 protected override DataTable CreateInstance() 
597                                 {
598                                         return new Order_DetailsDataTable();
599                                 }
600             
601                                 internal void InitVars() 
602                                 {
603                                         this.columnOrderID = this.Columns["OrderID"];
604                                         this.columnProductID = this.Columns["ProductID"];
605                                         this.columnUnitPrice = this.Columns["UnitPrice"];
606                                         this.columnQuantity = this.Columns["Quantity"];
607                                         this.columnDiscount = this.Columns["Discount"];
608                                 }
609             
610                                 private void InitClass() 
611                                 {
612                                         this.columnOrderID = new DataColumn("OrderID", typeof(int), null, MappingType.Element);
613                                         this.Columns.Add(this.columnOrderID);
614                                         this.columnProductID = new DataColumn("ProductID", typeof(int), null, MappingType.Element);
615                                         this.Columns.Add(this.columnProductID);
616                                         this.columnUnitPrice = new DataColumn("UnitPrice", typeof(Decimal), null, MappingType.Element);
617                                         this.Columns.Add(this.columnUnitPrice);
618                                         this.columnQuantity = new DataColumn("Quantity", typeof(short), null, MappingType.Element);
619                                         this.Columns.Add(this.columnQuantity);
620                                         this.columnDiscount = new DataColumn("Discount", typeof(string), null, MappingType.Element);
621                                         this.Columns.Add(this.columnDiscount);
622                                         this.Constraints.Add(new UniqueConstraint("Constraint1", new DataColumn[] {
623                                                                                                                                                                                                   this.columnOrderID,
624                                                                                                                                                                                                   this.columnProductID}, true));
625                                         this.columnOrderID.AllowDBNull = false;
626                                         this.columnProductID.AllowDBNull = false;
627                                         this.columnUnitPrice.AllowDBNull = false;
628                                         this.columnQuantity.AllowDBNull = false;
629                                         this.columnDiscount.ReadOnly = true;
630                                 }
631             
632                                 public Order_DetailsRow NewOrder_DetailsRow() 
633                                 {
634                                         return ((Order_DetailsRow)(this.NewRow()));
635                                 }
636             
637                                 protected override DataRow NewRowFromBuilder(DataRowBuilder builder) 
638                                 {
639                                         return new Order_DetailsRow(builder);
640                                 }
641             
642                                 protected override Type GetRowType() 
643                                 {
644                                         return typeof(Order_DetailsRow);
645                                 }
646             
647                                 protected override void OnRowChanged(DataRowChangeEventArgs e) 
648                                 {
649                                         base.OnRowChanged(e);
650                                         if ((this.Order_DetailsRowChanged != null)) 
651                                         {
652                                                 this.Order_DetailsRowChanged(this, new Order_DetailsRowChangeEvent(((Order_DetailsRow)(e.Row)), e.Action));
653                                         }
654                                 }
655             
656                                 protected override void OnRowChanging(DataRowChangeEventArgs e) 
657                                 {
658                                         base.OnRowChanging(e);
659                                         if ((this.Order_DetailsRowChanging != null)) 
660                                         {
661                                                 this.Order_DetailsRowChanging(this, new Order_DetailsRowChangeEvent(((Order_DetailsRow)(e.Row)), e.Action));
662                                         }
663                                 }
664             
665                                 protected override void OnRowDeleted(DataRowChangeEventArgs e) 
666                                 {
667                                         base.OnRowDeleted(e);
668                                         if ((this.Order_DetailsRowDeleted != null)) 
669                                         {
670                                                 this.Order_DetailsRowDeleted(this, new Order_DetailsRowChangeEvent(((Order_DetailsRow)(e.Row)), e.Action));
671                                         }
672                                 }
673             
674                                 protected override void OnRowDeleting(DataRowChangeEventArgs e) 
675                                 {
676                                         base.OnRowDeleting(e);
677                                         if ((this.Order_DetailsRowDeleting != null)) 
678                                         {
679                                                 this.Order_DetailsRowDeleting(this, new Order_DetailsRowChangeEvent(((Order_DetailsRow)(e.Row)), e.Action));
680                                         }
681                                 }
682             
683                                 public void RemoveOrder_DetailsRow(Order_DetailsRow row) 
684                                 {
685                                         this.Rows.Remove(row);
686                                 }
687                         }
688         
689                                 public class Order_DetailsRow : DataRow 
690                         {
691             
692                                 private Order_DetailsDataTable tableOrder_Details;
693             
694                                 internal Order_DetailsRow(DataRowBuilder rb) : 
695                                         base(rb) 
696                                 {
697                                         this.tableOrder_Details = ((Order_DetailsDataTable)(this.Table));
698                                 }
699             
700                                 public int OrderID 
701                                 {
702                                         get 
703                                         {
704                                                 return ((int)(this[this.tableOrder_Details.OrderIDColumn]));
705                                         }
706                                         set 
707                                         {
708                                                 this[this.tableOrder_Details.OrderIDColumn] = value;
709                                         }
710                                 }
711             
712                                 public int ProductID 
713                                 {
714                                         get 
715                                         {
716                                                 return ((int)(this[this.tableOrder_Details.ProductIDColumn]));
717                                         }
718                                         set 
719                                         {
720                                                 this[this.tableOrder_Details.ProductIDColumn] = value;
721                                         }
722                                 }
723             
724                                 public Decimal UnitPrice 
725                                 {
726                                         get 
727                                         {
728                                                 return ((Decimal)(this[this.tableOrder_Details.UnitPriceColumn]));
729                                         }
730                                         set 
731                                         {
732                                                 this[this.tableOrder_Details.UnitPriceColumn] = value;
733                                         }
734                                 }
735             
736                                 public short Quantity 
737                                 {
738                                         get 
739                                         {
740                                                 return ((short)(this[this.tableOrder_Details.QuantityColumn]));
741                                         }
742                                         set 
743                                         {
744                                                 this[this.tableOrder_Details.QuantityColumn] = value;
745                                         }
746                                 }
747             
748                                 public string Discount 
749                                 {
750                                         get 
751                                         {
752                                                 try 
753                                                 {
754                                                         return ((string)(this[this.tableOrder_Details.DiscountColumn]));
755                                                 }
756                                                 catch (InvalidCastException e) 
757                                                 {
758                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
759                                                 }
760                                         }
761                                         set 
762                                         {
763                                                 this[this.tableOrder_Details.DiscountColumn] = value;
764                                         }
765                                 }
766             
767                                 public OrdersRow OrdersRow 
768                                 {
769                                         get 
770                                         {
771                                                 return ((OrdersRow)(this.GetParentRow(this.Table.ParentRelations["OrdersOrder_x0020_Details"])));
772                                         }
773                                         set 
774                                         {
775                                                 this.SetParentRow(value, this.Table.ParentRelations["OrdersOrder_x0020_Details"]);
776                                         }
777                                 }
778             
779                                 public bool IsDiscountNull() 
780                                 {
781                                         return this.IsNull(this.tableOrder_Details.DiscountColumn);
782                                 }
783             
784                                 public void SetDiscountNull() 
785                                 {
786                                         this[this.tableOrder_Details.DiscountColumn] = Convert.DBNull;
787                                 }
788                         }
789         
790                                 public class Order_DetailsRowChangeEvent : EventArgs 
791                         {
792             
793                                 private Order_DetailsRow eventRow;
794             
795                                 private DataRowAction eventAction;
796             
797                                 public Order_DetailsRowChangeEvent(Order_DetailsRow row, DataRowAction action) 
798                                 {
799                                         this.eventRow = row;
800                                         this.eventAction = action;
801                                 }
802             
803                                 public Order_DetailsRow Row 
804                                 {
805                                         get 
806                                         {
807                                                 return this.eventRow;
808                                         }
809                                 }
810             
811                                 public DataRowAction Action 
812                                 {
813                                         get 
814                                         {
815                                                 return this.eventAction;
816                                         }
817                                 }
818                         }
819         
820                                 public class OrdersDataTable : DataTable, IEnumerable 
821                         {
822             
823                                 private DataColumn columnOrderID;
824             
825                                 private DataColumn columnCustomerID;
826             
827                                 private DataColumn columnEmployeeID;
828             
829                                 private DataColumn columnOrderDate;
830             
831                                 private DataColumn columnRequiredDate;
832             
833                                 private DataColumn columnShippedDate;
834             
835                                 private DataColumn columnShipVia;
836             
837                                 private DataColumn columnFreight;
838             
839                                 private DataColumn columnShipName;
840             
841                                 private DataColumn columnShipAddress;
842             
843                                 private DataColumn columnShipCity;
844             
845                                 private DataColumn columnShipRegion;
846             
847                                 private DataColumn columnShipPostalCode;
848             
849                                 private DataColumn columnShipCountry;
850             
851                                 internal OrdersDataTable() : 
852                                         base("Orders") 
853                                 {
854                                         this.InitClass();
855                                 }
856             
857                                 internal OrdersDataTable(DataTable table) : 
858                                         base(table.TableName) 
859                                 {
860                                         if ((table.CaseSensitive != table.DataSet.CaseSensitive)) 
861                                         {
862                                                 this.CaseSensitive = table.CaseSensitive;
863                                         }
864                                         if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) 
865                                         {
866                                                 this.Locale = table.Locale;
867                                         }
868                                         if ((table.Namespace != table.DataSet.Namespace)) 
869                                         {
870                                                 this.Namespace = table.Namespace;
871                                         }
872                                         this.Prefix = table.Prefix;
873                                         this.MinimumCapacity = table.MinimumCapacity;
874                                         this.DisplayExpression = table.DisplayExpression;
875                                 }
876             
877                                 [Browsable(false)]
878                                 public int Count 
879                                 {
880                                         get 
881                                         {
882                                                 return this.Rows.Count;
883                                         }
884                                 }
885             
886                                 internal DataColumn OrderIDColumn 
887                                 {
888                                         get 
889                                         {
890                                                 return this.columnOrderID;
891                                         }
892                                 }
893             
894                                 internal DataColumn CustomerIDColumn 
895                                 {
896                                         get 
897                                         {
898                                                 return this.columnCustomerID;
899                                         }
900                                 }
901             
902                                 internal DataColumn EmployeeIDColumn 
903                                 {
904                                         get 
905                                         {
906                                                 return this.columnEmployeeID;
907                                         }
908                                 }
909             
910                                 internal DataColumn OrderDateColumn 
911                                 {
912                                         get 
913                                         {
914                                                 return this.columnOrderDate;
915                                         }
916                                 }
917             
918                                 internal DataColumn RequiredDateColumn 
919                                 {
920                                         get 
921                                         {
922                                                 return this.columnRequiredDate;
923                                         }
924                                 }
925             
926                                 internal DataColumn ShippedDateColumn 
927                                 {
928                                         get 
929                                         {
930                                                 return this.columnShippedDate;
931                                         }
932                                 }
933             
934                                 internal DataColumn ShipViaColumn 
935                                 {
936                                         get 
937                                         {
938                                                 return this.columnShipVia;
939                                         }
940                                 }
941             
942                                 internal DataColumn FreightColumn 
943                                 {
944                                         get 
945                                         {
946                                                 return this.columnFreight;
947                                         }
948                                 }
949             
950                                 internal DataColumn ShipNameColumn 
951                                 {
952                                         get 
953                                         {
954                                                 return this.columnShipName;
955                                         }
956                                 }
957             
958                                 internal DataColumn ShipAddressColumn 
959                                 {
960                                         get 
961                                         {
962                                                 return this.columnShipAddress;
963                                         }
964                                 }
965             
966                                 internal DataColumn ShipCityColumn 
967                                 {
968                                         get 
969                                         {
970                                                 return this.columnShipCity;
971                                         }
972                                 }
973             
974                                 internal DataColumn ShipRegionColumn 
975                                 {
976                                         get 
977                                         {
978                                                 return this.columnShipRegion;
979                                         }
980                                 }
981             
982                                 internal DataColumn ShipPostalCodeColumn 
983                                 {
984                                         get 
985                                         {
986                                                 return this.columnShipPostalCode;
987                                         }
988                                 }
989             
990                                 internal DataColumn ShipCountryColumn 
991                                 {
992                                         get 
993                                         {
994                                                 return this.columnShipCountry;
995                                         }
996                                 }
997             
998                                 public OrdersRow this[int index] 
999                                 {
1000                                         get 
1001                                         {
1002                                                 return ((OrdersRow)(this.Rows[index]));
1003                                         }
1004                                 }
1005             
1006                                 public event OrdersRowChangeEventHandler OrdersRowChanged;
1007             
1008                                 public event OrdersRowChangeEventHandler OrdersRowChanging;
1009             
1010                                 public event OrdersRowChangeEventHandler OrdersRowDeleted;
1011             
1012                                 public event OrdersRowChangeEventHandler OrdersRowDeleting;
1013             
1014                                 public void AddOrdersRow(OrdersRow row) 
1015                                 {
1016                                         this.Rows.Add(row);
1017                                 }
1018             
1019                                 public OrdersRow AddOrdersRow(string CustomerID, int EmployeeID, DateTime OrderDate, DateTime RequiredDate, DateTime ShippedDate, int ShipVia, Decimal Freight, string ShipName, string ShipAddress, string ShipCity, string ShipRegion, string ShipPostalCode, string ShipCountry) 
1020                                 {
1021                                         OrdersRow rowOrdersRow = ((OrdersRow)(this.NewRow()));
1022                                         rowOrdersRow.ItemArray = new object[] {
1023                                                                                                                           null,
1024                                                                                                                           CustomerID,
1025                                                                                                                           EmployeeID,
1026                                                                                                                           OrderDate,
1027                                                                                                                           RequiredDate,
1028                                                                                                                           ShippedDate,
1029                                                                                                                           ShipVia,
1030                                                                                                                           Freight,
1031                                                                                                                           ShipName,
1032                                                                                                                           ShipAddress,
1033                                                                                                                           ShipCity,
1034                                                                                                                           ShipRegion,
1035                                                                                                                           ShipPostalCode,
1036                                                                                                                           ShipCountry};
1037                                         this.Rows.Add(rowOrdersRow);
1038                                         return rowOrdersRow;
1039                                 }
1040             
1041                                 public OrdersRow FindByOrderID(int OrderID) 
1042                                 {
1043                                         return ((OrdersRow)(this.Rows.Find(new object[] {
1044                                                                                                                                                 OrderID})));
1045                                 }
1046             
1047                                 public IEnumerator GetEnumerator() 
1048                                 {
1049                                         return this.Rows.GetEnumerator();
1050                                 }
1051             
1052                                 public override DataTable Clone() 
1053                                 {
1054                                         OrdersDataTable cln = ((OrdersDataTable)(base.Clone()));
1055                                         cln.InitVars();
1056                                         return cln;
1057                                 }
1058             
1059                                 protected override DataTable CreateInstance() 
1060                                 {
1061                                         return new OrdersDataTable();
1062                                 }
1063             
1064                                 internal void InitVars() 
1065                                 {
1066                                         this.columnOrderID = this.Columns["OrderID"];
1067                                         this.columnCustomerID = this.Columns["CustomerID"];
1068                                         this.columnEmployeeID = this.Columns["EmployeeID"];
1069                                         this.columnOrderDate = this.Columns["OrderDate"];
1070                                         this.columnRequiredDate = this.Columns["RequiredDate"];
1071                                         this.columnShippedDate = this.Columns["ShippedDate"];
1072                                         this.columnShipVia = this.Columns["ShipVia"];
1073                                         this.columnFreight = this.Columns["Freight"];
1074                                         this.columnShipName = this.Columns["ShipName"];
1075                                         this.columnShipAddress = this.Columns["ShipAddress"];
1076                                         this.columnShipCity = this.Columns["ShipCity"];
1077                                         this.columnShipRegion = this.Columns["ShipRegion"];
1078                                         this.columnShipPostalCode = this.Columns["ShipPostalCode"];
1079                                         this.columnShipCountry = this.Columns["ShipCountry"];
1080                                 }
1081             
1082                                 private void InitClass() 
1083                                 {
1084                                         this.columnOrderID = new DataColumn("OrderID", typeof(int), null, MappingType.Element);
1085                                         this.Columns.Add(this.columnOrderID);
1086                                         this.columnCustomerID = new DataColumn("CustomerID", typeof(string), null, MappingType.Element);
1087                                         this.Columns.Add(this.columnCustomerID);
1088                                         this.columnEmployeeID = new DataColumn("EmployeeID", typeof(int), null, MappingType.Element);
1089                                         this.Columns.Add(this.columnEmployeeID);
1090                                         this.columnOrderDate = new DataColumn("OrderDate", typeof(DateTime), null, MappingType.Element);
1091                                         this.Columns.Add(this.columnOrderDate);
1092                                         this.columnRequiredDate = new DataColumn("RequiredDate", typeof(DateTime), null, MappingType.Element);
1093                                         this.Columns.Add(this.columnRequiredDate);
1094                                         this.columnShippedDate = new DataColumn("ShippedDate", typeof(DateTime), null, MappingType.Element);
1095                                         this.Columns.Add(this.columnShippedDate);
1096                                         this.columnShipVia = new DataColumn("ShipVia", typeof(int), null, MappingType.Element);
1097                                         this.Columns.Add(this.columnShipVia);
1098                                         this.columnFreight = new DataColumn("Freight", typeof(Decimal), null, MappingType.Element);
1099                                         this.Columns.Add(this.columnFreight);
1100                                         this.columnShipName = new DataColumn("ShipName", typeof(string), null, MappingType.Element);
1101                                         this.Columns.Add(this.columnShipName);
1102                                         this.columnShipAddress = new DataColumn("ShipAddress", typeof(string), null, MappingType.Element);
1103                                         this.Columns.Add(this.columnShipAddress);
1104                                         this.columnShipCity = new DataColumn("ShipCity", typeof(string), null, MappingType.Element);
1105                                         this.Columns.Add(this.columnShipCity);
1106                                         this.columnShipRegion = new DataColumn("ShipRegion", typeof(string), null, MappingType.Element);
1107                                         this.Columns.Add(this.columnShipRegion);
1108                                         this.columnShipPostalCode = new DataColumn("ShipPostalCode", typeof(string), null, MappingType.Element);
1109                                         this.Columns.Add(this.columnShipPostalCode);
1110                                         this.columnShipCountry = new DataColumn("ShipCountry", typeof(string), null, MappingType.Element);
1111                                         this.Columns.Add(this.columnShipCountry);
1112                                         this.Constraints.Add(new UniqueConstraint("Constraint1", new DataColumn[] {
1113                                                                                                                                                                                                   this.columnOrderID}, true));
1114                                         this.columnOrderID.AutoIncrement = true;
1115                                         this.columnOrderID.AllowDBNull = false;
1116                                         this.columnOrderID.ReadOnly = true;
1117                                         this.columnOrderID.Unique = true;
1118                                 }
1119             
1120                                 public OrdersRow NewOrdersRow() 
1121                                 {
1122                                         return ((OrdersRow)(this.NewRow()));
1123                                 }
1124             
1125                                 protected override DataRow NewRowFromBuilder(DataRowBuilder builder) 
1126                                 {
1127                                         return new OrdersRow(builder);
1128                                 }
1129             
1130                                 protected override Type GetRowType() 
1131                                 {
1132                                         return typeof(OrdersRow);
1133                                 }
1134             
1135                                 protected override void OnRowChanged(DataRowChangeEventArgs e) 
1136                                 {
1137                                         base.OnRowChanged(e);
1138                                         if ((this.OrdersRowChanged != null)) 
1139                                         {
1140                                                 this.OrdersRowChanged(this, new OrdersRowChangeEvent(((OrdersRow)(e.Row)), e.Action));
1141                                         }
1142                                 }
1143             
1144                                 protected override void OnRowChanging(DataRowChangeEventArgs e) 
1145                                 {
1146                                         base.OnRowChanging(e);
1147                                         if ((this.OrdersRowChanging != null)) 
1148                                         {
1149                                                 this.OrdersRowChanging(this, new OrdersRowChangeEvent(((OrdersRow)(e.Row)), e.Action));
1150                                         }
1151                                 }
1152             
1153                                 protected override void OnRowDeleted(DataRowChangeEventArgs e) 
1154                                 {
1155                                         base.OnRowDeleted(e);
1156                                         if ((this.OrdersRowDeleted != null)) 
1157                                         {
1158                                                 this.OrdersRowDeleted(this, new OrdersRowChangeEvent(((OrdersRow)(e.Row)), e.Action));
1159                                         }
1160                                 }
1161             
1162                                 protected override void OnRowDeleting(DataRowChangeEventArgs e) 
1163                                 {
1164                                         base.OnRowDeleting(e);
1165                                         if ((this.OrdersRowDeleting != null)) 
1166                                         {
1167                                                 this.OrdersRowDeleting(this, new OrdersRowChangeEvent(((OrdersRow)(e.Row)), e.Action));
1168                                         }
1169                                 }
1170             
1171                                 public void RemoveOrdersRow(OrdersRow row) 
1172                                 {
1173                                         this.Rows.Remove(row);
1174                                 }
1175                         }
1176         
1177                                 public class OrdersRow : DataRow 
1178                         {
1179             
1180                                 private OrdersDataTable tableOrders;
1181             
1182                                 internal OrdersRow(DataRowBuilder rb) : 
1183                                         base(rb) 
1184                                 {
1185                                         this.tableOrders = ((OrdersDataTable)(this.Table));
1186                                 }
1187             
1188                                 public int OrderID 
1189                                 {
1190                                         get 
1191                                         {
1192                                                 return ((int)(this[this.tableOrders.OrderIDColumn]));
1193                                         }
1194                                         set 
1195                                         {
1196                                                 this[this.tableOrders.OrderIDColumn] = value;
1197                                         }
1198                                 }
1199             
1200                                 public string CustomerID 
1201                                 {
1202                                         get 
1203                                         {
1204                                                 try 
1205                                                 {
1206                                                         return ((string)(this[this.tableOrders.CustomerIDColumn]));
1207                                                 }
1208                                                 catch (InvalidCastException e) 
1209                                                 {
1210                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1211                                                 }
1212                                         }
1213                                         set 
1214                                         {
1215                                                 this[this.tableOrders.CustomerIDColumn] = value;
1216                                         }
1217                                 }
1218             
1219                                 public int EmployeeID 
1220                                 {
1221                                         get 
1222                                         {
1223                                                 try 
1224                                                 {
1225                                                         return ((int)(this[this.tableOrders.EmployeeIDColumn]));
1226                                                 }
1227                                                 catch (InvalidCastException e) 
1228                                                 {
1229                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1230                                                 }
1231                                         }
1232                                         set 
1233                                         {
1234                                                 this[this.tableOrders.EmployeeIDColumn] = value;
1235                                         }
1236                                 }
1237             
1238                                 public DateTime OrderDate 
1239                                 {
1240                                         get 
1241                                         {
1242                                                 try 
1243                                                 {
1244                                                         return ((DateTime)(this[this.tableOrders.OrderDateColumn]));
1245                                                 }
1246                                                 catch (InvalidCastException e) 
1247                                                 {
1248                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1249                                                 }
1250                                         }
1251                                         set 
1252                                         {
1253                                                 this[this.tableOrders.OrderDateColumn] = value;
1254                                         }
1255                                 }
1256             
1257                                 public DateTime RequiredDate 
1258                                 {
1259                                         get 
1260                                         {
1261                                                 try 
1262                                                 {
1263                                                         return ((DateTime)(this[this.tableOrders.RequiredDateColumn]));
1264                                                 }
1265                                                 catch (InvalidCastException e) 
1266                                                 {
1267                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1268                                                 }
1269                                         }
1270                                         set 
1271                                         {
1272                                                 this[this.tableOrders.RequiredDateColumn] = value;
1273                                         }
1274                                 }
1275             
1276                                 public DateTime ShippedDate 
1277                                 {
1278                                         get 
1279                                         {
1280                                                 try 
1281                                                 {
1282                                                         return ((DateTime)(this[this.tableOrders.ShippedDateColumn]));
1283                                                 }
1284                                                 catch (InvalidCastException e) 
1285                                                 {
1286                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1287                                                 }
1288                                         }
1289                                         set 
1290                                         {
1291                                                 this[this.tableOrders.ShippedDateColumn] = value;
1292                                         }
1293                                 }
1294             
1295                                 public int ShipVia 
1296                                 {
1297                                         get 
1298                                         {
1299                                                 try 
1300                                                 {
1301                                                         return ((int)(this[this.tableOrders.ShipViaColumn]));
1302                                                 }
1303                                                 catch (InvalidCastException e) 
1304                                                 {
1305                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1306                                                 }
1307                                         }
1308                                         set 
1309                                         {
1310                                                 this[this.tableOrders.ShipViaColumn] = value;
1311                                         }
1312                                 }
1313             
1314                                 public Decimal Freight 
1315                                 {
1316                                         get 
1317                                         {
1318                                                 try 
1319                                                 {
1320                                                         return ((Decimal)(this[this.tableOrders.FreightColumn]));
1321                                                 }
1322                                                 catch (InvalidCastException e) 
1323                                                 {
1324                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1325                                                 }
1326                                         }
1327                                         set 
1328                                         {
1329                                                 this[this.tableOrders.FreightColumn] = value;
1330                                         }
1331                                 }
1332             
1333                                 public string ShipName 
1334                                 {
1335                                         get 
1336                                         {
1337                                                 try 
1338                                                 {
1339                                                         return ((string)(this[this.tableOrders.ShipNameColumn]));
1340                                                 }
1341                                                 catch (InvalidCastException e) 
1342                                                 {
1343                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1344                                                 }
1345                                         }
1346                                         set 
1347                                         {
1348                                                 this[this.tableOrders.ShipNameColumn] = value;
1349                                         }
1350                                 }
1351             
1352                                 public string ShipAddress 
1353                                 {
1354                                         get 
1355                                         {
1356                                                 try 
1357                                                 {
1358                                                         return ((string)(this[this.tableOrders.ShipAddressColumn]));
1359                                                 }
1360                                                 catch (InvalidCastException e) 
1361                                                 {
1362                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1363                                                 }
1364                                         }
1365                                         set 
1366                                         {
1367                                                 this[this.tableOrders.ShipAddressColumn] = value;
1368                                         }
1369                                 }
1370             
1371                                 public string ShipCity 
1372                                 {
1373                                         get 
1374                                         {
1375                                                 try 
1376                                                 {
1377                                                         return ((string)(this[this.tableOrders.ShipCityColumn]));
1378                                                 }
1379                                                 catch (InvalidCastException e) 
1380                                                 {
1381                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1382                                                 }
1383                                         }
1384                                         set 
1385                                         {
1386                                                 this[this.tableOrders.ShipCityColumn] = value;
1387                                         }
1388                                 }
1389             
1390                                 public string ShipRegion 
1391                                 {
1392                                         get 
1393                                         {
1394                                                 try 
1395                                                 {
1396                                                         return ((string)(this[this.tableOrders.ShipRegionColumn]));
1397                                                 }
1398                                                 catch (InvalidCastException e) 
1399                                                 {
1400                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1401                                                 }
1402                                         }
1403                                         set 
1404                                         {
1405                                                 this[this.tableOrders.ShipRegionColumn] = value;
1406                                         }
1407                                 }
1408             
1409                                 public string ShipPostalCode 
1410                                 {
1411                                         get 
1412                                         {
1413                                                 try 
1414                                                 {
1415                                                         return ((string)(this[this.tableOrders.ShipPostalCodeColumn]));
1416                                                 }
1417                                                 catch (InvalidCastException e) 
1418                                                 {
1419                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1420                                                 }
1421                                         }
1422                                         set 
1423                                         {
1424                                                 this[this.tableOrders.ShipPostalCodeColumn] = value;
1425                                         }
1426                                 }
1427             
1428                                 public string ShipCountry 
1429                                 {
1430                                         get 
1431                                         {
1432                                                 try 
1433                                                 {
1434                                                         return ((string)(this[this.tableOrders.ShipCountryColumn]));
1435                                                 }
1436                                                 catch (InvalidCastException e) 
1437                                                 {
1438                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1439                                                 }
1440                                         }
1441                                         set 
1442                                         {
1443                                                 this[this.tableOrders.ShipCountryColumn] = value;
1444                                         }
1445                                 }
1446             
1447                                 public bool IsCustomerIDNull() 
1448                                 {
1449                                         return this.IsNull(this.tableOrders.CustomerIDColumn);
1450                                 }
1451             
1452                                 public void SetCustomerIDNull() 
1453                                 {
1454                                         this[this.tableOrders.CustomerIDColumn] = Convert.DBNull;
1455                                 }
1456             
1457                                 public bool IsEmployeeIDNull() 
1458                                 {
1459                                         return this.IsNull(this.tableOrders.EmployeeIDColumn);
1460                                 }
1461             
1462                                 public void SetEmployeeIDNull() 
1463                                 {
1464                                         this[this.tableOrders.EmployeeIDColumn] = Convert.DBNull;
1465                                 }
1466             
1467                                 public bool IsOrderDateNull() 
1468                                 {
1469                                         return this.IsNull(this.tableOrders.OrderDateColumn);
1470                                 }
1471             
1472                                 public void SetOrderDateNull() 
1473                                 {
1474                                         this[this.tableOrders.OrderDateColumn] = Convert.DBNull;
1475                                 }
1476             
1477                                 public bool IsRequiredDateNull() 
1478                                 {
1479                                         return this.IsNull(this.tableOrders.RequiredDateColumn);
1480                                 }
1481             
1482                                 public void SetRequiredDateNull() 
1483                                 {
1484                                         this[this.tableOrders.RequiredDateColumn] = Convert.DBNull;
1485                                 }
1486             
1487                                 public bool IsShippedDateNull() 
1488                                 {
1489                                         return this.IsNull(this.tableOrders.ShippedDateColumn);
1490                                 }
1491             
1492                                 public void SetShippedDateNull() 
1493                                 {
1494                                         this[this.tableOrders.ShippedDateColumn] = Convert.DBNull;
1495                                 }
1496             
1497                                 public bool IsShipViaNull() 
1498                                 {
1499                                         return this.IsNull(this.tableOrders.ShipViaColumn);
1500                                 }
1501             
1502                                 public void SetShipViaNull() 
1503                                 {
1504                                         this[this.tableOrders.ShipViaColumn] = Convert.DBNull;
1505                                 }
1506             
1507                                 public bool IsFreightNull() 
1508                                 {
1509                                         return this.IsNull(this.tableOrders.FreightColumn);
1510                                 }
1511             
1512                                 public void SetFreightNull() 
1513                                 {
1514                                         this[this.tableOrders.FreightColumn] = Convert.DBNull;
1515                                 }
1516             
1517                                 public bool IsShipNameNull() 
1518                                 {
1519                                         return this.IsNull(this.tableOrders.ShipNameColumn);
1520                                 }
1521             
1522                                 public void SetShipNameNull() 
1523                                 {
1524                                         this[this.tableOrders.ShipNameColumn] = Convert.DBNull;
1525                                 }
1526             
1527                                 public bool IsShipAddressNull() 
1528                                 {
1529                                         return this.IsNull(this.tableOrders.ShipAddressColumn);
1530                                 }
1531             
1532                                 public void SetShipAddressNull() 
1533                                 {
1534                                         this[this.tableOrders.ShipAddressColumn] = Convert.DBNull;
1535                                 }
1536             
1537                                 public bool IsShipCityNull() 
1538                                 {
1539                                         return this.IsNull(this.tableOrders.ShipCityColumn);
1540                                 }
1541             
1542                                 public void SetShipCityNull() 
1543                                 {
1544                                         this[this.tableOrders.ShipCityColumn] = Convert.DBNull;
1545                                 }
1546             
1547                                 public bool IsShipRegionNull() 
1548                                 {
1549                                         return this.IsNull(this.tableOrders.ShipRegionColumn);
1550                                 }
1551             
1552                                 public void SetShipRegionNull() 
1553                                 {
1554                                         this[this.tableOrders.ShipRegionColumn] = Convert.DBNull;
1555                                 }
1556             
1557                                 public bool IsShipPostalCodeNull() 
1558                                 {
1559                                         return this.IsNull(this.tableOrders.ShipPostalCodeColumn);
1560                                 }
1561             
1562                                 public void SetShipPostalCodeNull() 
1563                                 {
1564                                         this[this.tableOrders.ShipPostalCodeColumn] = Convert.DBNull;
1565                                 }
1566             
1567                                 public bool IsShipCountryNull() 
1568                                 {
1569                                         return this.IsNull(this.tableOrders.ShipCountryColumn);
1570                                 }
1571             
1572                                 public void SetShipCountryNull() 
1573                                 {
1574                                         this[this.tableOrders.ShipCountryColumn] = Convert.DBNull;
1575                                 }
1576             
1577                                 public Order_DetailsRow[] GetOrder_DetailsRows() 
1578                                 {
1579                                         return ((Order_DetailsRow[])(this.GetChildRows(this.Table.ChildRelations["OrdersOrder_x0020_Details"])));
1580                                 }
1581                         }
1582         
1583                                 public class OrdersRowChangeEvent : EventArgs 
1584                         {
1585             
1586                                 private OrdersRow eventRow;
1587             
1588                                 private DataRowAction eventAction;
1589             
1590                                 public OrdersRowChangeEvent(OrdersRow row, DataRowAction action) 
1591                                 {
1592                                         this.eventRow = row;
1593                                         this.eventAction = action;
1594                                 }
1595             
1596                                 public OrdersRow Row 
1597                                 {
1598                                         get 
1599                                         {
1600                                                 return this.eventRow;
1601                                         }
1602                                 }
1603             
1604                                 public DataRowAction Action 
1605                                 {
1606                                         get 
1607                                         {
1608                                                 return this.eventAction;
1609                                         }
1610                                 }
1611                         }
1612                 }
1613         }
1614 }