Пример #1
0
        public static void Main(string[] args)
        {
            //Create 2 new customers
            Console.WriteLine("Create 2 customers\n");

            var CustomerService = new CustomerService();

            CustomerService.CreateNewCustomer(new AddCustomerOptions
            {
                FirstName    = "George",
                LastName     = "Stathis",
                EmailAddress = "*****@*****.**",
                VatNumber    = "039660333",
                Phone        = "6983078378"
            });
            CustomerService.CreateNewCustomer(new AddCustomerOptions
            {
                FirstName    = "Alexandros",
                LastName     = "Papadopoulos",
                EmailAddress = "*****@*****.**",
                VatNumber    = "152629060",
                Phone        = "6988883088",
            });
            Console.WriteLine("The new Customers are:");
            CustomerService.PrintList();

            //Update the name of a customer
            Console.WriteLine("\nUpdate the data of a customer (firstname)\n" +
                              "Update the firstname of George to Georgios\n Insert George Stathis CustomerId");
            var k = Console.ReadLine();

            CustomerService.UpdateCustomerData(k, new TinyCR.UpdateCustomer()
            {
                FirstName = "Georgios",
            });
            CustomerService.PrintList();

            //Search active customers , with email [email protected]
            Console.WriteLine("Search active customer with email of George");
            CustomerService.SearchCustomerData(new Services.CustomerService.SearchCustomerDatas {
                email = "*****@*****.**"
            });

            //Create 3 new products and add them to the product list
            var product1 = new Product()
            {
                Id          = "0001",
                Description = "A Lenovo laptop i3",
                Name        = "LENOVO LAPTOP",
                Price       = 550
            };
            var product2 = new Product()
            {
                Id          = "0002",
                Description = "A Lenovo laptop i5",
                Name        = "LENOVO I5 LAPTOP",
                Price       = 650
            };
            var product3 = new Product()
            {
                Id          = "0003",
                Description = "A Lenovo laptop i7",
                Name        = "LENOVO I7 LAPTOP",
                Price       = 750
            };

            //Create a new order contains the 3 new products, and then update the DeliveryAddress
            Console.WriteLine("Create an order");
            var OrderService = new OrderService();
            var productlist  = new List <Product>();

            listOfProducts.Add(product1);
            listOfProducts.Add(product2);
            listOfProducts.Add(product3);

            OrderService.AddOrder(k, new AddOrderOption
            {
                DeliveryAddress  = "Stavroxwri,Kilkis",
                OrderProductList = listOfProducts,
            });

            Console.WriteLine("Select an order by id\n");
            var pi = Console.ReadLine();

            OrderService.GetOrderById(pi);

            //Update selected order, then Cancel this order
            OrderService.UpdateOrder(pi, new Services.OrderService.UpdateOrderOption
            {
                DeliveryAddress = "Nea Santa, Kilkis"
            });
            OrderService.GetOrderById(pi);

            Console.WriteLine("Cancel the order and then search if this order exists to the system");
            //Cancel updated order
            OrderService.UpdateOrder(pi, new Services.OrderService.UpdateOrderOption
            {
                TobeCancel = true
            });

            OrderService.GetOrderById(pi);
        }
Пример #2
0
        static void Main(string[] args)
        {
            var CustomerService = new CustomerService();

            CustomerService.CreateNewCustomer(new AddCustomerOptions
            {
                FirstName    = "George",
                LastName     = "Stathis",
                EmailAddress = "*****@*****.**",
                VatNumber    = "039660333"
            });
            CustomerService.CreateNewCustomer(new AddCustomerOptions
            {
                FirstName    = "Alexandros",
                LastName     = "Papadopoulos",
                EmailAddress = "*****@*****.**",
                VatNumber    = "152629060",
            });
            CustomerService.printList();
            var k = Console.ReadLine();

            CustomerService.UpdateCustomerData(k, new UpdateCustomer()
            {
                FirstName = "Giannis"
            });
            CustomerService.printList();
            //  Console.WriteLine(CustomerService.CustomerList.Count);
            //var q = Console.ReadLine();
            //CustomerService.UpdateCustomerData(q, new UpdateCustomer()
            //{
            //    FirstName = "kwstas"
            //});
            //CustomerService.printList();
            //var r = CustomerService.CustomerList[0].CustomerId;
            var product1 = new Product()
            {
                Id          = "0001",
                Description = "A Lenovo laptop i3",
                Name        = "LENOVO LAPTOP"
            };
            var product2 = new Product()
            {
                Id          = "0002",
                Description = "A Lenovo laptop i5",
                Name        = "LENOVO I5 LAPTOP"
            };
            var product3 = new Product()
            {
                Id          = "0003",
                Description = "A Lenovo laptop i7",
                Name        = "LENOVO I7 LAPTOP"
            };
            //var ProductService = new ProductService();
            //var OrderService = new OrderService();

            //listOfProducts.Add(product1);
            //listOfProducts.Add(product2);
            //listOfProducts.Add(product2);

            ////var orderproductList = new List<Product>();
            ////orderproductList = listOfProducts;
            //OrderService.AddOrder(k, new AddOrderOption
            //{
            //    DeliveryAddress = "saDAS",
            //    OrderProductList = listOfProducts

            //});


            //Console.WriteLine("ASDASDASDASD");
            //var po = Console.ReadLine();
            //OrderService.AddOrder(po, listOfProducts);
            //Console.WriteLine("DSfSD"+CustomerService.GetCustomerById(po).Orders.Count);
            ////foreach(Customer i in CustomerService.CustomerList) {
            ////    foreach (Order t in i.Orders) {
            //        Console.WriteLine(i.FirstName + i.LastName + t.CustomerName + t.DeliveryAddress);
            //    }
            //}

            ////CustomerService.CustomerList;
        }