Newer
Older
EMS_SZ / FrmFlagEdits.cs
root on 12 Jun 2016 2 KB zhongyan
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;

namespace Cyberpipe
{
    public partial class FrmFlagEdits : Office2007Form
    {
        public FrmFlagEdits()
        {
            InitializeComponent();
        }
        string id = "";
        public delegate void Handle();
        public event Handle refresh;

        public FrmFlagEdits(string id, string flagid, string flagno, string flagtype,
            string deep, string street,string gc)
        {
            InitializeComponent();
            this.id = id;
            txt_flag_id.Text = flagid;//标识器ID
            txt_flag_no.Text = flagno;//编号
            txt_flag_type.Text = flagtype;//标识器型号
            textBoxXgc.Text = gc;//地面高程
            txt_deep.Text = deep;//埋深
            txt_street.Text = street;//所属道路

        }

        private void btn_ok_Click(object sender, EventArgs e)
        {
            try
            {
                double outer;
               
                if (!double.TryParse(txt_deep.Text.Trim(), out outer))
                {
                    MessageBox.Show("埋深取值有误!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txt_deep.Focus();
                    return;
                }
                string sql = "update 标识器 t " +
                                "set t.标识器id号 = '" + txt_flag_id.Text.Trim() + "'," +
                                    "t.编号 = '" + txt_flag_no.Text.Trim() + "'," +
                                    "t.标识器型号 = '" + txt_flag_type.Text.Trim() + "'," +
                                     "t.地面高程 =" + textBoxXgc.Text.Trim() + "," +
                                    "t.标识器埋深 =" + txt_deep.Text.Trim() + "," +
                                    "t.所属道路 = '" + txt_street.Text.Trim() + "'" +
                                "where t.LSSYS_ID =" + id;
                OracleUtils.ExecuteNonQuery(OracleUtils.ConnectionString, CommandType.Text, sql);
                if (MessageBox.Show("属性编辑成功!", "结果", MessageBoxButtons.OK, MessageBoxIcon.Question)==DialogResult.OK)
                {
                    this.Close();
                    refresh();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("属性编辑失败:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }


    }
}