Exemple #1
0
        public OrdersOperations(IOrderView view, DataAccessOrder orderData)
        {
            this.view      = view;
            this.orderData = orderData;

            var orders = orderData.RetrieveOrder();

            this.view.LoadOrder(orders);


            view.Add += () =>
            {
                var order = view.AddOrder();
                orderData.AddOrder(order);

                DataAccessActivity activity = new DataAccessActivity();
                var a = view.AddOrderActivity();
                activity.AddActivity(a);

                view.TotalOrder();
            };

            view.Updatee += () =>
            {
                var order = view.UpdateOrder();
                orderData.UpdateOrder(order);
            };



            view.Ret += () =>
            {
                orders = orderData.RetrieveOrder();
                this.view.LoadOrder(orders);
            };

            view.AddProduct += () =>
            {
                AddProdus();
            };

            view.Products += () =>
            {
                var productForm       = new FormProduct();
                var productRepository = new DataAccessProduct();
                var productPresenter  = new ProductOperations(productForm, productRepository);
                productForm.Show();
            };
            view.EmployeeCustomer += () =>
            {
                var customerForm       = new FormCustomerEmployee();
                var customerRepository = new DataAccessCustomer();
                var customerPresenter  = new CustomerOperations(customerForm, customerRepository);
                customerForm.Show();

                var productForm       = new FormProduct();
                var productRepository = new DataAccessProduct();
                var productPresenter  = new ProductOperations(productForm, productRepository);
            };
        }
        public void AddOrder(Order order)
        {
            DataAccessOrder dal = new DataAccessOrder();

            dal.AddOrder(order);
        }