private void EnrichWithFxMetadata([NotNull] JProperty metadataJson, [NotNull] TimeSeriesData timeSeriesData)
        {
            var metadatas = metadataJson.Children().Single();

            foreach (var metadataItem in metadatas)
            {
                var metadataProperty  = (JProperty)metadataItem;
                var metadataItemName  = metadataProperty.Name;
                var metadataItemValue = metadataProperty.Value.ToString();

                if (metadataItemName.Contains(FxMetaDataJsonToken.InformationToken))
                {
                    timeSeriesData.Type       = GetTimeSeriesType(metadataItemValue);
                    timeSeriesData.IsAdjusted = IsAdjusted(metadataItemValue);
                }
                else if (metadataItemName.Contains(FxMetaDataJsonToken.RefreshTimeToken))
                {
                    var refreshTime = metadataItemValue.Replace("(end of day)", string.Empty).Trim().ParseDateTime();
                    timeSeriesData.LastRefreshedUtc = DateTime.SpecifyKind(refreshTime, DateTimeKind.Local);
                }
                else if (metadataItemName.Contains(FxMetaDataJsonToken.SymbolFrom))
                {
                    timeSeriesData.Symbol = metadataItemValue;
                }
                else if (metadataItemName.Contains(FxMetaDataJsonToken.SymbolTo))
                {
                    timeSeriesData.Market = metadataItemValue;
                }
            }
        }
Ejemplo n.º 2
0
        //CORE API CALLS
        public static string CoreNewAgent()
        {
            try
            {
                string respUri    = null;
                string respMethod = null;

                var       prop = responseUri.Children <JProperty>();
                JProperty Data = prop.FirstOrDefault(b => b.Name == "new_agent");

                JProperty uri    = null;
                JProperty method = null;

                foreach (JToken x in Data.Children())
                {
                    var xdata = x.Children <JProperty>();
                    uri    = xdata.FirstOrDefault(b => b.Name == "response_uri");
                    method = xdata.FirstOrDefault(b => b.Name == "request_method");
                }
                respUri    = uri.Value.ToString();
                respMethod = method.Value.ToString();

                if (!string.IsNullOrEmpty(respUri) && !string.IsNullOrEmpty(respMethod))
                {
                    return(respUri + Delimeter + respMethod);
                }
            }
            catch
            {
                return("/rvl/v1/core/newagent" + Delimeter + HttpMethods.Post);
            }

            return("/rvl/v1/core/newagent" + Delimeter + HttpMethods.Post);
        }
Ejemplo n.º 3
0
 private void PopulateProducts()
 {
     using (StreamReader reader = File.OpenText(@"./DataSource/Products.json"))
     {
         var     json             = reader.ReadToEnd();
         JObject productsDocument = JObject.Parse(json);
         foreach (var child in productsDocument.Children())
         {
             JProperty childProperty = (JProperty)child;
             if (childProperty.Name == "Products")
             {
                 foreach (var rootElement in childProperty.Children())
                 {
                     foreach (var productJson in rootElement.Children())
                     {
                         var type    = (ProductType)((JObject)productJson).Value <int>("ProductType");
                         var product = ProductFactory.GetNewProduct(type, _container);
                         JsonConvert.PopulateObject(productJson.ToString(), product);
                         _products.Add(product.Id, product);
                     }
                 }
             }
         }
     }
 }
        private ICollection <IndicatorPoint> GetTechnicalIndicatorDataPoints(JProperty indicatorJson)
        {
            var result = new List <IndicatorPoint>();

            var indicatorContent = indicatorJson.Children().Single();

            foreach (var dataPointJson in indicatorContent)
            {
                var dataPoint             = new IndicatorPoint();
                var dataPointJsonProperty = dataPointJson as JProperty;
                if (dataPointJsonProperty == null)
                {
                    throw new StocksParsingException("Unable to parse time-series");
                }
                dataPoint.Time = DateTime.Parse(dataPointJsonProperty.Name);
                var dataPointContent = dataPointJsonProperty.Single();
                foreach (var field in dataPointContent)
                {
                    var property = (JProperty)field;
                    dataPoint.Value = Decimal.Parse(property.Value.ToString());
                    //contentDict.Add(property.Name, property.Value.ToString());
                }

                result.Add(dataPoint);
            }

            return(result);
        }
Ejemplo n.º 5
0
        static async Task GetCompanies(string baseURL)
        {
            HttpResponseMessage response = await client.GetAsync(baseURL + "/companies");

            JObject companies = JsonConvert.DeserializeObject <JObject>(response.Content.ReadAsStringAsync().Result);
            JObject o         = JObject.Parse(companies.ToString());

            foreach (JToken jt in o.Children())
            {
                JProperty jProperty    = jt.ToObject <JProperty>();
                string    propertyName = jProperty.Name;
                if (propertyName == "value")
                {
                    foreach (JToken jt1 in jProperty.Children())
                    {
                        JArray array = new JArray(jt1.Children());
                        for (int i = 0; i < array.Count; i++)
                        {
                            string companyID   = array[i].Value <string>("id");
                            string companyName = array[i].Value <string>("name");
                            Console.WriteLine("Company ID: {0}, Name: {1}", companyID, companyName);
                            if (companyName == "CRONUS IT")
                            {
                                workingCompanyID = companyID;
                            }
                        }
                    }
                }
            }
        }
        private ICollection <StockDataPoint> GetStockDataPoints([NotNull] JProperty timeSeriesJson)
        {
            var result = new List <StockDataPoint>();

            var timeseriesContent = timeSeriesJson.Children().Single();
            var contentDict       = new Dictionary <string, string>();

            foreach (var dataPointJson in timeseriesContent)
            {
                var dataPointJsonProperty = dataPointJson as JProperty;
                if (dataPointJsonProperty == null)
                {
                    throw new StocksParsingException("Unable to parse time-series");
                }

                contentDict.Add(TimeStampKey, dataPointJsonProperty.Name);

                var dataPointContent = dataPointJsonProperty.Single();
                foreach (var field in dataPointContent)
                {
                    var property = (JProperty)field;
                    contentDict.Add(property.Name, property.Value.ToString());
                }

                var dataPoint = ComposeDataPoint(contentDict);

                result.Add(dataPoint);
                contentDict.Clear();
            }

            return(result);
        }
Ejemplo n.º 7
0
        private static void ConvertJPropertyToFormDictionary(JProperty obj, Dictionary <string, string> finishedJsonObject, string prefix)
        {
            //then convert to a list of string->object mappings
            JContainer container = (JContainer)obj;

            if (obj.Count < 2 && container.First.Count() < 2)
            {
                finishedJsonObject[prefix + obj.Name] = obj.Value.ToString();//JsonConvert.SerializeObject(obj.Value);
            }
            else
            {
                //the object may be an array...

                foreach (JToken child in obj.Children())
                {
                    JObject childObj   = child as JObject;
                    JArray  childArray = child as JArray;

                    if (childObj != null)
                    {
                        CovnertJObjectToDictionary(childObj, finishedJsonObject, prefix + obj.Name + ".");
                    }
                    else if (childArray != null)                         // the object is a collection of objects with no particular value
                    {
                        int childCount = 0;
                        foreach (JObject grandChild in childArray)
                        {
                            CovnertJObjectToDictionary(grandChild, finishedJsonObject, prefix + obj.Name + "[" + childCount.ToString() + "].");
                            childCount++;
                        }
                    }
                }
            }
        }
        private void EnrichWithMetadata([NotNull] JProperty metadataJson, [NotNull] StockTimeSeries timeSeries)
        {
            var metadatas = metadataJson.Children().Single();

            foreach (var metadataItem in metadatas)
            {
                var metadataProperty  = (JProperty)metadataItem;
                var metadataItemName  = metadataProperty.Name;
                var metadataItemValue = metadataProperty.Value.ToString();

                if (metadataItemName.Contains(MetaDataJsonTokens.InformationToken))
                {
                    timeSeries.Type       = GetTimeSeriesType(metadataItemValue);
                    timeSeries.IsAdjusted = IsAdjusted(metadataItemValue);
                }
                else if (metadataItemName.Contains(MetaDataJsonTokens.RefreshTimeToken))
                {
                    var refreshTime = DateTime.Parse(metadataItemValue);
                    timeSeries.LastRefreshed = DateTime.SpecifyKind(refreshTime, DateTimeKind.Local);
                }
                else if (metadataItemName.Contains(MetaDataJsonTokens.SymbolToken))
                {
                    timeSeries.Symbol = metadataItemValue;
                }
            }
        }
Ejemplo n.º 9
0
        public static string Shutdown()
        {
            try
            {
                string respUri    = null;
                string respMethod = null;

                var       prop = responseUri.Children <JProperty>();
                JProperty Data = prop.FirstOrDefault(b => b.Name == "uninstall_agent");

                JProperty uri    = null;
                JProperty method = null;

                foreach (JToken x in Data.Children())
                {
                    var xdata = x.Children <JProperty>();
                    uri    = xdata.FirstOrDefault(b => b.Name == "response_uri");
                    method = xdata.FirstOrDefault(b => b.Name == "request_method");
                }
                respUri    = uri.Value.ToString();
                respMethod = method.Value.ToString();

                if (!string.IsNullOrEmpty(respUri) && !string.IsNullOrEmpty(respMethod))
                {
                    return(respUri + Delimeter + respMethod);
                }
            }
            catch
            {
                return("/rvl/v1/" + Settings.AgentId + "/core/results/shutdown" + Delimeter + HttpMethods.Put);
            }

            return("/rvl/v1/" + Settings.AgentId + "/core/results/shutdown" + Delimeter + HttpMethods.Put);
        }
Ejemplo n.º 10
0
        public static TextureInfo Deserialize(GLTFRoot root, JProperty jProperty)
        {
            var textureInfo = new TextureInfo();

            foreach (JToken child in jProperty.Children())
            {
                if (child is JProperty)
                {
                    JProperty childAsJProperty = child as JProperty;
                    switch (childAsJProperty.Name)
                    {
                    case "index":
                        textureInfo.Index = TextureId.Deserialize(root, childAsJProperty);
                        break;

                    case "texCoord":
                        textureInfo.TexCoord = (int)childAsJProperty.Value;
                        break;

                    default:
                        // todo: implement
                        //textureInfo.DefaultPropertyDeserializer(root, childAsJProperty);
                        break;
                    }
                }
            }

            return(textureInfo);
        }
Ejemplo n.º 11
0
        private string ExtractLanProperties(LanguageEnum lan, JProperty jsonObj)
        {
            var _type = _parser.GetFreindlyTypeName(lan, jsonObj);

            string prop = string.Empty;

            if (jsonObj.Value.Type == JTokenType.Array)
            {
                var propChildren = jsonObj.Children().ToList();
                foreach (JToken jTokenItem in propChildren)
                {
                    string arrayType = string.Empty;
                    switch (lan)
                    {
                    case LanguageEnum.CSharp:
                        arrayType = "List";
                        break;

                    case LanguageEnum.PHP:
                        arrayType = "array";
                        break;

                    case LanguageEnum.Java:
                        arrayType = "ArrayList";
                        break;
                    }

                    if (lan != LanguageEnum.PHP)
                    {
                        if (jTokenItem.Any(a => a.Type == JTokenType.String))
                        {
                            prop = arrayType + "&lt;string&gt;";
                            break;
                        }
                        else
                        {
                            prop = arrayType + "&lt;" + FirstCharToUpper(jsonObj.Name) + "&gt;";
                            break;
                        }
                    }
                    else if (lan == LanguageEnum.PHP)
                    {
                        prop = arrayType;
                        break;
                    }
                }
            }
            else if (jsonObj.Value.Type == JTokenType.Object)
            {
                prop = FirstCharToUpper(jsonObj.Name);
            }
            else
            {
                prop = _type;
            }

            return(prop);
        }
Ejemplo n.º 12
0
 private void AddMethodLinesFromJToken(JProperty methodLinesToken)
 {
     foreach (JValue lineValue in methodLinesToken.Children())
     {
         Lines.Add(new LineInfo(
                       int.Parse(methodLinesToken.Name),
                       int.Parse(lineValue.Value.ToString())));
     }
 }
Ejemplo n.º 13
0
        static JToken GetSortedJson(JToken jtoken)
        {
            if (jtoken.Type == JTokenType.Object)
            {
                Log($"Adding object: >>{jtoken.Path}<<");

                JObject old     = jtoken as JObject;
                JObject jobject = new JObject();

                foreach (JToken child in old.Children().OrderByDescending(c => c.Path, StringComparer.InvariantCultureIgnoreCase))
                {
                    Log($"Adding object child: >>{child.Path}<<");
                    jobject.AddFirst(GetSortedJson(child));
                }

                return(jobject);
            }
            else if (jtoken.Type == JTokenType.Property)
            {
                Log($"Adding property: >>{jtoken.Path}<<");

                JProperty old       = jtoken as JProperty;
                JProperty jproperty = new JProperty(old.Name, old.Value);

                foreach (JToken child in old.Children().OrderByDescending(c => c.Path, StringComparer.InvariantCultureIgnoreCase))
                {
                    Log($"Adding property child: >>{child.Path}<<");
                    JToken newchild = GetSortedJson(child);
                    jproperty.Value = newchild;
                }

                return(jproperty);
            }
            else if (jtoken.Type == JTokenType.Array)
            {
                Log($"Adding array: >>{jtoken.Path}<<");

                JArray old    = jtoken as JArray;
                JArray jarray = new JArray();

                var sortedChildren = old.Select(c => GetSortedJson(c)).OrderBy(c => c.ToString(), StringComparer.InvariantCultureIgnoreCase);

                foreach (JToken child in sortedChildren)
                {
                    Log($"Adding array child: >>{child.Path}<<");
                    jarray.Add(child);
                }

                return(jarray);
            }
            else
            {
                Log($"Generic type: '{jtoken.Type}'");
                return(jtoken);
            }
        }
Ejemplo n.º 14
0
 private void CreateClassFromJToken(JProperty classToken)
 {
     foreach (JObject methodToken in classToken.Children())
     {
         foreach (JProperty methodProperty in methodToken.Children())
         {
             Methods.Add(new Method(methodProperty.Name, methodProperty));
         }
     }
 }
Ejemplo n.º 15
0
        public static string AvailableAgentUpdate()
        {
            try
            {
                int       a          = 0;
                string    respUri    = null;
                string    respMethod = null;
                JProperty Data       = null;

                do
                {
                    try
                    {
                        var prop = responseUri.Children <JProperty>();
                        Data = prop.FirstOrDefault(b => b.Name == "available_agent_update");
                    }
                    catch
                    {
                        a++;
                        Thread.Sleep(5000);
                    }


                    JProperty uri    = null;
                    JProperty method = null;

                    try
                    {
                        foreach (JToken x in Data.Children())
                        {
                            var xdata = x.Children <JProperty>();
                            uri    = xdata.FirstOrDefault(b => b.Name == "response_uri");
                            method = xdata.FirstOrDefault(b => b.Name == "request_method");
                        }

                        respUri    = uri.Value.ToString();
                        respMethod = method.Value.ToString();
                    }
                    catch
                    { }
                } while (a <= 10 && Data == null);


                if (!string.IsNullOrEmpty(respUri) && !string.IsNullOrEmpty(respMethod))
                {
                    return(respUri + Delimeter + respMethod);
                }
            }
            catch
            {
                return("/rvl/v1/" + Settings.AgentId + "/rv/available_agent_update" + Delimeter + HttpMethods.Put);
            }

            return("/rvl/v1/" + Settings.AgentId + "/rv/available_agent_update" + Delimeter + HttpMethods.Put);
        }
Ejemplo n.º 16
0
 private void CreateDocumentFromJToken(JProperty documentToken)
 {
     foreach (JObject classObject in documentToken.Children())
     {
         foreach (JProperty classProperty in classObject.Children())
         {
             string className = Path.GetFileName(classProperty.Name);
             Classes.Add(new Class(className, classProperty));
         }
     }
 }
Ejemplo n.º 17
0
 private void CreateFromJToken(JProperty methodToken)
 {
     foreach (JObject methodTokens in methodToken.Children())
     {
         JObject methodLinesObject = methodTokens["Lines"] as JObject;
         foreach (JProperty methodLinesProperty in methodLinesObject.Children())
         {
             AddMethodLinesFromJToken(methodLinesProperty);
         }
     }
 }
Ejemplo n.º 18
0
 private void CreateDocumentFromJToken(JProperty moduleToken)
 {
     foreach (JObject documentObject in moduleToken.Children())
     {
         foreach (JProperty documentProperty in documentObject.Children())
         {
             string documentName = Path.GetFileName(documentProperty.Name);
             Documents.Add(new Document(documentName, documentProperty));
         }
     }
 }
Ejemplo n.º 19
0
        /// <summary>
        /// 解析update值
        /// </summary>
        /// <param name="jPropertyUpdateRoot"></param>
        /// <returns></returns>
        Dictionary <string, object> ParseUpdate(JProperty jPropertyUpdateRoot)
        {
            Dictionary <string, object> listData = null;

            foreach (JObject jPropertyObject in jPropertyUpdateRoot.Children())
            {
                listData = ParseJsonStruct(jPropertyObject);
            }

            return(listData);
        }
Ejemplo n.º 20
0
        private string CreateClassString(JProperty property, List <string> filter, int left)
        {
            var sb = new StringBuilder(property.Name + " : ").AppendLine();

            foreach (var propValue in property.Children().Values <JProperty>().Where(vo => !filter.Contains(vo.Name)))
            {
                sb.AppendLine(propValue.Name.Substring(left, propValue.Name.Length - left) + " : " + propValue.Value);
            }

            // property.Values<JProperty>().Where(vo => !filter.Contains(vo.Name))
            return(sb.ToString());
        }
Ejemplo n.º 21
0
        /// <summary>
        /// 取得子节点下的所有的描述 html返回为<tr><td></td><td></td><td></td><td></td></tr>这样的
        /// </summary>
        /// <param name="_html"></param>
        /// <param name="jpr"></param>
        /// <returns></returns>
        private string NoEndLessFunc(string _html, JProperty jpr, bool IsReceiveJson = false)
        {
            var    dicItem = dic.FirstOrDefault(c => c.Key == jpr.Name);
            string Desc    = "";

            if (dicItem.Key != null)
            {
                Desc = dicItem.Value;
            }
            if (jpr.Children().Count() > 0)
            {
                if (jpr.HasValues)
                {
                    _html += "<tr>" + "<td>" + jpr.Name + "</td>"
                             + "<td>" + Desc + "</td>"
                             + "<td>string</td>";
                    if (!IsReceiveJson)
                    {
                        _html += "<td>" + "Y" + "</td>";
                    }

                    _html += "<td>" + "<input type='text' />" + "</td>"
                             + "</tr>";
                    if (jpr.Value is JProperty)
                    {
                        foreach (JProperty jprop in jpr.Value)
                        {
                            _html += NoEndLessFunc(_html, jprop, IsReceiveJson);
                        }
                    }
                    else
                    {
                        string TempHtml = "";
                        _html += GetJTokenHtml(TempHtml, jpr.Value, IsReceiveJson);
                    }
                }
            }
            else
            {
                _html += "<tr>" + "<td>" + jpr.Name + "</td>"
                         + "<td>" + Desc + "</td>"
                         + "<td>" + jpr.Type.ToString() + "</td>";
                if (!IsReceiveJson)
                {
                    _html += "<td>" + "Y" + "</td>";
                }


                _html += "<td>" + "<input type='text' />" + "</td>"
                         + "</tr>";
            }
            return(_html);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Load
        /// </summary>
        /// <param name="prop"></param>
        internal void Load(JProperty prop)
        {
            Expect.IsNotNull(prop, nameof(prop));

            foreach (var child in prop.Children())
            {
                foreach (var cultureItem in child.Children().OfType <JProperty>())
                {
                    string cultureName = NormalizeCultureName(cultureItem.Name);
                    _items[cultureName] = (string)cultureItem.Value;
                }
            }
        }
Ejemplo n.º 23
0
    public static MovieCollectionDate Parse(JProperty data)
    {
        var date   = DateTime.Parse(data.Name);
        var movies = new List <Movie>();

        foreach (var upperChild in data.Children <JObject>())
        {
            foreach (var child in upperChild.Children())
            {
                movies.Add(Movie.Parse(child as JProperty));
            }
        }
        return(new MovieCollectionDate(date, movies));
    }
Ejemplo n.º 24
0
    public static MovieTheatre Parse(JProperty data)
    {
        var name = data.Name;
        var movieCollectionDates = new List <MovieCollectionDate>();

        foreach (var upperChild in data.Children <JObject>())
        {
            foreach (var child in upperChild.Children())
            {
                movieCollectionDates.Add(MovieCollectionDate.Parse(child as JProperty));
            }
        }
        return(new MovieTheatre(name, movieCollectionDates));
    }
Ejemplo n.º 25
0
        /// <summary>
        /// 解析msg值
        /// </summary>
        /// <param name="jPropertyMsgRoot"></param>
        /// <returns></returns>
        List <Dictionary <string, object> > ParseMsg(JProperty jPropertyMsgRoot)
        {
            List <Dictionary <string, object> > msgListData = new List <Dictionary <string, object> >();

            foreach (JArray jMsgItem in jPropertyMsgRoot.Children())
            {
                foreach (JObject jMsgObjectRoot in jMsgItem)
                {
                    msgListData.Add(ParseJsonStruct(jMsgObjectRoot));
                }
            }

            return(msgListData);
        }
        static string GetTableHtml(JProperty tableData)
        {
            var sb = new StringBuilder();

            sb.Append("<table class=\"fiu-table\">");

            var listOfRows = tableData.Children().First().Children();

            GetTableHead(sb, (JArray)listOfRows.First());
            GetTableBody(sb, listOfRows.Skip(1).ToList());

            sb.Append("</table>");

            return(sb.ToString());
        }
Ejemplo n.º 27
0
        void ParseHeaders(JProperty property)
        {
            var children = property.Children().Children().ToList();
            var headers  = _configuration.Headers;

            for (var index = 0; index < children.Count; index++)
            {
                var child = children[index];
                if (child.Count() != 2)
                {
                    throw new ArgumentException("Malformed Headers section");
                }
                AddKeyValue(headers, child[0].Value <string>(), child[1].Value <string>());
            }
        }
Ejemplo n.º 28
0
        private static SortedDictionary <DateTime, StockObservation> ParseJObject(JObject jObject)
        {
            SortedDictionary <DateTime, StockObservation> stockObservation = new SortedDictionary <DateTime, StockObservation>();

            List <JProperty> properties        = jObject.Children().Select(x => (JProperty)x).ToList();
            JProperty        timeSeriesData    = properties.Single(x => x.Name.Contains("Time Series"));
            JToken           timeSeriesContent = timeSeriesData.Children().Single();

            foreach (var jToken in timeSeriesContent)
            {
                var dataPoint = (JProperty)jToken;
                stockObservation.Add(DateTime.Parse(dataPoint.Name), ParseStockObservation(dataPoint));
            }

            return(stockObservation);
        }
Ejemplo n.º 29
0
        internal GraphNode ParseProperty(JProperty token)
        {
            GraphNode node = GraphNode.GetInstance(token.Path, nameof(ParseProperty), token.Type);

            node.ChildrenCount = token.Count;
            if (token.Value.Type != JTokenType.Property && token.Value.Type != JTokenType.Object && token.Value.Type != JTokenType.Array)
            {
                node.Value = token.Value;
                return(node);
            }
            foreach (var children in token.Children())
            {
                node.ChildNodes.Add(GetNodeFromToken(children));
            }
            return(node);
        }
Ejemplo n.º 30
0
 /// <summary>
 /// In a real scenario, this would not exist and all queries would be against the real backing store or web service.
 /// </summary>
 private void PopulateShoppingCarts()
 {
     using (StreamReader reader = File.OpenText(@"./DataSource/ShoppingCarts.json"))
     {
         var     json    = reader.ReadToEnd();
         JObject jObject = JObject.Parse(json);
         foreach (var child in jObject.Children())
         {
             JProperty property = (JProperty)child;
             if (property.Name == "ShoppingCarts")
             {
                 foreach (var root in property.Children())
                 {
                     foreach (var shoppingCartJson in root.Children())
                     {
                         var shoppingCart = _container.GetService <IShoppingCart>();
                         foreach (var propertyJson in shoppingCartJson.Children())
                         {
                             JProperty cartProperty = (JProperty)propertyJson;
                             if (cartProperty.Name == "Id")
                             {
                                 shoppingCart.Id = Guid.Parse(cartProperty.Value.ToString());
                                 continue;
                             }
                             if (cartProperty.Name == "Products")
                             {
                                 foreach (var productIdJson in cartProperty.Children())
                                 {
                                     JArray items = (JArray)productIdJson;
                                     for (int i = 0; i < items.Count; i++)
                                     {
                                         JValue productIdValue = (JValue)items[i];
                                         var    productId      = Guid.Parse(productIdValue.ToString());
                                         var    product        = _productsRepository.GetProduct(productId);
                                         shoppingCart.AddProduct(product, 1);
                                     }
                                 }
                             }
                             //JsonConvert.PopulateObject(productJson.ToString(), product);
                             _shoppingCarts.Add(shoppingCart.Id, shoppingCart);
                         }
                     }
                 }
             }
         }
     }
 }