Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                customerService = new Order_Graber_DataService.Services.CustomerService();
                CUSTOMERS newCustomer = new CUSTOMERS()
                {
                    document_type = textBox1.Text,
                    document_nro  = textBox2.Text,
                    customer_name = textBox3.Text,
                    address       = textBox4.Text,
                    phone         = textBox5.Text,
                    email         = textBox6.Text,
                    state         = textBox7.Text,
                };

                customerService.InsertCustomer(newCustomer);

                Datos Check = new Datos();
                Check.Show();
                Hide();
            }
            catch
            {
                MessageBox.Show("Error");
            }
        }
        public ActionResult Edit(int id, Order_Graber_DataService.CUSTOMERS datosFront)
        {
            try
            {
                customerService = new Order_Graber_DataService.Services.CustomerService();
                Order_Graber_DataService.CUSTOMERS updateCustomer = new Order_Graber_DataService.CUSTOMERS()
                {
                    client_id     = id,
                    document_type = datosFront.document_type,
                    document_nro  = datosFront.document_nro,
                    customer_name = datosFront.customer_name,
                    address       = datosFront.address,
                    phone         = datosFront.phone,
                    email         = datosFront.email,
                    state         = datosFront.state,
                };

                customerService.UpdateCustomer(updateCustomer);
                return(RedirectToAction("IndexCustomer"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Edit(int id)
        {
            customerService = new Order_Graber_DataService.Services.CustomerService();
            CUSTOMERS editCustomer = new CUSTOMERS();


            editCustomer = customerService.GetCustomerById(id);


            return(View(editCustomer));
        }
        public ActionResult Delete(int id)
        {
            customerService = new Order_Graber_DataService.Services.CustomerService();
            CUSTOMERS deleteCustomer = new CUSTOMERS();

            deleteCustomer = customerService.GetCustomerById(id);



            return(View(deleteCustomer));
        }
        public ActionResult IndexCustomer()
        {
            ViewBag.Title = "Clientes";

            customerService = new Order_Graber_DataService.Services.CustomerService();

            var customersList = customerService.GetAllCustomers();


            return(View(customersList));
        }
Пример #6
0
        private void gridClientes_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            Order_Graber_DataService.Services.CustomerService customerService;

            customerService = new Order_Graber_DataService.Services.CustomerService();


            var customersList = customerService.GetAllCustomers();

            MessageBox.Show("" + customersList);
        }
Пример #7
0
        public Datos()
        {
            InitializeComponent();

            gridClientes.Columns.Add("nombre", "Nombre");
            gridClientes.Columns.Add("telefono", "Telefono");
            gridClientes.Columns.Add("state", "State");

            gridProductos.Columns.Add("nombre", "Nombre");
            gridProductos.Columns.Add("precio", "precio al costo");
            gridProductos.Columns.Add("state", "State");

            gridOrdenes.Columns.Add("fecha", "Fecha");
            gridOrdenes.Columns.Add("total", "Total");
            gridOrdenes.Columns.Add("state", "State");

            gridDetOrd.Columns.Add("id_orden", "Id de orden");
            gridDetOrd.Columns.Add("id_producto", "Id de producto");
            gridDetOrd.Columns.Add("cantidad", "Cantidad");
            gridDetOrd.Columns.Add("total", "Total");

            customerService = new Order_Graber_DataService.Services.CustomerService();
            var customersList = customerService.GetAllCustomers();


            foreach (var i in customersList)
            {
                gridClientes.Rows.Add(i.customer_name, i.phone, i.state);
            }

            productService = new Order_Graber_DataService.Services.ProductService();
            var products = productService.GetAllProducts();

            foreach (var i in products)
            {
                gridProductos.Rows.Add(i.product_name, i.cost_price, i.state);
            }

            orderService = new Order_Graber_DataService.Services.OrderService();
            var orderList = orderService.GetAllOrders();

            foreach (var i in orderList)
            {
                gridOrdenes.Rows.Add(i.order_date, i.total_order, i.state);
            }

            orderDetailService = new Order_Graber_DataService.Services.OrderDetailService();
            var ordersDetails = orderDetailService.GetAllOrdersDetails();

            foreach (var i in ordersDetails)
            {
                gridDetOrd.Rows.Add(i.order_id, i.product_id, i.quantity, i.total_line);
            }
        }
Пример #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            gridClientes.Rows.Clear();

            customerService = new Order_Graber_DataService.Services.CustomerService();

            var customersList = customerService.GetAllCustomers();


            foreach (var i in customersList)
            {
                gridClientes.Rows.Add(i.customer_name, i.phone, i.state);
            }
        }
        public ActionResult Delete(int id, CUSTOMERS datosFront)
        {
            try
            {
                customerService = new Order_Graber_DataService.Services.CustomerService();
                CUSTOMERS deleteCustomer = new CUSTOMERS()
                {
                    client_id = id,
                };

                customerService.DeleteCustomer(deleteCustomer.client_id);

                return(RedirectToAction("IndexCustomer"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create(CUSTOMERS datosFront)
        {
            try
            {
                customerService = new Order_Graber_DataService.Services.CustomerService();
                CUSTOMERS newCustomer = new CUSTOMERS()
                {
                    document_type = datosFront.document_type,
                    document_nro  = datosFront.document_nro,
                    customer_name = datosFront.customer_name,
                    address       = datosFront.address,
                    phone         = datosFront.phone,
                    email         = datosFront.email,
                    state         = datosFront.state
                };

                customerService.InsertCustomer(newCustomer);
                return(RedirectToAction("IndexCustomer"));
            }
            catch
            {
                return(View());
            }
        }