Newer
Older
GHFX_REFACTOR / EMS_Forms / Form_EventResult.cs
wxn on 28 Nov 2016 1 KB 管线定位
using System;
using System.Data;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using System.Data.OracleClient;

namespace Cyberpipe.EMS_Forms
{
    public partial class Form_EventResult : Office2007Form
    {
        int dbId;
        string result;
        OracleConnection conn = null;
        public delegate void Handle();
        public event Handle refresh;

        public Form_EventResult(int dbId,string result)
        {
            this.dbId = dbId;
            this.result = result;
            InitializeComponent();
        }

        private void Form_EventResult_Load(object sender, EventArgs e)
        {
            richTextBox_EventResult.Text = result;
        }

        private void button_submit_Click(object sender, EventArgs e)
        {
            int r = (int)MessageBox.Show("是否确定提交事件结果", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
            if (r != 1) return;
            result = richTextBox_EventResult.Text;
            if (result == null || result.Trim().Equals(""))
            {
                MessageBox.Show("处理结果不能为空", "提示");
                return;

            }
            try
            {

                conn = OledbHelper.sqlConnection();
                conn.Open();
                OracleCommand cmd = new OracleCommand();
                cmd.Connection = conn;
                cmd.CommandText = "update ACCIDENT set RESULT='" + result + "' where DBID='" + dbId + "'";
                cmd.CommandType = CommandType.Text;
                cmd.ExecuteNonQuery();
                conn.Close();
                MessageBox.Show("事件结果编辑成功!", "提示");
                if (refresh != null) refresh();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }


    }
}