public string GetContents() { var sb = new StringBuilder(); sb.Append(JsonMaker.MakeKey("orders")); sb.Append(JsonMaker.AddSquareBrackets(_orders.MakeOrdersItem())); return(JsonMaker.AddCurlyBrackets(sb.ToString())); }
public string MakeOrderItem() { var sb = new StringBuilder(); sb.Append(JsonMaker.MakeItem("id", GetOrderId())); sb.Append(JsonMaker.MakeKey("products")); sb.Append(MakeOrderAllProduct()); return(JsonMaker.AddCurlyBrackets(sb.ToString())); }
public string MakeProductItem() { var sb = new StringBuilder(); sb.Append(JsonMaker.MakeItem("code", Code)); sb.Append(JsonMaker.MakeItem("color", _colorStr[Color])); if (Size != Product.SIZE_NOT_APPLICABLE) { sb.Append(JsonMaker.MakeItem("size", _sizeStr[Size])); } sb.Append(JsonMaker.MakeItem("price", (decimal)Price)); sb.Append(JsonMaker.MakeItemWithoutCama("currency", Currency)); return(JsonMaker.AddCurlyBrackets(sb.ToString())); }
private string MakeOrderAllProduct() { var sb = new StringBuilder(); for (var j = 0; j < GetProductsCount(); j++) { sb.Append(GetProduct(j).MakeProductItem()); if (j < GetProductsCount() - 1) { sb.Append(Symbol.CAMA); } } return(JsonMaker.AddSquareBrackets(sb.ToString())); }