public override void Delete() { if (this.CurrentId != 0) { if (MessageBox.Show("Вы действительно хотите удалить запись?", "Удаление записи", MessageBoxButtons.OKCancel).Equals(DialogResult.OK)) { Warranty warranty = Databases.Tables.Warranties[this.CurrentId]; warranty.Delete(); Init(); } } }
protected void m_grid_RowDeleting(object sender, GridViewDeleteEventArgs e) { string message = ""; try { Warranty m_Warranty = new Warranty(); m_Warranty.WarrantyId = System.Int16.Parse(m_grid.DataKeys[e.RowIndex].Value.ToString()); m_Warranty.Delete(); } catch (Exception ex) { sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name); } ShowGrid(); }
protected void lbDelete_Click(object sender, EventArgs e) { try { Warranty m_Warranty = new Warranty(); foreach (GridViewRow m_Row in m_grid.Rows) { CheckBox chkAction = (CheckBox)m_Row.FindControl("chkAction"); if (chkAction != null) { if (chkAction.Checked) { m_Warranty.WarrantyId = System.Int16.Parse(m_grid.DataKeys[m_Row.RowIndex].Value.ToString()); m_Warranty.Delete(); } } } ShowGrid(); } catch (Exception ex) { sms.utils.Log.writeLog(ex.ToString(), ((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name); } }