private void FillComboBoxProduct() { List <ProductStatusClass> statuses = new List <ProductStatusClass>(); try { statuses = Product_statusDBClass.GetProduct_status(); comboBoxStatusProduct.DataSource = statuses; comboBoxStatusProduct.DisplayMember = "status"; comboBoxStatusProduct.ValueMember = "id"; } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } }
private void FillListViewAddedOrder() { lstAddedOrder.Items.Clear(); List <ProductClass> products = new List <ProductClass>(); products = ProductDB_Class.GetProducts(); List <ProductStatusClass> statuses = new List <ProductStatusClass>(); statuses = Product_statusDBClass.GetProduct_status(); foreach (ProductClass product in products) { string statusName = ""; int statusID = 0; foreach (ProductStatusClass status in statuses) { if (product.idStatusProduct == status.id) { statusID = status.id; statusName = status.status; } } lstAddedOrder.Columns[0].ListView.Font = new Font(lstAddedOrder.Columns[0].ListView.Font, FontStyle.Bold); string[] row = { product.nameProduct, product.descriptionProduct, product.createdProduct.ToString("d"), product.updatedProduct.ToString("d"), product.costProduct.ToString(), statusName, statusID.ToString(), product.idProduct.ToString() }; ListViewItem listProduct1 = new ListViewItem(row); listProduct1.Font = new Font(listProduct1.Font, FontStyle.Regular); lstAddedOrder.Items.Add(listProduct1); } }