private List<BusinessObjectLayer.Product> GetProductsRecurisevly(BusinessObjectLayer.Category category)
        {
            List<BusinessObjectLayer.Product> products = category.Products;

            foreach (BusinessObjectLayer.Category subCategory in category.SubCategories)
            {
                products.AddRange(this.GetProductsRecurisevly(subCategory));
            }

            return products;
        }
        public void SetDefaultShipping(BusinessObjectLayer.CustomerAddress address)
        {
            BusinessObjectLayer.CustomerAddress currentAddress = this.dalCustomerAddress.GetBy("DefaultShipping", "1");
            if (address.Id == currentAddress.Id)
            {
                return;
            }

            if (currentAddress != null)
            {
                currentAddress.DefaultShipping = false;
                this.dalCustomerAddress.Update(currentAddress);
            }

            address.DefaultShipping = true;
            this.dalCustomerAddress.Update(address);
        }
Пример #3
0
        public void TestWithProvider()
        {
            MongoDbBusinessObjectSource <PoI, GeoJson2DCoordinates> repo = null;

            Assert.DoesNotThrow(() => repo =
                                    new PoIRepository(
                                        GeoJsonConverter.Converter2D,
                                        TestConnection, TestDatabase, TestCollection));

            var p  = new BusinessObjectProvider <PoI>(TestCollection, repo);
            var vl = new VectorLayer(p.ConnectionID, p);

            var bl = new BusinessObjectLayer <PoI>(repo);

            var m = new Map();

            m.Layers.Add(vl);
            m.Layers.Add(bl);
            m.ZoomToExtents();
            m.GetMap().Save("MongoDB.PoI.png", ImageFormat.Png);
            m.Dispose();
        }
Пример #4
0
        /// <summary>
        /// The add.
        /// </summary>
        /// <param name="product">
        /// The product.
        /// </param>
        public void Add(BusinessObjectLayer.Product product)
        {
            NameValueCollection products = this.HttpContext.Request.Cookies["cart"] != null
                                               ? this.HttpContext.Request.Cookies["cart"].Values
                                               : new NameValueCollection();

            // If the product already exists in the cookie the amount will be incremented by 1.
            string productInCookie = products.Get(product.Id.ToString());
            if (productInCookie != null)
            {
                int amount;
                int.TryParse(productInCookie, out amount);
                products[product.Id.ToString()] = (amount + 1).ToString();
            }
            else
            {
                products.Add(product.Id.ToString(), "1");
            }

            var cookie = new HttpCookie("cart");
            cookie.Values.Add(products);

            this.HttpContext.Response.Cookies.Add(cookie);
        }
Пример #5
0
        public void TestRendering()
        {
            var s = new InMemoryBusinessObjectSource <LinkWithLoad>();

            s.Insert(_linksWithLoads);

            var l = new BusinessObjectLayer <LinkWithLoad>(s);

            l.Renderer = new LinkWithLoadRenderer {
                Scale = 0.05, Offset = 1.5
            };

            var m = new Map(new Size(500, 300));

            m.Layers.Add(l);

            m.ZoomToExtents();
            m.Zoom *= 1.15;
            m.GetMap().Save("LinkWithLoadImage1.png", ImageFormat.Png);
            Console.WriteLine(new Uri(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "LinkWithLoadImage1.png")).AbsoluteUri);
            l.Renderer = null;
            m.GetMap().Save("LinkWithLoadImage2.png", ImageFormat.Png);
            Console.WriteLine(new Uri(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "LinkWithLoadImage2.png")).AbsoluteUri);
        }
Пример #6
0
        /// <summary>
        /// The remove.
        /// </summary>
        /// <param name="product">
        /// The product.
        /// </param>
        public void Remove(BusinessObjectLayer.Product product)
        {
            NameValueCollection products = this.HttpContext.Request.Cookies["cart"] != null
                                               ? this.HttpContext.Request.Cookies["cart"].Values
                                               : null;
            if (products != null)
            {
                products.Remove(product.Id.ToString());
            }

            var cookie = new HttpCookie("cart");
            cookie.Values.Add(products);

            this.HttpContext.Response.Cookies.Add(cookie);
        }
 /// <summary>
 /// The remove.
 /// </summary>
 /// <param name="address">
 /// The address.
 /// </param>
 public void Remove(BusinessObjectLayer.CustomerAddress address)
 {
     new DataAccessLayer.Address().Delete(address.Address);
     this.dalCustomerAddress.Delete(address);
 }
 /// <summary>
 /// The update.
 /// </summary>
 /// <param name="address">
 /// The address.
 /// </param>
 public void Update(BusinessObjectLayer.Address address)
 {
     new DataAccessLayer.Address().Update(address);
 }