示例#1
0
        static void Main(string[] args)
        {
            ProductDirector productDirector = new ProductDirector();
            var             builder         = new NewCutomerProductBuilder();
            var             builder2        = new OldCutomerProductBuilder();

            productDirector.GenerateProduct(builder);
            productDirector.GenerateProduct(builder2);
            var model  = builder.GetModel();
            var model2 = builder2.GetModel();

            Console.WriteLine(model.Id);
            Console.WriteLine(model.CategoryName);
            Console.WriteLine(model.ProductName);
            Console.WriteLine(model.DiscountAplied);
            Console.WriteLine(model.DiscountedPrice);
            Console.WriteLine(model.UnitPrice);
            Console.WriteLine(model2.Id);
            Console.WriteLine(model2.CategoryName);
            Console.WriteLine(model2.ProductName);
            Console.WriteLine(model2.DiscountAplied);
            Console.WriteLine(model2.DiscountedPrice);
            Console.WriteLine(model2.UnitPrice);
            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            ProductDirector director   = new ProductDirector();
            var             builderNew = new NewCustomerProductBuilder();
            var             builderOld = new OldCustomerProductBuilder();

            director.GenerateProduct(builderNew);
            var model = builderNew.GetModel();

            Console.WriteLine(model.Id);
            Console.WriteLine(model.CategoryName);
            Console.WriteLine(model.DiscountApplied);
            Console.WriteLine(model.DiscountedPrice);
            Console.WriteLine(model.ProductName);
            Console.WriteLine(model.UnitPrice);

            director.GenerateProduct(builderOld);
            model = builderOld.GetModel();

            Console.WriteLine(model.Id);
            Console.WriteLine(model.CategoryName);
            Console.WriteLine(model.DiscountApplied);
            Console.WriteLine(model.DiscountedPrice);
            Console.WriteLine(model.ProductName);
            Console.WriteLine(model.UnitPrice);

            Console.ReadLine();
        }
示例#3
0
        static void Main(string[] args)
        {
            ProductDirector productDirector = new ProductDirector();
            var             builder         = new NewCustomeProductBuilder();

            productDirector.GenerateProduct(builder);
            var model = builder.GetModel();

            Console.WriteLine("Hello World!");
        }
示例#4
0
        static void Main(string[] args)
        {
            ProductDirector direktor = new ProductDirector();
            var             builder  = new NewCustomerProductBuilder();

            direktor.GenerateProduct(builder);
            var model = builder.GetModel();

            Console.WriteLine(model.DiscountApplied);
            Console.ReadKey();
        }
示例#5
0
        static void Main(string[] args)
        {
            ProductDirector productDirector = new ProductDirector();
            var             builder         = new NewCustomerProductBuilder();

            productDirector.GenerateProduct(builder);
            var model = builder.GetModel();

            Console.WriteLine("Name: {0} Price : {1} DiscountedPrice: {2}", model.ProductName, model.UnitPrice, model.DiscountedPrice);

            Console.ReadLine();
        }
示例#6
0
        //The purpose of the pattern is to extract an object as a result of successive operations,
        //Such as making a pizza.
        static void Main(string[] args)
        {
            ProductDirector director=new ProductDirector();
            var builder = new NewCustomerProductBuilder();
            director.GenerateProduct(builder);
            var model = builder.GetModel();

            Console.WriteLine(model.Id);
            Console.WriteLine(model.CatagoryName);

            Console.ReadLine();
        }
示例#7
0
        public static void Main()
        {
            ProductDirector productDirector = new ProductDirector();
            var             builder         = new NewCustomerProductBuilder();

            productDirector.GenerateProduct(builder);
            var model = builder.GetModel();

            Console.WriteLine(model.Id);
            Console.WriteLine(model.ProductName);
            Console.WriteLine(model.UnitPrice);
        }
示例#8
0
        static void Main(string[] args)
        {
            ProductDirector productDirector = new ProductDirector();
            var             builder         = new OldCustomerProductBuilder();

            productDirector.GenerateProduct(builder);
            var model = builder.GetModel();

            Console.WriteLine(model.Id);
            Console.WriteLine(model.ProductName);
            Console.WriteLine(model.CategoryName);
            Console.WriteLine(model.UnitPrice);
        }
示例#9
0
        static void Main(string[] args)
        {
            ProductDirector director = new ProductDirector();
            var             builder  = new OldCustomerProductBuilder();

            director.GenerateProduct(builder);
            var model = builder.GetModel();

            Console.WriteLine(model.ProductName);
            Console.WriteLine(model.UnitPrice);
            Console.WriteLine(model.Discount);

            Console.ReadLine();
        }
示例#10
0
        static void Main(string[] args)
        {
            ProductDirector productDirector = new ProductDirector();
            var             builder         = new OldCustomerProductBuilder();

            productDirector.GenerateProduct(builder);
            builder.GModel();
            Console.WriteLine(builder.GModel().Id);
            Console.WriteLine(builder.GModel().ProductName);

            Console.WriteLine(builder.GModel().CategoryName);

            Console.WriteLine(builder.GModel().DiscountedPrice);
        }
示例#11
0
        static void Main(string[] args)
        {
            ProductDirector       productDirector = new ProductDirector();
            StudentProductBuilder studentBuilder  = new StudentProductBuilder();
            TeacherProductBuilder teacherBuilder  = new TeacherProductBuilder();
            Product product = new Product {
                Name = "Laptop", Price = 3000
            };
            var saledProducForStudent = productDirector.GenerateProduct(studentBuilder, product);
            var saledProducForTeacher = productDirector.GenerateProduct(teacherBuilder, product);

            Console.WriteLine($"Ürün Adı : {product.Name} Fiyat : {product.Price} Öğrenci İndirimli Fiyatı : {saledProducForStudent.Price}");
            Console.WriteLine("-------------------------------");
            Console.WriteLine($"Ürün Adı : {product.Name} Fiyat : {product.Price} Öğretmen İndirimli Fiyatı : {saledProducForTeacher.Price}");
        }
示例#12
0
        static void Main(string[] args)
        {
            ProductDirector productDirector = new ProductDirector();
            var             builder         = new NewCustomerProductBuilder();

            productDirector.GeneratedProduct(builder);

            var model = builder.GetModel();

            Console.WriteLine("Id " + model.Id);
            Console.WriteLine("CategoryName " + model.CategoryName);
            Console.WriteLine("ProductName " + model.ProductName);
            Console.WriteLine("DiscountApplied " + model.DiscountApplied);
            Console.WriteLine("DiscountedPrice " + model.DiscountedPrice);
            Console.WriteLine("UnitPrice " + model.UnitPrice);
            Console.ReadLine();
        }
示例#13
0
        static void Main(string[] args)
        {
            ProductDirector productDirector = new ProductDirector();
            var             builder         = new OldCustomerProductBuilder();

            //var builder = new NewCustomerProductBuilder();
            productDirector.GenerateProduct(builder);
            var product = builder.GetProduct();

            Console.WriteLine(product.Id);
            Console.WriteLine(product.CategoryName);
            Console.WriteLine(product.ProductName);
            Console.WriteLine(product.UnitPrice);
            Console.WriteLine(product.DiscountedPrice);
            Console.WriteLine(product.DiscountApplied);
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            ProductDirector director = new ProductDirector();           //ürünümüzü üretmesi için çağırdık
            var             builder  = new NewCustomerProductBuilder(); //new veya old müşterilerimizin hangisini çağırmak istersek onu yazdık

            director.GenerateProduct(builder);
            var model = builder.GetModel(); //modelimizi çağırdık

            Console.WriteLine(model.Id);    //burada yazdığımız Builder desenini çağırarak modelimizin özelliklerini ve indirim işlemlerini çağırdık
            Console.WriteLine(model.CategoryName);
            Console.WriteLine(model.DiscountApplied);
            Console.WriteLine(model.DiscountedPrice);
            Console.WriteLine(model.ProductName);
            Console.WriteLine(model.UnitPrice);

            Console.ReadLine();
        }
示例#15
0
        static void Main(string[] args)
        {
            //arka arkaya işlemler sonucunda bir nesne üretmek.
            ProductDirector director = new ProductDirector();
            var             builder  = new NewCustomerProductBuilder();

            director.GenerateProduct(builder);
            var model = builder.GetModel();

            Console.WriteLine(model.Id);
            Console.WriteLine(model.ProductName);
            Console.WriteLine(model.CategoryName);
            Console.WriteLine(model.UnitPrice);
            Console.WriteLine(model.DiscountApplied);
            Console.WriteLine(model.DiscountedPrice);

            Console.ReadLine();
        }