Newer
Older
GHFX_REFACTOR / FrmFlagEdits.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
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, string belongComp, string designComp,
            string designer, string workComp, string worker, string monitorComp, string monitor, string remark)
        {
            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;//所属道路
            textBoxqsdw.Text = belongComp;//权属单位
            textBoxsjdw.Text = designComp;//设计单位
            textBoxsjrxm.Text = designer;
            textBoxsgdw.Text = workComp;
            textBoxsgzrr.Text = worker;
            textBoxsgjl.Text = monitorComp;
            textBoxjlzrr.Text = monitor;
            textBoxbz.Text = remark;
        }

        private void btn_ok_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult dr = MessageBox.Show("请确定是否进行编辑操作", "确认", MessageBoxButtons.YesNo);
                if (dr == DialogResult.No)
                {
                    Close();
                    return;
                }
                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() + "'," +
                                    "t.权属单位 = '" + textBoxqsdw.Text.Trim() + "'," +
                                    "t.设计单位 = '" + textBoxsjdw.Text.Trim() + "'," +
                                    "t.设计人姓名 = '" + textBoxsjrxm.Text.Trim() + "'," +
                                    "t.施工单位 = '" + textBoxsgdw.Text.Trim() + "'," +
                                    "t.施工责任人 = '" + textBoxsgzrr.Text.Trim() + "'," +
                                    "t.施工监理 = '" + textBoxsgjl.Text.Trim() + "'," +
                                    "t.监理责任人 = '" + textBoxjlzrr.Text.Trim() + "'," +
                                    "t.备注 = '" + textBoxbz.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);
            }
        }
  
    }
}