private void lstInventory_CellClick(object sender, DataGridViewCellEventArgs e) { var id = int.Parse(lstInventory.CurrentRow.Cells[0].Value.ToString()); currentInventory = context.inventories.Single(x => x.id == id); setInventory(); }
private void btnAddNew_Click(object sender, EventArgs e) { currentInventory = new inventory(); setInventory(); lblAction.Text = "Add New Inventory"; makeEditable(); }
private void lstInventory_SelectionChanged(object sender, EventArgs e) { if (lstInventory.CurrentRow == null) { return; } var id = int.Parse(lstInventory.CurrentRow.Cells[0].Value.ToString()); currentInventory = context.inventories.Single(x => x.id == id); setInventory(); }
private void lstInventory_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e) { if (lstInventory.CurrentRow == null || e.StateChanged != DataGridViewElementStates.Selected) { return; } var id = int.Parse(lstInventory.CurrentRow.Cells[0].Value.ToString()); currentInventory = context.inventories.Single(x => x.id == id); setInventory(); }
private void lstInventory_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e) { if (lstInventory.SelectedRows.Count == 0) { return; } var id = int.Parse(lstInventory.SelectedRows[0].Cells[0].Value.ToString()); currentInventory = context.inventories.Single(x => x.id == id); setInventory(); }
private void btnCancel_Click(object sender, EventArgs e) { if (lstInventory.CurrentRow == null) { return; } var id = int.Parse(lstInventory.CurrentRow.Cells[0].Value.ToString()); currentInventory = context.inventories.Single(x => x.id == id); setInventory(); makeReadOnly(); }
private void btnAddItem_Click(object sender, EventArgs e) { var selectDlg = new InventoryList(); var result = selectDlg.ShowDialog(); /* * orderInventories.id as oiid, * orderInventories.order as oid, * inventories.id as id, * orderInventories.qty as qty, * inventories.name as ModelName, * inventories.modelnumber as ModelNumber, * inventories.price as Price, * inventories.price* orderInventories.qty as TotalPrice*/ if (result == DialogResult.OK) { inventory inv = selectDlg.Inventory; int qty = selectDlg.count; DataRow dr = dt.Rows.Add(0, inv.id, qty, selectDlg.categoryName, inv.name, inv.modelNumber, inv.description, string.Format("{0:0.00}", inv.price), string.Format("{0:0.00}", inv.price * qty)); } autoCalcPrice(); }