private void toolAudit_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (DBGrid.RowCount == 0) { return; } if (DBGrid.SelectedRows.Count == 0 && DBGrid.CurrentRow == null) { return; } if (MessageBox.Show(clsTranslate.TranslateString("Do you really want to audit it?"), clsTranslate.TranslateString("Confirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } if (DBGrid.SelectedRows.Count == 0) { modPriceAdjustForm mod = _dal.GetItem(DBGrid.CurrentRow.Cells[0].Value.ToString(), out Util.emsg); if (_dal.Audit(mod.FormId, Util.UserId, out Util.emsg)) { MessageBox.Show(clsTranslate.TranslateString("Audit Success!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); LoadData(); } else { MessageBox.Show(clsTranslate.TranslateString(Util.emsg), mod.FormId, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } else { for (int i = DBGrid.SelectedRows.Count - 1; i >= 0; i--) { modPriceAdjustForm mod = _dal.GetItem(DBGrid.SelectedRows[i].Cells[0].Value.ToString(), out Util.emsg); if (_dal.Audit(mod.FormId, Util.UserId, out Util.emsg)) { DBGrid.SelectedRows[i].Cells["status"].Value = 1; DBGrid.SelectedRows[i].DefaultCellStyle.ForeColor = Color.DarkGray; DBGrid.SelectedRows[i].Selected = false; } else { MessageBox.Show(clsTranslate.TranslateString(Util.emsg), mod.FormId, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } LoadData(); } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }