private void button28_Click(object sender, EventArgs e) { BillShipList cBSList = new BillShipList(cID); if (FormMode == "EDIT") { cBSList.DeleteCustBillShip(ShipID); } //Delete this.Hide(); }
private void button27_Click(object sender, EventArgs e) { //Save or Update BillShipList cBSList = new BillShipList(cID); if (FormMode == "NEW") { cBSList.AddCustBillShip(Form2Object()); } else if (FormMode == "EDIT") { CustBillShip c = new CustBillShip(); c = Form2Object(); c.ID = ShipID; cBSList.UpdateCustBillShip(c); } this.Hide(); }
private void LoadBillShip(int cID) { BillShipList cBSList = new BillShipList(cID); clearlist(); if (cID != 0) { cBSList = new BillShipList(cID); foreach(CustBillShip c in cBSList.GetCustBillShip()) { DataGridViewRow item = new DataGridViewRow(); item.CreateCells(dataGridView5); item.Cells[0].Value = c.AddressName; item.Cells[1].Value = c.AddressType; dataGridView5.Rows.Add(item); } } }
private void EditAddress() { try { DataGridViewRow item = dataGridView5.SelectedRows[0]; String strAddrName = item.Cells[0].Value.ToString(); ; String strAddrType = item.Cells[1].Value.ToString(); Customer c1 = CustList.SearchCustomer(CustIDcombo.Text); BillShipList cBSList = new BillShipList(c1.ID); if (cBSList.BillShipExists(strAddrName, strAddrType)) { CustBillShip c2 = cBSList.SearchBillShip(strAddrName, strAddrType); Form10 f2 = new Form10(ref c2, "EDIT"); f2.ShowDialog(); LoadBillShip(c1.ID); } } catch (Exception ex) { MessageBox.Show("Error in Edit Address " + ex.Message); } }
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); } }
//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); } } } }