protected override string uc_Delete() { DIC_ALLOWANCE dICALLOWANCE = new DIC_ALLOWANCE() { AllowanceCode = this.txtID.Text }; string str = dICALLOWANCE.Delete(); if (str == "OK") { this.RaiseSuccessEventHander(dICALLOWANCE); } return(str); }
public override void Delete() { object cellValue; if (!(MyRule.Get(MyLogin.RoleId, "bbiAllowance") != "OK")) { if (MyRule.AllowDelete) { if (ClsOption.System2.IsQuestion) { if (XtraMessageBox.Show("Bạn có muốn xóa không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } base.SetWaitDialogCaption("Đang xóa..."); string str = ""; bool flag = false; AdvBandedGridView advBandedGridView = this.gbList; int[] selectedRows = advBandedGridView.GetSelectedRows(); DIC_ALLOWANCE dICALLOWANCE = new DIC_ALLOWANCE(); for (int i = (int)selectedRows.Length; i > 0; i--) { flag = true; cellValue = base.GetCellValue(selectedRows[i - 1], "AllowanceCode"); if (cellValue != null) { SYS_LOG.Insert("Danh Mục Phụ Cấp", "Xoá", cellValue.ToString()); str = dICALLOWANCE.Delete(cellValue.ToString()); if (str == "OK") { advBandedGridView.DeleteRow(selectedRows[i - 1]); } else if (str != "OK") { MessageBox.Show(string.Concat("Thông tin không được xóa\n", str), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } } this.DoHide(); if (!flag) { if (advBandedGridView.DataSource != null) { RowClickEventArgs rowClickEventArg = new RowClickEventArgs((advBandedGridView == null ? -1 : advBandedGridView.FocusedRowHandle), (advBandedGridView.FocusedColumn == null ? -1 : advBandedGridView.FocusedColumn.ColumnHandle), (advBandedGridView.FocusedColumn == null ? "" : advBandedGridView.FocusedColumn.FieldName)); this.m_RowClickEventArgs = rowClickEventArg; cellValue = null; cellValue = base.GetCellValue(rowClickEventArg.RowIndex, "AllowanceCode"); if (cellValue != null) { SYS_LOG.Insert("Danh Mục Phụ Cấp", "Xoá", cellValue.ToString()); base.SetWaitDialogCaption("Đang xóa..."); str = dICALLOWANCE.Delete(cellValue.ToString()); if (str == "OK") { advBandedGridView.DeleteRow(rowClickEventArg.RowIndex); } else if (str != "OK") { MessageBox.Show(string.Concat("Thông tin không được xóa\n", str), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Hand); } this.DoHide(); } } } } else { MyRule.Notify(); } } }