private void btnDelete_Click_1(object sender, EventArgs e)//Working { var confirmResult = MessageBox.Show("Are you sure?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); ListView.CheckedIndexCollection checkedItem = listView1.CheckedIndices; if (confirmResult == DialogResult.Yes) { while (checkedItem.Count > 0) { listView1.Items.RemoveAt(checkedItem[0]); } salesLinesList.Clear(); int count = 0; foreach (ListViewItem i in listView1.Items) { int ID = Convert.ToInt16(listView1.Items[count].SubItems[0].Text); int Qty = Convert.ToInt16(listView1.Items[count].SubItems[1].Text); decimal TPrice = Convert.ToDecimal(listView1.Items[count].SubItems[2].Text); string shrtDesc = listView1.Items[count].SubItems[3].Text; SalesLines new_sl = new SalesLines(ID, Qty, TPrice, shrtDesc); salesLinesList.Add(new_sl); count++; } } }
private void btnAdd_Click(object sender, EventArgs e)//Working { frmAddSalesLines frmAddSalesLines = new frmAddSalesLines(productList); SalesLines saleslines = frmAddSalesLines.GetNew(); if (saleslines != null) { salesLinesList.Add(saleslines); } listUpdate(listView1); }
private void btnUpdate_Click(object sender, EventArgs e)//broken { ListView.CheckedIndexCollection checkedItem = listView1.CheckedIndices; while (checkedItem.Count > 0) { frmUpdateSalesLines updateSalesLinesForm = new frmUpdateSalesLines(productList, salesLinesList); SalesLines saleslines = updateSalesLinesForm.GetUpdate(); if (saleslines != null) { salesLinesList.Add(saleslines); } listUpdate(listView1); } }
private void btnAddSalesLines_Click(object sender, EventArgs e) { saleslines = new SalesLines(Convert.ToInt16(productComboBox.Text), Convert.ToInt16(txtQty.Text), Convert.ToDecimal(txtTotal.Text), txtShortDesc.Text); this.Close(); }