private void btn_OK_Click(object sender, EventArgs e) { try { if (CheckInput()) { GetEntity(); var CounterBLL = new CT_CounterBLL(); if (EditType == 1) { CounterBLL.Add(m_counter); ShowMessageBox.ShowInformation("添加成功!"); DialogResult = DialogResult.OK; Close(); } else { CounterBLL.Update(m_counter); ShowMessageBox.ShowInformation("修改成功!"); DialogResult = DialogResult.OK; Close(); } } } catch (Exception ex) { ShowMessageBox.ShowInformation("编辑失败!"); string errCode = "GL-3032"; string errMsg = "编辑保存失败!"; var exception = new VTException(errCode, errMsg, ex); LogHelper.WriteError(exception.ToString(), exception.InnerException); } }