public OrdersForm(services.Fiscal setFiscal, string setCashierName = "Unknow") { fiscal = setFiscal; cashierName = setCashierName; InitializeComponent(); orders = new repositories.Order(db); dataMapper = new services.DataMapper(db); dataMapper.FillOrders(orders); foreach (entities.Order order in orders.GetList()) { ordersProvider.Add(order); } ordersListGridView.DataSource = ordersProvider; if (orders.GetList().Count() > 0) { orderElementsBox.Visible = true; entities.Order order = orders.GetList()[0]; elementsProvider = new tools.OrderElementProvider(); foreach (entities.OrderElement orderElement in order.GetElements()) { elementsProvider.Add(orderElement); } elementsListGridView.DataSource = elementsProvider; } }
private void ordersListGridView_CellClick(object sender, DataGridViewCellEventArgs e) { orderElementsBox.Visible = true; int index = ordersListGridView.CurrentCell.RowIndex; entities.Order order = orders.GetList()[index]; elementsProvider = new tools.OrderElementProvider(); foreach (entities.OrderElement orderElement in order.GetElements()) { elementsProvider.Add(orderElement); } elementsListGridView.DataSource = elementsProvider; }