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); } }
// GET: Order public ActionResult IndexOrder() { ViewBag.Title = "Ordenes"; orderService = new Order_Graber_DataService.Services.OrderService(); var customersList = orderService.GetAllOrders(); return(View(customersList)); }
private void button5_Click(object sender, EventArgs e) { gridOrdenes.Rows.Clear(); 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); } }