private void DeleteAllBillShip(int cID) { try { BillShipList cBSList = new BillShipList(cID); ArrayList delList = new ArrayList(); foreach (CustBillShip c in cBSList.GetCustBillShip()) { delList.Add(c.ID); } foreach (int i in delList) { cBSList.DeleteCustBillShip(i); } clearlist(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button28_Click(object sender, EventArgs e) { BillShipList cBSList = new BillShipList(cID); if (FormMode == "EDIT") { cBSList.DeleteCustBillShip(ShipID); } //Delete this.Hide(); }
//Delete A Shipping Address private void button70_Click(object sender, EventArgs e) { // Delete Address if (dataGridView5.SelectedCells.Count > 0) { DialogResult result = MessageBox.Show("Are you sure you want to delete the current Address? " + "Doing so will also delete the selected BillTo or ShipTo Address.", "Delete Address?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, MessageBoxOptions.DefaultDesktopOnly, false); if (result == DialogResult.Yes) { try { string strAddrName; string strAddrType; strAddrName = dataGridView5.SelectedCells[0].Value.ToString(); strAddrType = dataGridView5.SelectedCells[1].Value.ToString(); Customer c1 = new Customer(); c1 = CustList.SearchCustomer(CustIDcombo.Text); BillShipList cBSList = new BillShipList(c1.ID); cBSList.DeleteCustBillShip(cBSList.SearchBillShip(strAddrName, strAddrType).ID); LoadBillShip(c1.ID); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }