private void btnChangeStatusOrder_Click(object sender, EventArgs e) { if (comboBoxOrderStatus.SelectedIndex == 0) { MessageBox.Show(" Select from 'Order status' "); } else { OrderClass ChangeStatus = new OrderClass(); if (lstOrder.SelectedItems.Count > 0) { ListViewItem item = lstOrder.SelectedItems[0]; ChangeStatus.idOrders = Convert.ToInt32(item.SubItems[0].Text); ChangeStatus.statusOrderId = (int)comboBoxOrderStatus.SelectedValue; bool returnedResult = OrderDB_Class.ChangeStatusOrder(ChangeStatus); if (returnedResult) { FillListViewOrders(); MessageBox.Show("Order changed"); } else { MessageBox.Show("Error"); } } else { MessageBox.Show("'Please select an 'Order list'."); } } }
private void FillListViewOrders() { lstOrder.Columns[0].ListView.Font = new Font(lstOrder.Columns[0].ListView.Font, FontStyle.Bold); lstOrder.Items.Clear(); List <OrderClass> orders = new List <OrderClass>(); orders = OrderDB_Class.GetOrders(); foreach (OrderClass order in orders) { string[] row = { order.idOrders.ToString(), order.dateOrder.ToString("d"), order.subtotalOrders.ToString(), order.taxOrder.ToString(), order.totalOrder.ToString(), order.statusOrderId.ToString(), order.client_id.ToString() }; ListViewItem listOrder = new ListViewItem(row); listOrder.Font = new Font(listOrder.Font, FontStyle.Regular); lstOrder.Items.Add(listOrder); } }
private void FillListViewOrders() { products = OrderDB_Class.GetProductByID(orderID); foreach (ProductClass product in products) { lstDisplayProduct.Columns[0].ListView.Font = new Font(lstDisplayProduct.Columns[0].ListView.Font, FontStyle.Bold); string[] row1 = { product.nameProduct, product.descriptionProduct, product.costProduct.ToString(), product.ammountProduct.ToString(), }; ListViewItem listUser = new ListViewItem(row1); listUser.Font = new Font(listUser.Font, FontStyle.Regular); lstDisplayProduct.Items.Add(listUser); } }
private void btnAddOrder_Click(object sender, EventArgs e) { AddOrder addOrderClick = new AddOrder(); var result = addOrderClick.ShowDialog(); if (result == DialogResult.OK) { OrderClass orderClass = addOrderClick.getOrder; List <Order_Products> products = addOrderClick.getProducts; bool returnedResult = OrderDB_Class.AddOrder(orderClass, products); if (returnedResult) { FillListViewOrders(); MessageBox.Show("Order added"); } else { MessageBox.Show("Error"); } } }