Guest User

Untitled

a guest
May 20th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.74 KB | None | 0 0
  1. namespace STPMonoDroid.DataTypes {
  2.     public class Sku {
  3.  
  4.         public string Id { get; set; }
  5.  
  6.         // these properties are unique to Skus within the Cart
  7.         public int QuantityAvailable { get; set; }
  8.         public decimal ListPrice { get; set; }
  9.         public decimal FinalPrice { get; set; }
  10.         public string ColorCode { get; set; }
  11.         public bool BackOrdered { get; set; }
  12.         public List<SkuAttribute> Attributes { get; set; }
  13.         public Dictionary<string, string> OrderedAttributes { get; set; }
  14.  
  15.         // these properties are unique to Skus within the Cart
  16.         public string Url { get; set; }         // not avail outside of cart b/c it's avail in the Product object
  17.         public string WebUrl {get;set;}         // not avail outside of cart b/c it's avail in the Product object
  18.         public string RemoveUrl { get; set; }   // WARNING: this removes all by default
  19.         public int Quantity { get; set; }       // How many are in the cart
  20.  
  21.  
  22.         // the way skus are packaged in the API is awkward to work with
  23.         // rebuild relationship as a CategoryName = CategoryValue dictionary
  24.         public void SortAttributes() {
  25.             if (Attributes != null && Attributes.Count > 0) {
  26.                 OrderedAttributes = new Dictionary<string, string>();
  27.                 for (int i = 0; i < Attributes.Count; i++) {
  28.                     SkuAttribute attr = Attributes[i];
  29.                     OrderedAttributes[attr.Category] = attr.CategoryValue;
  30.                 }
  31.             }
  32.         }
  33.     }
  34.  
  35.     public class SkuAttribute {
  36.         public string Category { get; set; }
  37.         public string CategoryValue { get; set; }
  38.         public string CategoryValueDescription { get; set; }
  39.     }
  40. }
Add Comment
Please, Sign In to add comment