Newer
Older
EMS_SZ / FrmFlagEdit.cs
root on 21 Mar 2016 4 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;

namespace Cyberpipe
{
    public partial class FrmFlagEdit : Office2007Form
    {
        public FrmFlagEdit(string id, string flagid, string flagno, string flagtype,
            string lat, string lon, string deep, string buryday, string street,
            string chargeorg, string designorg,string designperson, string workorg, string workperson,
            string moitororg, string monitorperson)
        {
            InitializeComponent();
            lab_id.Text = id;
            txt_flag_id.Text = flagid;
            txt_flag_no.Text = flagno;
            txt_flag_type.Text = flagtype;
            txt_lat.Text = lat;
            txt_lon.Text = lon;
            txt_deep.Text = deep;
            txt_bury_day.Text = buryday;
            txt_street.Text = street;
            txt_org_charger.Text = chargeorg;
            txt_org_design.Text = designorg;
            txt_designer.Text = designperson;
            txt_org_work.Text = workorg;
            txt_person_work.Text = workperson;
            txt_org_monitor.Text = moitororg;
            txt_person_monitor.Text = monitorperson;
        }

        private void btn_ok_Click(object sender, EventArgs e)
        {
            try
            {
                double outer;
                if (!double.TryParse(txt_lat.Text.Trim(), out outer))
                {
                    MessageBox.Show("经度取值有误!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txt_lat.Focus();
                    return;

                }
                if (!double.TryParse(txt_lon.Text.Trim(), out outer))
                {
                    MessageBox.Show("纬度取值有误!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txt_lon.Focus();
                    return;

                }
                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.x坐标      =" + txt_lat.Text.Trim() + "," +
                                    "t.y坐标      =" + txt_lon.Text.Trim() + "," +
                                    "t.标识器埋深 =" + txt_deep.Text.Trim() + "," +
                                    "t.埋设时间 = '" + txt_bury_day.Text.Trim() + "'," +
                                    "t.所属道路 = '" + txt_street.Text.Trim() + "'," +
                                    "t.权属单位 = '" + txt_org_charger.Text.Trim() + "'," +
                                    "t.设计单位 = '" + txt_org_design.Text.Trim() + "'," +
                                    "t.设计人姓名 = '" + txt_designer.Text.Trim() + "'," +
                                    "t.施工单位 = '" + txt_org_work.Text.Trim() + "'," +
                                    "t.施工责任人 = '" + txt_person_work.Text.Trim() + "'," +
                                    "t.施工监理 = '" + txt_org_monitor.Text.Trim() + "'," +
                                    "t.监理责任人 = '" + txt_person_monitor.Text.Trim() + "' " +
                                "where t.LSSYS_ID =" + lab_id.Text.Trim();
                OracleUtils.ExecuteNonQuery(OracleUtils.ConnectionString, CommandType.Text, sql);
                MessageBox.Show("属性编辑成功!", "结果", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("属性编辑失败:" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }
}