protected override string uc_Delete() { DIC_SCHOOL dICSCHOOL = new DIC_SCHOOL() { SchoolCode = this.txtID.Text }; string str = dICSCHOOL.Delete(); if (str == "OK") { this.RaiseSuccessEventHander(dICSCHOOL); } return(str); }
public override void Delete() { object cellValue; if (!(MyRule.Get(MyLogin.RoleId, "bbiSchool") != "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_SCHOOL dICSCHOOL = new DIC_SCHOOL(); for (int i = (int)selectedRows.Length; i > 0; i--) { flag = true; cellValue = base.GetCellValue(selectedRows[i - 1], "SchoolCode"); if (cellValue != null) { // SYS_LOG.Insert("Danh Mục Trường Học", "Xoá", cellValue.ToString()); str = dICSCHOOL.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, "SchoolCode"); if (cellValue == null) { return; } // SYS_LOG.Insert("Danh Mục Trường Học", "Xoá", cellValue.ToString()); base.SetWaitDialogCaption("Đang xóa..."); str = dICSCHOOL.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 { return; } } this.RaiseDeletedEventHander(); } else { MyRule.Notify(); } } }