Example #1
0
 /// <summary>
 /// Deserialize the object
 /// </summary>
 public virtual void DeserializeJson(JToken inputObject)
 {
     if (inputObject != null && inputObject.Type != JTokenType.Null)
     {
         JToken colorValue = inputObject["Color"];
         if (colorValue != null && colorValue.Type != JTokenType.Null)
         {
             this.Color = ((string)colorValue);
         }
         JToken discontinuedDateValue = inputObject["DiscontinuedDate"];
         if (discontinuedDateValue != null && discontinuedDateValue.Type != JTokenType.Null)
         {
             this.DiscontinuedDate = ((string)discontinuedDateValue);
         }
         JToken listPriceValue = inputObject["ListPrice"];
         if (listPriceValue != null && listPriceValue.Type != JTokenType.Null)
         {
             this.ListPrice = ((double)listPriceValue);
         }
         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 productCategoryValue = inputObject["ProductCategory"];
         if (productCategoryValue != null && productCategoryValue.Type != JTokenType.Null)
         {
             ProductCategory productCategory = new ProductCategory();
             productCategory.DeserializeJson(productCategoryValue);
             this.ProductCategory = productCategory;
         }
         JToken productCategoryIDValue = inputObject["ProductCategoryID"];
         if (productCategoryIDValue != null && productCategoryIDValue.Type != JTokenType.Null)
         {
             this.ProductCategoryID = ((string)productCategoryIDValue);
         }
         JToken productIDValue = inputObject["ProductID"];
         if (productIDValue != null && productIDValue.Type != JTokenType.Null)
         {
             this.ProductID = ((int)productIDValue);
         }
         JToken productModelValue = inputObject["ProductModel"];
         if (productModelValue != null && productModelValue.Type != JTokenType.Null)
         {
             ProductModel productModel = new ProductModel();
             productModel.DeserializeJson(productModelValue);
             this.ProductModel = productModel;
         }
         JToken productModelIDValue = inputObject["ProductModelID"];
         if (productModelIDValue != null && productModelIDValue.Type != JTokenType.Null)
         {
             this.ProductModelID = ((string)productModelIDValue);
         }
         JToken productNumberValue = inputObject["ProductNumber"];
         if (productNumberValue != null && productNumberValue.Type != JTokenType.Null)
         {
             this.ProductNumber = ((string)productNumberValue);
         }
         JToken rowguidValue = inputObject["rowguid"];
         if (rowguidValue != null && rowguidValue.Type != JTokenType.Null)
         {
             this.Rowguid = ((string)rowguidValue);
         }
         JToken salesOrderDetailsSequence = ((JToken)inputObject["SalesOrderDetails"]);
         if (salesOrderDetailsSequence != null && salesOrderDetailsSequence.Type != JTokenType.Null)
         {
             foreach (JToken salesOrderDetailsValue in ((JArray)salesOrderDetailsSequence))
             {
                 SalesOrderDetail salesOrderDetail = new SalesOrderDetail();
                 salesOrderDetail.DeserializeJson(salesOrderDetailsValue);
                 this.SalesOrderDetails.Add(salesOrderDetail);
             }
         }
         JToken sellEndDateValue = inputObject["SellEndDate"];
         if (sellEndDateValue != null && sellEndDateValue.Type != JTokenType.Null)
         {
             this.SellEndDate = ((string)sellEndDateValue);
         }
         JToken sellStartDateValue = inputObject["SellStartDate"];
         if (sellStartDateValue != null && sellStartDateValue.Type != JTokenType.Null)
         {
             this.SellStartDate = ((DateTimeOffset)sellStartDateValue);
         }
         JToken sizeValue = inputObject["Size"];
         if (sizeValue != null && sizeValue.Type != JTokenType.Null)
         {
             this.Size = ((string)sizeValue);
         }
         JToken standardCostValue = inputObject["StandardCost"];
         if (standardCostValue != null && standardCostValue.Type != JTokenType.Null)
         {
             this.StandardCost = ((double)standardCostValue);
         }
         JToken thumbNailPhotoValue = inputObject["ThumbNailPhoto"];
         if (thumbNailPhotoValue != null && thumbNailPhotoValue.Type != JTokenType.Null)
         {
             this.ThumbNailPhoto = ((string)thumbNailPhotoValue);
         }
         JToken thumbnailPhotoFileNameValue = inputObject["ThumbnailPhotoFileName"];
         if (thumbnailPhotoFileNameValue != null && thumbnailPhotoFileNameValue.Type != JTokenType.Null)
         {
             this.ThumbnailPhotoFileName = ((string)thumbnailPhotoFileNameValue);
         }
         JToken weightValue = inputObject["Weight"];
         if (weightValue != null && weightValue.Type != JTokenType.Null)
         {
             this.Weight = ((string)weightValue);
         }
     }
 }
 /// <summary>
 /// Deserialize the object
 /// </summary>
 public virtual void DeserializeJson(JToken inputObject)
 {
     if (inputObject != null && inputObject.Type != JTokenType.Null)
     {
         JToken cultureValue = inputObject["Culture"];
         if (cultureValue != null && cultureValue.Type != JTokenType.Null)
         {
             this.Culture = ((string)cultureValue);
         }
         JToken modifiedDateValue = inputObject["ModifiedDate"];
         if (modifiedDateValue != null && modifiedDateValue.Type != JTokenType.Null)
         {
             this.ModifiedDate = ((DateTimeOffset)modifiedDateValue);
         }
         JToken productDescriptionValue = inputObject["ProductDescription"];
         if (productDescriptionValue != null && productDescriptionValue.Type != JTokenType.Null)
         {
             ProductDescription productDescription = new ProductDescription();
             productDescription.DeserializeJson(productDescriptionValue);
             this.ProductDescription = productDescription;
         }
         JToken productDescriptionIDValue = inputObject["ProductDescriptionID"];
         if (productDescriptionIDValue != null && productDescriptionIDValue.Type != JTokenType.Null)
         {
             this.ProductDescriptionID = ((int)productDescriptionIDValue);
         }
         JToken productModelValue = inputObject["ProductModel"];
         if (productModelValue != null && productModelValue.Type != JTokenType.Null)
         {
             ProductModel productModel = new ProductModel();
             productModel.DeserializeJson(productModelValue);
             this.ProductModel = productModel;
         }
         JToken productModelIDValue = inputObject["ProductModelID"];
         if (productModelIDValue != null && productModelIDValue.Type != JTokenType.Null)
         {
             this.ProductModelID = ((int)productModelIDValue);
         }
         JToken rowguidValue = inputObject["rowguid"];
         if (rowguidValue != null && rowguidValue.Type != JTokenType.Null)
         {
             this.Rowguid = ((string)rowguidValue);
         }
     }
 }