protected override void Delete() { HPS.BLL.MessageBLL.BLLMessage_TFactory MessageFactory = new HPS.BLL.MessageBLL.BLLMessage_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true) { MessageFactory.BeginProc(); MessageFactory.Delete((HPS.BLL.MessageBLL.BLLMessage_TKeys)Key); MessageFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.MessageID_bint.ToString() + "='" + ((HPS.BLL.MessageBLL.BLLMessage_TKeys)Key).MessageID_bint.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } DataTable.AcceptChanges(); } this.Close(); } } catch (Exception ex) { MessageFactory.RollBackProc(); throw ex; } }
private void DeleteButton_Click(object sender, EventArgs e) { HPS.BLL.MessageBLL.BLLMessage_TFactory MessageFactory = new HPS.BLL.MessageBLL.BLLMessage_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.MessageBLL.BLLMessage_TFactory Message_TFactory = new HPS.BLL.MessageBLL.BLLMessage_TFactory(); HPS.BLL.MessageBLL.BLLMessage_TKeys MessageKey = new HPS.BLL.MessageBLL.BLLMessage_TKeys(); MessageKey.MessageID_bint = (Int64?)MessageGridView.CurrentRow.Cells["colMessageID_bint"].Value; MessageFactory.Delete(MessageKey); DataRow[] dr = ((DataTable)this.MessageGridView.DataSource).Select(HPS.BLL.MessageBLL.BLLMessage_T.Message_TField.MessageID_bint.ToString() + "='" + MessageKey.MessageID_bint.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.MessageGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }