예제 #1
0
 /// <summary>
 /// Deserialize the object
 /// </summary>
 public virtual void DeserializeJson(JToken inputObject)
 {
     if (inputObject != null && inputObject.Type != JTokenType.Null)
     {
         JToken catalogDescriptionValue = inputObject["CatalogDescription"];
         if (catalogDescriptionValue != null && catalogDescriptionValue.Type != JTokenType.Null)
         {
             this.CatalogDescription = ((string)catalogDescriptionValue);
         }
         JToken modifiedDateValue = inputObject["ModifiedDate"];
         if (modifiedDateValue != null && modifiedDateValue.Type != JTokenType.Null)
         {
             this.ModifiedDate = ((DateTimeOffset)modifiedDateValue);
         }
         JToken nameValue = inputObject["Name"];
         if (nameValue != null && nameValue.Type != JTokenType.Null)
         {
             this.Name = ((string)nameValue);
         }
         JToken productModelIDValue = inputObject["ProductModelID"];
         if (productModelIDValue != null && productModelIDValue.Type != JTokenType.Null)
         {
             this.ProductModelID = ((int)productModelIDValue);
         }
         JToken productModelProductDescriptionsSequence = ((JToken)inputObject["ProductModelProductDescriptions"]);
         if (productModelProductDescriptionsSequence != null && productModelProductDescriptionsSequence.Type != JTokenType.Null)
         {
             foreach (JToken productModelProductDescriptionsValue in ((JArray)productModelProductDescriptionsSequence))
             {
                 ProductModelProductDescription productModelProductDescription = new ProductModelProductDescription();
                 productModelProductDescription.DeserializeJson(productModelProductDescriptionsValue);
                 this.ProductModelProductDescriptions.Add(productModelProductDescription);
             }
         }
         JToken productsSequence = ((JToken)inputObject["Products"]);
         if (productsSequence != null && productsSequence.Type != JTokenType.Null)
         {
             foreach (JToken productsValue in ((JArray)productsSequence))
             {
                 Product product = new Product();
                 product.DeserializeJson(productsValue);
                 this.Products.Add(product);
             }
         }
         JToken rowguidValue = inputObject["rowguid"];
         if (rowguidValue != null && rowguidValue.Type != JTokenType.Null)
         {
             this.Rowguid = ((string)rowguidValue);
         }
     }
 }
 /// <summary>
 /// Deserialize the object
 /// </summary>
 public virtual void DeserializeJson(JToken inputObject)
 {
     if (inputObject != null && inputObject.Type != JTokenType.Null)
     {
         JToken lineTotalValue = inputObject["LineTotal"];
         if (lineTotalValue != null && lineTotalValue.Type != JTokenType.Null)
         {
             this.LineTotal = ((double)lineTotalValue);
         }
         JToken modifiedDateValue = inputObject["ModifiedDate"];
         if (modifiedDateValue != null && modifiedDateValue.Type != JTokenType.Null)
         {
             this.ModifiedDate = ((DateTimeOffset)modifiedDateValue);
         }
         JToken orderQtyValue = inputObject["OrderQty"];
         if (orderQtyValue != null && orderQtyValue.Type != JTokenType.Null)
         {
             this.OrderQty = ((int)orderQtyValue);
         }
         JToken productValue = inputObject["Product"];
         if (productValue != null && productValue.Type != JTokenType.Null)
         {
             Product product = new Product();
             product.DeserializeJson(productValue);
             this.Product = product;
         }
         JToken productIDValue = inputObject["ProductID"];
         if (productIDValue != null && productIDValue.Type != JTokenType.Null)
         {
             this.ProductID = ((int)productIDValue);
         }
         JToken rowguidValue = inputObject["rowguid"];
         if (rowguidValue != null && rowguidValue.Type != JTokenType.Null)
         {
             this.Rowguid = ((string)rowguidValue);
         }
         JToken salesOrderDetailIDValue = inputObject["SalesOrderDetailID"];
         if (salesOrderDetailIDValue != null && salesOrderDetailIDValue.Type != JTokenType.Null)
         {
             this.SalesOrderDetailID = ((int)salesOrderDetailIDValue);
         }
         JToken salesOrderIDValue = inputObject["SalesOrderID"];
         if (salesOrderIDValue != null && salesOrderIDValue.Type != JTokenType.Null)
         {
             this.SalesOrderID = ((int)salesOrderIDValue);
         }
         JToken unitPriceValue = inputObject["UnitPrice"];
         if (unitPriceValue != null && unitPriceValue.Type != JTokenType.Null)
         {
             this.UnitPrice = ((double)unitPriceValue);
         }
         JToken unitPriceDiscountValue = inputObject["UnitPriceDiscount"];
         if (unitPriceDiscountValue != null && unitPriceDiscountValue.Type != JTokenType.Null)
         {
             this.UnitPriceDiscount = ((double)unitPriceDiscountValue);
         }
     }
 }
 /// <summary>
 /// Deserialize the object
 /// </summary>
 public virtual void DeserializeJson(JToken inputObject)
 {
     if (inputObject != null && inputObject.Type != JTokenType.Null)
     {
         JToken modifiedDateValue = inputObject["ModifiedDate"];
         if (modifiedDateValue != null && modifiedDateValue.Type != JTokenType.Null)
         {
             this.ModifiedDate = ((DateTimeOffset)modifiedDateValue);
         }
         JToken nameValue = inputObject["Name"];
         if (nameValue != null && nameValue.Type != JTokenType.Null)
         {
             this.Name = ((string)nameValue);
         }
         JToken parentProductCategoryValue = inputObject["ParentProductCategory"];
         if (parentProductCategoryValue != null && parentProductCategoryValue.Type != JTokenType.Null)
         {
             ProductCategory productCategory = new ProductCategory();
             productCategory.DeserializeJson(parentProductCategoryValue);
             this.ParentProductCategory = productCategory;
         }
         JToken parentProductCategoryIDValue = inputObject["ParentProductCategoryID"];
         if (parentProductCategoryIDValue != null && parentProductCategoryIDValue.Type != JTokenType.Null)
         {
             this.ParentProductCategoryID = ((string)parentProductCategoryIDValue);
         }
         JToken productCategoriesSequence = ((JToken)inputObject["ProductCategories"]);
         if (productCategoriesSequence != null && productCategoriesSequence.Type != JTokenType.Null)
         {
             foreach (JToken productCategoriesValue in ((JArray)productCategoriesSequence))
             {
                 ProductCategory productCategory2 = new ProductCategory();
                 productCategory2.DeserializeJson(productCategoriesValue);
                 this.ProductCategories.Add(productCategory2);
             }
         }
         JToken productCategoryIDValue = inputObject["ProductCategoryID"];
         if (productCategoryIDValue != null && productCategoryIDValue.Type != JTokenType.Null)
         {
             this.ProductCategoryID = ((int)productCategoryIDValue);
         }
         JToken productsSequence = ((JToken)inputObject["Products"]);
         if (productsSequence != null && productsSequence.Type != JTokenType.Null)
         {
             foreach (JToken productsValue in ((JArray)productsSequence))
             {
                 Product product = new Product();
                 product.DeserializeJson(productsValue);
                 this.Products.Add(product);
             }
         }
         JToken rowguidValue = inputObject["rowguid"];
         if (rowguidValue != null && rowguidValue.Type != JTokenType.Null)
         {
             this.Rowguid = ((string)rowguidValue);
         }
     }
 }