protected override void Delete() { HPS.BLL.ProvinceBLL.BLLProvince_TFactory ProvinceFactory = new HPS.BLL.ProvinceBLL.BLLProvince_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true) { ProvinceFactory.BeginProc(); ProvinceFactory.Delete((HPS.BLL.ProvinceBLL.BLLProvince_TKeys)Key); ProvinceFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.ProvinceBLL.BLLProvince_T.Province_TField.Province_int.ToString() + "='" + ((HPS.BLL.ProvinceBLL.BLLProvince_TKeys)Key).Province_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } DataTable.AcceptChanges(); } this.Close(); } } catch (Exception ex) { ProvinceFactory.RollBackProc(); throw ex; } }
private void DeleteButton_Click(object sender, EventArgs e) { HPS.BLL.ProvinceBLL.BLLProvince_TFactory ProvinceFactory = new HPS.BLL.ProvinceBLL.BLLProvince_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.ProvinceBLL.BLLProvince_TFactory Province_TFactory = new HPS.BLL.ProvinceBLL.BLLProvince_TFactory(); HPS.BLL.ProvinceBLL.BLLProvince_TKeys ProvinceKey = new HPS.BLL.ProvinceBLL.BLLProvince_TKeys(); ProvinceKey.Province_int = (Int32?)ProvinceGridView.CurrentRow.Cells["colProvince_int"].Value; ProvinceFactory.Delete(ProvinceKey); DataRow[] dr = ((DataTable)this.ProvinceGridView.DataSource).Select(HPS.BLL.ProvinceBLL.BLLProvince_T.Province_TField.Province_int.ToString() + "='" + ProvinceKey.Province_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.ProvinceGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }