private void toolStripButton4_Click(object sender, EventArgs e) { if (MessageBox.Show("Record will be removed", "Warning", MessageBoxButtons.YesNo) == DialogResult.Yes) { int id = Convert.ToInt32(this.ProdListV.SelectedItems[0].Text); _supplier.Delete(id); MessageBox.Show("Record has been deleted."); } else { MessageBox.Show("Please select item first."); } loadInformation(); }
protected void m_grid_RowDeleting(object sender, GridViewDeleteEventArgs e) { string message = ""; try { Suppliers m_Suppliers = new Suppliers(); m_Suppliers.SupplierId = System.Int32.Parse(m_grid.DataKeys[e.RowIndex].Value.ToString()); m_Suppliers.Delete(); } catch (Exception ex) { sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name); } ShowGrid(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonSupDelete_Click(object sender, EventArgs e) { if (textBoxSupId.Text != "") { string strEmployee = textBoxSupName.Text; if (strEmployee == " ") { strEmployee = textBoxSupId.Text; } Suppliers aSupplier = new Suppliers(); if (!(aSupplier.IsDuplicateId(Convert.ToInt32(textBoxSupId.Text)))) { MessageBox.Show("Supplier Id Not Found!", "Wrong Id", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } byte Option = Convert.ToByte(MessageBox.Show("Confirm delete of Supplier\n " + strEmployee + " ?", "Delete Supplier", MessageBoxButtons.YesNo, MessageBoxIcon.Question)); if (Option == 6) { //=========================================================== // Delete dependencies //=========================================================== /* In this case Books of this Supplier will not be deleted, * Once the Inventory might have some books in stock yet. * But it wil not be possible to update books quantity for * Books that are supplied by the delete Supplier. * =============================================================*/ //=========================================================== // Now delete Supplier //=========================================================== aSupplier.Delete(Convert.ToInt32(textBoxSupId.Text)); MessageBox.Show("Supplier Deleted Succesfully!", "Supplier Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information); RefreshListViewSup(); } } else { MessageBox.Show("Please enter a valid Supplier Id", "No Supplier Id", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
protected void lbDelete_Click(object sender, EventArgs e) { try { Suppliers m_Suppliers = new Suppliers(); foreach (GridViewRow m_Row in m_grid.Rows) { CheckBox chkAction = (CheckBox)m_Row.FindControl("chkAction"); if (chkAction != null) { if (chkAction.Checked) { m_Suppliers.SupplierId = System.Int32.Parse(m_grid.DataKeys[m_Row.RowIndex].Value.ToString()); m_Suppliers.Delete(); } } } ShowGrid(); } catch (Exception ex) { sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name); } }
public static void DeleteSupplier(int id) { Suppliers.Delete(id); }