Beispiel #1
0
        public void Edit(int id, int factoryId, int amount, string material, string drawingId, DateTime orderdate, DateTime factOrderDate, decimal? clientPrice, decimal? factoryPrice, int? money, DateTime? devliDateFact, DateTime? devliDateCus, string qualityer, decimal modelPrice, IProduct product, decimal exchangeRate)
        {
            using (IUnitOfWork uow = IoC.Resolve<IUnitOfWork>("cat"))
            {
                IFactoryRepository factoryRep = IoC.Resolve<IFactoryRepository>();
                IFactory fact = factoryRep.GetById(factoryId);

                IProduce_Product p = _bar.GetById(id);
                p.Factory = fact;
                p.Amount = amount;
                p.Material = material;
                p.DrawingId = drawingId;
                p.OrderDate = orderdate;
                p.FactoryOrderDate = factOrderDate;
                p.ClientPrice = clientPrice;
                p.FactoryPrice = factoryPrice;
                p.ClientPriceMoney = money;
                p.DelivDateCust = devliDateCus;
                p.DelivDateFact = devliDateFact;
                p.Qualityer = qualityer;
                p.ModelPrice = modelPrice;
                p.Product = product;
                p.ExchangeRate = exchangeRate;
                uow.Commit();
            }
        }
Beispiel #2
0
 public void RemoveProduct(IProduct product)
 {
     if (ContainsProduct(product))
     {
         this.productList.Remove(product);
     }
 }
Beispiel #3
0
 private static void OutputSaleUnit(StringBuilder sb, IProduct product)
 {
     bool omitSaleUnit = product.SaleUnitIsNull()
                         || product.SoldByPurchaseUnit();
     if (!omitSaleUnit)
         sb.Append(GetOutputOfUnit(product.SaleUnit));
 }
		public string ProductCanonical(IProduct product, ILocalization localization)
		{
			product = _productService.Localize(product, localization);

			var productUrl = _productUrlService.GetCanonicalUrl(product);
			return _urlFormatService.FormatUrl(_urlLocalizationService.LocalizeCatalogUrl(productUrl, localization));
		}
        public bool IsMatched(IProduct element)
        {
            if (element == null)
                return false;

            return _color == element.Color;
        }
Beispiel #6
0
 public static bool ProductAssociatesShapeWithUnitGroup(IProduct product)
 {
     if (product.Quantity.Unit.UnitGroup == null) return false;
     var valid = product.Shape.UnitGroups.Contains(product.Quantity.Unit.UnitGroup);
     if (!valid) throw new AssertFailedException(new StackFrame().GetMethod().Name);
     return true;
 }
Beispiel #7
0
        public string ShowColor(IProduct product)
        {
            if (product.Color == "Red")
                return "Red";

            return string.Empty;
        }
        /// <summary>
        /// Makes call to db to insert new Product
        /// </summary>
        /// <param name="product"></param>
        public void SaveProduct(IProduct product)
        {
            try
            {
                using (ISession session = NHibernateTest.NHibernateHelper.GetCurrentSession())
                {
                    using (ITransaction transaction = session.BeginTransaction())
                    {
                        try
                        {
                           // session.Save(product);
                            session.SaveOrUpdate(product);
                            transaction.Commit();
                            //session.Flush();
                        }
                        catch (Exception e)
                        {
                            transaction.Rollback();
                            Console.WriteLine("Error : " + e.Message);
                            Console.WriteLine("Error : " + e.StackTrace);
                        }

                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Error occurred :" + e.Message);
                Console.WriteLine("Error occurred :" + e);
            }
        }
Beispiel #9
0
        public Part(string partname,
                    int qty,
                    double width,
                    double length,
                    double thickness,
                    string material,
                    string ebw1,
                    string ebw2,
                    string ebl1,
                    string ebl2,
                    string comment,
                    string comment2,
                    string comment3,
                    int bp,
                    string mp,
                    double xo,
                    double yo,
                    double zo,
                    double xr,
                    double yr,
                    double zr,
                    string draw3dstr,
                    string draw2dstr,
                    IProduct product)
            : this()
        {
            this.PartName = partname;
            this.Width = width;
            this.Length = length;
            this.Qty = qty;
            this.Thickness = thickness;
            this.Material = material;
            this.EBW1 = ebw1;
            this.EBW2 = ebw2;
            this.EBL1 = ebl1;
            this.EBL2 = ebl2;
            this.Comment = comment;
            this.Comment2 = comment2;
            this.Comment3 = comment3;
            this.BasePoint = bp;
            this.MachinePoint = new MachinePoint(mp);
            this.XOrigin = xo;
            this.YOrigin = yo;
            this.ZOrigin = zo;
            this.XRotation = xr;
            this.YRotation = yr;
            this.ZRotation = zr;
            this.Draw3DToken = draw3dstr;
            this.Draw2DToken = draw2dstr;
            
            //TODO:
            //this.Product = product;

            this.TXOrigin = this.XOrigin;
            this.TYOrigin = this.YOrigin;
            this.TZOrigin = this.ZOrigin;
            this.TXRotation = this.XRotation;
            this.TYRotation = this.YRotation;
            this.TZRotation = this.ZRotation;
        }
Beispiel #10
0
        public string ShowPrice1(IProduct product)
        {
            if (product.GetPrice() > 16)
                return "Expensive";

            return "Cheap";
        }
        public void ApplyDOMUpdate(IProduct product, KaiTrade.Interfaces.IPXUpdate update)
        {
            try
            {

                KaiTrade.Interfaces.IDOM dom = _mnemonicDOM[product.Mnemonic];
                if (dom == null)
                {
                    // must have a least a price
                    decimal? initPx = null;
                    if (update.BidPrice.HasValue)
                    {
                        initPx = update.BidPrice;
                    }
                    else if (update.OfferPrice.HasValue)
                    {
                        initPx = update.OfferPrice;
                    }
                    else if (update.TradePrice.HasValue)
                    {
                        initPx = update.TradePrice;
                    }
                    if (initPx.HasValue)
                    {
                        dom = GetProductDOM(product, initPx.Value);

                    }
                }
                dom.Update(update);

            }
            catch
            {
            }
        }
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            DbPreTestDataWorker.DeleteAllProducts();
            DbPreTestDataWorker.DeleteAllEntityCollections();

            _productService = DbPreTestDataWorker.ProductService;
            _entityCollectionService = DbPreTestDataWorker.EntityCollectionService;

            _product = DbPreTestDataWorker.MakeExistingProduct();
            _product.ProductOptions.Add(new ProductOption("Color"));
            _product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Black", "Blk"));
            _product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Blue", "Blu"));
            _product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Red", "Red"));
            _product.ProductOptions.First(x => x.Name == "Color").Choices.Add(new ProductAttribute("Green", "Gre"));
            _product.ProductOptions.Add(new ProductOption("Size"));
            _product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Small", "Sm"));
            _product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Medium", "M"));
            _product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("Large", "Lg"));
            _product.ProductOptions.First(x => x.Name == "Size").Choices.Add(new ProductAttribute("X-Large", "XL"));
            _product.Height = 20;
            _product.Weight = 20;
            _product.Length = 20;
            _product.Width = 20;
            _product.Shippable = true;
            _productService.Save(_product);
        }
Beispiel #13
0
        public TestBase()
        {
            var builder = new ContainerBuilder();
               builder.RegisterType<DatabaseFactory>().As<IDatabaseFactory>().InstancePerLifetimeScope();
               builder.RegisterType<UnityOfWork>().As<IUnitOfWork>();

               builder.RegisterType<ContactRepostory>().AsImplementedInterfaces();
               builder.RegisterType<ContactServices>().AsImplementedInterfaces();
               builder.RegisterType<ProductRepository>().AsImplementedInterfaces();
               builder.RegisterType<LodgingRepository>().AsImplementedInterfaces();
               builder.RegisterType<ResortRepository>().AsImplementedInterfaces();

               builder.RegisterType<ProductService>().AsImplementedInterfaces();
               builder.RegisterType<LodgingService>().AsImplementedInterfaces();
               builder.RegisterType<ResortService>().AsImplementedInterfaces();

               #region 权限
               builder.RegisterType<PermissionModuleRepository>().AsImplementedInterfaces();
               builder.RegisterType<PermissionRoleRepository>().AsImplementedInterfaces();
               builder.RegisterType<PermissionReRoleModuleRepostory>().AsImplementedInterfaces();
               builder.RegisterType<PermissionSvc>().AsImplementedInterfaces();
               #endregion
               container= builder.Build();
               this.unitOfWork = container.Resolve<IUnitOfWork>();
               this.contact=container.Resolve<IContact>();
               this.productsvc=container.Resolve<IProduct>();
               this.resortSvc = container.Resolve<IResort>();
               this.lodgingsvc = container.Resolve<ILodging>();
               this.permissionSvc = container.Resolve<IPermission>();
             //  StartUp();
        }
Beispiel #14
0
 public void AddProduct(IProduct product)
 {
     Validator.CheckIfNull(
       product,
       string.Format(GlobalErrorMessages.ObjectCannotBeNull, "Product"));
     this.productList.Add(product);
 }
        public void RemoveProduct(IProduct product)
        {
            // Added validation for null
            Validator.CheckIfNull(product, string.Format(GlobalErrorMessages.ObjectCannotBeNull, "Product"));

            this.products.Remove(product);
        }
Beispiel #16
0
 public void RemoveCosmetics(IProduct cosmetics)
 {
     if (!this.Products.Remove(cosmetics))
     {
         Console.WriteLine("Product {0} does not exist in category {0}!", cosmetics.Name, this.Name);
     }
 }
        /// <summary>
        /// The perform task.
        /// </summary>
        /// <param name="entity">
        /// The entity.
        /// </param>
        /// <returns>
        /// The <see cref="Attempt"/>.
        /// </returns>
        public override Attempt<IProduct> PerformTask(IProduct entity)
        {
            foreach (var origVariant in Original.ProductVariants.ToArray())
            {
                var cloneVariant = this.GetClonedMathingVariant(entity, origVariant);

                cloneVariant.Barcode = origVariant.Barcode;
                cloneVariant.Available = false;
                cloneVariant.Price = origVariant.Price;
                cloneVariant.OnSale = origVariant.OnSale;
                cloneVariant.SalePrice = origVariant.SalePrice;
                cloneVariant.CostOfGoods = origVariant.CostOfGoods;
                cloneVariant.Download = origVariant.Download;
                cloneVariant.DownloadMediaId = origVariant.DownloadMediaId;
                cloneVariant.Height = origVariant.Height;
                cloneVariant.Length = origVariant.Length;
                cloneVariant.Weight = origVariant.Weight;
                cloneVariant.Width = origVariant.Width;
                cloneVariant.Manufacturer = origVariant.Manufacturer;
                cloneVariant.ManufacturerModelNumber = origVariant.ManufacturerModelNumber;
                cloneVariant.TrackInventory = origVariant.TrackInventory;
                cloneVariant.OutOfStockPurchase = origVariant.OutOfStockPurchase;
                cloneVariant.Shippable = origVariant.Shippable;
                cloneVariant.Taxable = origVariant.Taxable;
            }

            return Attempt<IProduct>.Succeed(entity);
        }
 public bool ContainsProduct(IProduct product)
 {
     return  shopingCart.Any( p =>p.Name == product.Name
                               && p.Brand == product.Brand
                               && p.Price == product.Price
                               && p.Gender == product.Gender);
 }
 public void RemoveProduct(IProduct product)
 {
     if (this.Products.Contains(product))
     {
         this.Products.Remove(product);
     }
 }
Beispiel #20
0
 void UpdateSteps(IProduct product)
 {
     SetReady(1, HeadquarterCount >= 1);
     SetReady(2, BarracksCount >= 1);
     SetReady(3, BarracksCount >= 1 && InfantryCount >= 1);
     SetReady(4, BarracksCount >= 1 && InfantryCount >= 2);
     SetReady(5, BarracksCount >= 1 && InfantryCount >= 3);
 }
Beispiel #21
0
        public IOrderItem AddToBill(IProduct product)
        {
            var orderItem = new OrderItem(product);

            _orderItems.Add(orderItem);

            return orderItem;
        }
Beispiel #22
0
 public void AddProduct(IProduct product)
 {
     if (product == null)
     {
         throw new ArgumentNullException("Null product can not be added to list");
     }
     this.products.Add(product);
 }
Beispiel #23
0
 public void AddCosmetics(IProduct cosmetics)
 {
     Validator.CheckIfNull(
        cosmetics,
        string.Format(GlobalErrorMessages.ObjectCannotBeNull, "Cosmetics"));
     this._productList.Add(cosmetics);
     _productList = _productList.OrderBy(x => x.Brand).ThenByDescending(y => y.Price).ToList();
 }
 public void RemoveCosmetics(IProduct cosmetics)
 {
     if(!this.products.Contains(cosmetics))
     {
         throw new ArgumentException(String.Format("Product {0} does not exist in category {1}!",cosmetics.Name, this.name) );
     }
     this.products.Remove(cosmetics);
 }
Beispiel #25
0
 public HomeController(ICategory catsvc,IProduct prodsvc,ICart cartsvc, ICheckout checkoutsvc, ICommon commonsvc)
 {
     _categoryService = catsvc;
     _productService = prodsvc;
     _cartService = cartsvc;
     _checkoutService = checkoutsvc;
     _commonService = commonsvc;
 }
Beispiel #26
0
 public static bool ProductHasPackage(IProduct product)
 {
     var valid = product.Package != null &&
                 !String.IsNullOrWhiteSpace(product.Package.Name) &&
                 product == product.Package.Products.First();
     if (!valid) throw new AssertFailedException(new StackFrame().GetMethod().Name);
     return true;
 }
 public bool ContainsProduct(IProduct product)
 {
     if (this.shoppingList.Contains(product))
     {
         return true;
     }
     return false;
 }
Beispiel #28
0
 private void ReadModel(CreateProduct model, IProduct item)
 {
     item.Name = model.Name;
     item.Image = model.Image;
     item.Description = model.Description;
     item.Cost = model.Cost;
     item.IsAvailable = model.IsAvailable;
 }
Beispiel #29
0
 public void SaveProduct(IProduct product)
 {
     if (product != null)
     {
         Console.WriteLine("Inserting ...." + product.Name);
         _productRepository.SaveProduct(product);
     }
 }
Beispiel #30
0
        public OrderLine(IProduct product)
        {
            if (product == null)
                throw new ArgumentNullException("product", "product Can't be null!");

            Product = product;
            Quantity = 1;
        }
 public ProductAAnnualCalculationTest()
 {
     _sut = new ProductA("test product", 22, 5);
 }
 public Motoren(IProduct product, string v) : base(product, v)
 {
 }
Beispiel #33
0
 public ProductAvailabilityChecker(IProduct product)
 {
     Product = product;
 }
Beispiel #34
0
 /// <summary>
 /// Додавання добавки
 /// </summary>
 /// <param name="product">Напій</param>
 /// <param name="pathFile">Шлях до БД</param>
 public static void AddAdditiv(IProduct product, string pathFile)
 => AddRangeAdditiv(new List <IProduct>()
 {
     product
 }, pathFile);
 public void RemoveProduct(IProduct product)
 {
     Validator.CheckIfNull(product, string.Format(GlobalErrorMessages.ObjectCannotBeNull, "roduct to remove from cart"));
     this.productList.Remove(product);
 }
 /*Below code does dependency injection via constructor
  * It is not responsibility of Product Controller Class to create Object of Product Repository
  * It have to be added in Startup Class configure service method to create object of Product Repository */
 public ProductsController(IProduct _productRepository)
 {
     productRepository = _productRepository;
 }
Beispiel #37
0
        public InventoryQuery(IDataLoaderContextAccessor accessor, ICategory category, IProduct product, IReview review, IUser user, IOrder order)
        {
            Name = "MarketAppQuery";

            #region Category
            Field <CategoryType, Category>()
            .Name("CategoryById")
            .Description("This field returns the category of the submitted id")
            .Argument <NonNullGraphType <IntGraphType> >(Name = "CategoryId", Description = "Category Id")
            .ResolveAsync(ctx =>
            {
                return(category.GetByIdAsync(ctx.GetArgument <int>("CategoryId")));
            });

            Field <ListGraphType <CategoryType>, IEnumerable <Category> >()
            .Name("getAllCategories")
            .Description("This field returns all categories")
            .ResolveAsync(ctx =>
            {
                IDataLoader <IEnumerable <Category> > loader = accessor.Context.GetOrAddLoader("GetAllCategories", () => category.GetAllAsync());
                return(loader.LoadAsync());
            });

            #endregion

            #region Product
            Field <ProductType>(
                "getProductById",
                Description = "This field returns the product of the submitted id",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <IntGraphType> > {
                Name = "ProductId"
            }
                    ),
                resolve: context => product.GetByIdAsync(context.GetArgument <int>("ProductId"))
                );

            Field <ListGraphType <ProductType>, IEnumerable <Product> >()
            .Name("getAllProducts")
            .Description("This field returns all products")
            .ResolveAsync(ctx =>
            {
                var loader = accessor.Context.GetOrAddLoader("GetAllProducts", () => product.GetAllAsync());
                return(loader.LoadAsync());
            });
            #endregion

            #region Review
            Field <ReviewType>(
                "getReviewById",
                Description = "This field returns the review of the submitted id",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <IntGraphType> > {
                Name = "ReviewId"
            }
                    ),
                resolve: context => review.GetByIdAsync(context.GetArgument <int>("ReviewId"))
                );

            Field <ListGraphType <ReviewType>, IEnumerable <Review> >()
            .Name("getAllReviews")
            .Description("This field returns all reviews")
            .ResolveAsync(ctx =>
            {
                var loader = accessor.Context.GetOrAddLoader("GetAllReviews", () => review.GetAllAsync());
                return(loader.LoadAsync());
            });
            #endregion

            #region User
            Field <UserType>(
                "getUserById",
                Description = "This field returns the user of the submitted id",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <IntGraphType> > {
                Name = "UserId"
            }
                    ),
                resolve: context => user.GetByIdAsync(context.GetArgument <int>("UserId"))
                );

            Field <ListGraphType <UserType>, IEnumerable <User> >()
            .Name("getAllUsers")
            .Description("This field returns all reviews")
            .ResolveAsync(ctx =>
            {
                var loader = accessor.Context.GetOrAddLoader("GetAllUsers", () => user.GetAllAsync());
                return(loader.LoadAsync());
            });
            #endregion

            #region Order
            Field <OrderType>(
                "getOrderById",
                Description = "This field returns the order of the submitted id",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <IntGraphType> > {
                Name = "OrderId"
            }
                    ),
                resolve: context => order.GetByIdAsync(context.GetArgument <int>("OrderId"))
                );

            Field <ListGraphType <OrderType>, IEnumerable <Order> >()
            .Name("getAllOrders")
            .Description("This field returns all orders")
            .ResolveAsync(ctx =>
            {
                var loader = accessor.Context.GetOrAddLoader("GetAllOrders", () => order.GetAllAsync());
                return(loader.LoadAsync());
            });

            #endregion
            Description = "MarketApp Query Fields for, You can query about categories, products, users, reviews and orders";
        }
 public void Remove(IProduct item)
 {
     _data.Remove(item);
 }
 public void Insert(IProduct item)
 {
     _data.Add(item);
 }
Beispiel #40
0
 protected Car(IProduct product, string carType)
 {
     _product = product;
     _carType = carType;
 }
 public void Calculate(IProduct product)
 {
     CalculateAddDiscount(product);
     product.Discount      = this.discount;
     product.TotalDiscount = new Amount(product.FinalPrice.Value * this.discount.DiscountRate);
 }
 public bool ContainsProduct(IProduct product)
 {
     return(this.productList.Contains(product));
 }
Beispiel #43
0
 public void AddProduct(IProduct product)
 {
     producten.Add(product);
 }
Beispiel #44
0
 public void AddProductToCart(IProduct product)
 {
     cart.Add(product);
 }
 public ProductServices(IProduct productRepository)
 {
     _productRepository = productRepository ?? throw new ArgumentNullException(nameof(productRepository));
 }
 public void AddProduct(IProduct product)
 {
     Validator.CheckIfNull(product, string.Format(GlobalErrorMessages.ObjectCannotBeNull, "Product to add to cart"));
     this.productList.Add(product);
 }
 public ThymeAndRosemary(IProduct product) : base(product, new ThymeAndRosemaryName())
 {
 }
Beispiel #48
0
 public int CompareTo(IProduct other)
 {
     return(Label.CompareTo(other.Label));
 }
Beispiel #49
0
 /// <summary>
 /// Додавання добавки по id
 /// </summary>
 /// <param name="product">Напій</param>
 /// <param name="pathFile">Шлях до БД</param>
 public static void ChangeAdditiv(IProduct product, string pathFile)
 => ChangeProduct(pathFile, "Additivs", product);
Beispiel #50
0
 public ProductASeller(IProduct productToSell)
 {
     _productToSell = productToSell;
 }
Beispiel #51
0
 public ProductsController(IProduct productService)
 {
     _ProductService = productService;
 }
Beispiel #52
0
 public void AddCosmetics(IProduct cosmetics)
 {
     this.listOfProducts.Add(cosmetics);
 }
Beispiel #53
0
 /// <summary>
 /// Зміна напою по id
 /// </summary>
 /// <param name="product">Напій</param>
 /// <param name="pathFile">Шлях до БД</param>
 public static void ChangeDrink(IProduct product, string pathFile)
 => ChangeProduct(pathFile, "Drinks", product);
 public void Add(IProduct product)
 {
     Products.Add(product);
 }
Beispiel #55
0
 /// <summary>
 /// Додавання напою
 /// </summary>
 /// <param name="product">Напій</param>
 /// <param name="pathFile">Шлях до БД</param>
 public static void AddDrink(IProduct product, string pathFile)
 => AddRangeDrink(new List <IProduct>()
 {
     product
 }, pathFile);
Beispiel #56
0
 public void SetComponent(IProduct product)
 {
     this.product = product;
 }
 public ProductsController(IProduct productRepo, IMapper mapper)
 {
     _productRepo = productRepo;
     _mapper      = mapper;
 }
Beispiel #58
0
 public Decorator(IProduct product)
 {
     this.product = product;
 }
Beispiel #59
0
 // TODO: currently a redundant method. Deal with this.
 public void updateProduct(IProduct toUpdate)
 {
     service.updateProduct(toUpdate);
 }
Beispiel #60
0
        static void Main(string[] args)
        {
            //Simple Factory
            IProduct product = SimpleFactory.GetProduct(1);

            Console.WriteLine("Product name is " + product.productName);
            product = SimpleFactory.GetProduct(2);
            Console.WriteLine("Product name is " + product.productName);


            //Factory Method
            IProductFMFactory     factory = new FirstProductFactory();
            IFactoryMethodProduct prd     = factory.GetProduct();

            Console.WriteLine("Product name is " + prd.productName);
            factory = new SecondProductFactory();
            prd     = factory.GetProduct();
            Console.WriteLine("Product name is " + prd.productName);



            //Builder
            var packageDirector = new PackageDirector(new NormalPackageBuilder());
            var pacakge         = packageDirector.GetPackage();

            Console.WriteLine("Package " + pacakge.GetDetails());;

            packageDirector = new PackageDirector(new EcoPackageBuilder());
            pacakge         = packageDirector.GetPackage();
            Console.WriteLine("Package " + pacakge.GetDetails());;

            packageDirector = new PackageDirector(new DeluxPackageBuilder());
            pacakge         = packageDirector.GetPackage();
            Console.WriteLine("Package " + pacakge.GetDetails());;

            //Observer
            var pub  = new ConsoleApplication3.Publisher();
            var sub1 = new ConsoleApplication3.Subscriber {
                name = "Subscriber 1"
            };
            var sub2 = new ConsoleApplication3.Subscriber {
                name = "Subscriber 2"
            };
            var sub3 = new ConsoleApplication3.Subscriber {
                name = "Subscriber 3"
            };

            pub.AddSubscriber(sub1);
            pub.AddSubscriber(sub2);
            pub.AddSubscriber(sub3);
            pub.Notify();
            pub.RemoveSubscriber(sub2);
            pub.Notify();

            //Template Method
            ConnectionManager cn = new SqlServerConnectionManager();

            cn.Connect();
            cn = new OracleConnectionManager();
            cn.Connect();

            //Strategy
            var robot = new Robot(new CanTalkInEnglish());

            robot.DisplayFeatures();
            robot = new Robot(new CanTalkInFrench());
            robot.DisplayFeatures();
            robot = new Robot(new CanNotTalk());
            robot.DisplayFeatures();

            //Decorator

            IProp     prop      = new NormalProp();
            Decorator decorator = new PictureDecorator(prop);

            Console.WriteLine("Price is " + decorator.price());

            prop      = new FancyProp();
            decorator = new PictureDecorator(prop);
            Console.WriteLine("Price is " + decorator.price());
            Console.ReadLine();
        }