Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            #region Lab_1
            Directory directory = new Directory();
            IBuilder  b_1       = new Builder_1();
            IBuilder  b_2       = new Builder_2();

            directory.Constructor(b_1);
            Product p_1 = b_1.GetResult();
            p_1.Display();

            directory.Constructor(b_2);
            Product p_2 = b_2.GetResult();
            p_2.Display();

            Console.ReadKey();
            #endregion

            #region Lab_2
            ProductDirectory directory_2 = new ProductDirectory();
            ProductBuilder   builder     = new A_ProductBuilder();

            directory_2.GenerateProduct(builder);

            var model = builder.GetModel();

            Console.WriteLine(model.Id);
            Console.WriteLine(model.ProductName);
            Console.WriteLine(model.UnitPrice);
            Console.WriteLine(model.DiscountPrice);
            Console.WriteLine(model.DiscountedApplied);

            Console.ReadKey();
            #endregion
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            #region Lab_1
            Directory directory = new Directory();
            IBuilder  builder_1 = new Builder_1();
            IBuilder  builder_2 = new Builder_2();

            directory.Constructor(builder_1);
            Product product_1 = builder_1.GetResult();
            product_1.Display();

            directory.Constructor(builder_2);
            Product product_2 = builder_2.GetResult();
            product_2.Display();
            #endregion

            #region Lab_2
            KrediKartiBuilder americanExpress = new AmericanExpress();
            KrediKartiBuilder masterCart      = new MasterCart();
            KrediKartiBuilder visaCart        = new VisaCart();

            KartDirectory kartDirectory = new KartDirectory();
            kartDirectory.KrediCartBuilder(americanExpress);

            KartDirectory kartDirectory2 = new KartDirectory();
            kartDirectory.KrediCartBuilder(masterCart);

            KartDirectory kartDirectory3 = new KartDirectory();
            kartDirectory.KrediCartBuilder(visaCart);

            Console.WriteLine(americanExpress.Kart.BankaAdi);
            Console.WriteLine(americanExpress.Kart.KartTipi);
            Console.WriteLine(americanExpress.Kart.KartLimiti);
            Console.WriteLine(americanExpress.Kart.TaksitAlma);
            Console.WriteLine("\n");
            Console.WriteLine(masterCart.Kart.BankaAdi);
            Console.WriteLine(masterCart.Kart.KartTipi);
            Console.WriteLine(masterCart.Kart.KartLimiti);
            Console.WriteLine(masterCart.Kart.TaksitAlma);
            Console.WriteLine("\n");
            Console.WriteLine(visaCart.Kart.BankaAdi);
            Console.WriteLine(visaCart.Kart.KartTipi);
            Console.WriteLine(visaCart.Kart.KartLimiti);
            Console.WriteLine(visaCart.Kart.TaksitAlma);
            #endregion

            Console.ReadKey();
        }