コード例 #1
0
 /// Handles the SPD errors.
 /// </summary>
 /// <param name="e">The e.</param>
 private static void handleSPDError(Exception e)
 {
     SPDException spdExcetion;
     if (e is SPDException) {
         spdExcetion = (SPDException)e;
     } else {
         spdExcetion = new SPDException(e, null, null);
     }
     log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType).Fatal(spdExcetion.GetDetailInfo());
     ShowErrorForm showErrorForm = new ShowErrorForm(spdExcetion);
     showErrorForm.ShowDialog();
     Application.Exit();
 }
コード例 #2
0
        /// <summary>
        /// 显示错误信息
        /// </summary>
        /// <param name="ex"></param>
        public static void ShowError(Exception ex)
        {
            ShowErrorForm form = new ShowErrorForm(ex);

            form.ShowDialog();
        }
コード例 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_ReportName == "")
            {
                InputStringForm form = new InputStringForm("请输入报表名称", "");
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                _ReportName = form.InputContext.Trim();
                bool find = true;
                while ((_ReportName != "" && find) || _ReportName == "")
                {
                    if (_ReportName == "")
                    {
                        MessageBox.Show("报表名称必须设定,请重新输入。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        form = new InputStringForm("请输入报表名称", "");
                        if (form.ShowDialog() != DialogResult.OK)
                        {
                            _ReportName = "";
                            return;
                        }
                        _ReportName = form.InputContext.Trim();
                    }
                    find = false;
                    string    sql   = SqlHelper.GetSql("SelectReportName");
                    DataTable table = SqlHelper.Select(sql, null);
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        if (table.Rows[i]["ReportName"].ToString() == _ReportName)
                        {
                            find = true;
                            MessageBox.Show("报表名称重复,请重新输入。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            form = new InputStringForm("请输入报表名称", "");
                            if (form.ShowDialog() != DialogResult.OK)
                            {
                                _ReportName = "";
                                return;
                            }
                            _ReportName = form.InputContext.Trim();
                            break;
                        }
                    }
                }
            }
            SqlConnection  conn = null;
            SqlTransaction tran = null;

            try
            {
                conn = SqlHelper.GetConnection();
                conn.Open();
                tran = conn.BeginTransaction();
                decimal id = SaveReport(conn, tran);
                if (radioButton2.Checked)
                {
                    SaveReportParameter(conn, tran, id);
                }
                _ReportId = id;
                tran.Commit();
                conn.Close();
            }
            catch (Exception ex)
            {
                if (conn != null)
                {
                    if (tran != null)
                    {
                        tran.Rollback();
                    }
                    conn.Close();
                }
                ShowErrorForm form = new ShowErrorForm(ex);
                form.ShowDialog(this);
            }
        }