private void DeleteButton_Click(object sender, EventArgs e) { HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlacesFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaces_TFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys PortPlacesKey = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys(); PortPlacesKey.PortPlacesID_int = (Int32?)PortPlacesGridView.CurrentRow.Cells["colPortPlacesID_int"].Value; PortPlacesFactory.Delete(PortPlacesKey); DataRow[] dr = ((DataTable)this.PortPlacesGridView.DataSource).Select(HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlacesID_int.ToString() + "='" + PortPlacesKey.PortPlacesID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.PortPlacesGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
protected override void Delete() { HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlacesFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true) { PortPlacesFactory.BeginProc(); PortPlacesFactory.Delete((HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys)Key); PortPlacesFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlacesID_int.ToString() + "='" + ((HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys)Key).PortPlacesID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } DataTable.AcceptChanges(); } this.Close(); } } catch (Exception ex) { PortPlacesFactory.RollBackProc(); throw ex; } }