protected override string uc_Delete() { HRM_SUBSIDIARY hRMSUBSIDIARY = new HRM_SUBSIDIARY() { SubsidiaryCode = this.txtID.Text }; string str = hRMSUBSIDIARY.Delete(); if (str == "OK") { this.RaiseSuccessEventHander(hRMSUBSIDIARY); } return(str); }
public override void Delete() { object cellValue; if (!(MyRule.Get(MyLogin.RoleId, "bbiSubsidiary") != "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(); HRM_SUBSIDIARY hRMSUBSIDIARY = new HRM_SUBSIDIARY(); for (int i = (int)selectedRows.Length; i > 0; i--) { flag = true; cellValue = base.GetCellValue(selectedRows[i - 1], "SubsidiaryCode"); if (cellValue != null) { // SYS_LOG.Insert("Danh Sách Công Ty Con", "Xoá", cellValue.ToString()); str = hRMSUBSIDIARY.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, "SubsidiaryCode"); if (cellValue != null) { // SYS_LOG.Insert("Danh Sách Công Ty Con", "Xoá", cellValue.ToString()); base.SetWaitDialogCaption("Đang xóa..."); str = hRMSUBSIDIARY.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(); } } }