private void DeleteButton_Click(object sender, EventArgs e) { HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory PlateCityFactory = new HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory PlateCity_TFactory = new HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory(); HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys PlateCityKey = new HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys(); PlateCityKey.PlateCityID_int = (Int32?)PlateCityGridView.CurrentRow.Cells["colPlateCityID_int"].Value; PlateCityFactory.Delete(PlateCityKey); DataRow[] dr = ((DataTable)this.PlateCityGridView.DataSource).Select(HPS.BLL.PlateCityBLL.BLLPlateCity_T.PlateCity_TField.PlateCityID_int.ToString() + "='" + PlateCityKey.PlateCityID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.PlateCityGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
protected override void Delete() { HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory PlateCityFactory = new HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true) { PlateCityFactory.BeginProc(); PlateCityFactory.Delete((HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys)Key); PlateCityFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.PlateCityBLL.BLLPlateCity_T.PlateCity_TField.PlateCityID_int.ToString() + "='" + ((HPS.BLL.PlateCityBLL.BLLPlateCity_TKeys)Key).PlateCityID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } DataTable.AcceptChanges(); } this.Close(); } } catch (Exception ex) { PlateCityFactory.RollBackProc(); throw ex; } }