protected override void Delete() { HPS.BLL.CarBLL.BLLCar_TFactory CarFactory = new HPS.BLL.CarBLL.BLLCar_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true) { CarFactory.BeginProc(); CarFactory.Delete((HPS.BLL.CarBLL.BLLCar_TKeys)Key); CarFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.CarBLL.BLLCar_T.Car_TField.CarID_int.ToString() + "='" + ((HPS.BLL.CarBLL.BLLCar_TKeys)Key).CarID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } DataTable.AcceptChanges(); } this.Close(); } } catch (Exception ex) { CarFactory.RollBackProc(); throw ex; } }
private void DeleteButton_Click(object sender, EventArgs e) { HPS.BLL.CarBLL.BLLCar_TFactory CarFactory = new HPS.BLL.CarBLL.BLLCar_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.CarBLL.BLLCar_TFactory Car_TFactory = new HPS.BLL.CarBLL.BLLCar_TFactory(); HPS.BLL.CarBLL.BLLCar_TKeys CarKey = new HPS.BLL.CarBLL.BLLCar_TKeys(); CarKey.CarID_int = (Int32)CarGridView.CurrentRow.Cells["colCarID_int"].Value; CarFactory.Delete(CarKey); DataRow[] dr = ((DataTable)this.CarGridView.DataSource).Select(HPS.BLL.CarBLL.BLLCar_T.Car_TField.CarID_int.ToString() + "='" + CarKey.CarID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.CarGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }