Newer
Older
EMS_SZ / EMS_Forms / Form_EventResult.cs
root on 21 Mar 2016 1 KB first
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
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(int index);
        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)
            {
                result = richTextBox_EventResult.Text;
                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("事件结果编辑成功!", "提示");
                    refresh(1);
                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            
        }


    }
}