Пример #1
0
        public WiseCartManager()
        {
            ShoppingCart = new ShoppingCart();
            Providers = new List<Provider>();
            AllProvidersIntersected = new Provider("Intersected");
            ProvidersXDocuments = new Dictionary<string, XDocument>();

            XmlFilesPath = @"..\..\..\Resources\ProvidersXml";
            XmlFilesPaths = Directory.GetFiles(XmlFilesPath).ToList();
        }
Пример #2
0
        private void InitializeProductsList(XDocument providerXDocument, Provider provider)
        {
            var allProducts = from item in providerXDocument.Descendants("Item")
                              select new
                              {
                                  ItemCode = item.Element("ItemCode").Value,
                                  ItemName = item.Element("ItemName").Value,
                                  UnitQty = item.Element("UnitQty").Value,
                                  IsWeighted = item.Element("bIsWeighted").Value,
                                  ItemPrice = item.Element("ItemPrice").Value
                              };

            foreach (var item in allProducts)
            {
                provider.Products.Add(new Product
                {
                    ItemCode = item.ItemCode,
                    ItemName = item.ItemName,
                    UnitQty = item.UnitQty,
                    IsWeighted = item.IsWeighted == "1",
                    Price = Convert.ToDouble(item.ItemPrice)
                });
            }
        }