protected override void Delete() { HPS.BLL.UserGroupBLL.BLLUserGroup_TFactory UserGroupFactory = new HPS.BLL.UserGroupBLL.BLLUserGroup_TFactory(); try { UserGroupFactory.BeginProc(); UserGroupFactory.Delete((HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys)Key); UserGroupFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.UserGroupID_int.ToString() + "='" + ((HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys)Key).UserGroupID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } DataTable.AcceptChanges(); } this.Close(); } catch (Exception ex) { UserGroupFactory.RollBackProc(); throw ex; } }
private void DeleteButton_Click(object sender, EventArgs e) { HPS.BLL.UserGroupBLL.BLLUserGroup_TFactory UserGroupFactory = new HPS.BLL.UserGroupBLL.BLLUserGroup_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false) { return; } HPS.BLL.UserGroupBLL.BLLUserGroup_TFactory UserGroup_TFactory = new HPS.BLL.UserGroupBLL.BLLUserGroup_TFactory(); HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys UserGroupKey = new HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys(); UserGroupKey.UserGroupID_int = (Int32?)UserGroupGridView.CurrentRow.Cells["colUserGroupID_int"].Value; UserGroupFactory.Delete(UserGroupKey); DataRow[] dr = ((DataTable)this.UserGroupGridView.DataSource).Select(HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.UserGroupID_int.ToString() + "='" + UserGroupKey.UserGroupID_int.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } ((DataTable)this.UserGroupGridView.DataSource).AcceptChanges(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }