private void btnDeleteMV_Click(object sender, EventArgs e) { int id; int.TryParse(txtIdMV.Text, out id); // Getting User ID from Form vehicleBLL.ID = id; if (DialogResult.Yes == MessageBox.Show("Are you sure want to delete?", "Delete Information!", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { bool success = vehicleDAL.Delete(vehicleBLL); success = true; ClearMV(); txtSearchMV.Focus(); } else { txtSearchMV.Focus(); } // Refresing Data Grid View DataTable dt = vehicleDAL.Select(); dgvMotorizedVehicle.DataSource = dt; DataView dv = dt.DefaultView; dv.Sort = "vehicle_no"; DataTable sortedDT = dv.ToTable(); }
/// <summary> /// Deletes Record from Database. /// </summary> /// <param name="objVehicle">Object containing all data values.</param> /// <returns>boolean value True if Record is deleted successfully /// otherwise returns False.</returns> public static bool Delete(Vehicle objVehicle) { bool recDel; recDel = VehicleDAL.Delete(objVehicle.Dbid); return(recDel); }
public static Boolean Delete(IList <int> _ids) { IList <Vehicle> _exist = null; Vehicle v = null; try { foreach (Int32 id in _ids) { v = VehicleDAL.FindById(id); if (v != null) { _exist.Add(v); } } if (_exist != null) { VehicleDAL.Delete(_exist); } return(true); } catch (Exception ex) { string message = string.Format("{0}", ex.Message); return(false); } }
public static bool Delete() { bool status = VehicleDAL.Delete(3); return(status); }
/// <summary> /// 删除一条数据 /// </summary> public void Delete(string FrameNO) { dal.Delete(FrameNO); }