Newer
Older
GHFX_REFACTOR / FrmFlagDetail.cs
xiaowei on 28 Nov 2016 2 KB 增加标识器管理
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 GeoScene.Globe;
using System.Data.OracleClient;

namespace Cyberpipe
{
    public partial class FrmFlagDetail : Form
    {
        DataTable dt = new DataTable();
        private GSOGlobeControl globeControl1;

        public delegate void Handle();
        public event Handle showParentForm;
        String markId;

        public FrmFlagDetail(GSOGlobeControl globeControl1, String id)
        {
            InitializeComponent();
            this.markId = id;
        }

        private void FrmFlagDetail_FormClosing(object sender, FormClosingEventArgs e)
        {
            showParentForm();
        }

        private void FrmFlagDetail_Load(object sender, EventArgs e)
        {
            string objectIds = "";
            string objectTypeCodes = "";
            string sql = "select t.对象编号,t.对象类型 from 标识器 t where t.编号='" + markId + "'";
            using (OracleDataReader reader = OracleUtils.ExecuteReader(OracleUtils.ConnectionString, CommandType.Text, sql))
            {
                while (reader.Read())
                {
                    objectIds = reader.GetString(0);
                    objectTypeCodes = reader.GetString(1);
                }
            }

            string[] codeTypes = objectTypeCodes.Split(',');
            string[] codeIds = objectIds.Split(',');
            int length = 0;
            if (codeTypes.Length <= codeIds.Length)
            {
                length = codeTypes.Length;
            }
            else
            {
                length = codeIds.Length;
            }
            for (int n = 0; n < length; n++)
            {
                for (int i = 0; i < Utility.listPipelineType.Count; i++)
                {
                    if (Utility.listPipelineType[i].code == codeTypes[n])
                    {
                        int index = this.dataGridViewX_markDetail.Rows.Add();
                        this.dataGridViewX_markDetail.Rows[index].Cells[0].Value = Utility.listPipelineType[i].type;
                        this.dataGridViewX_markDetail.Rows[index].Cells[1].Value = codeIds[n].ToString();
                        this.dataGridViewX_markDetail.Rows[index].Cells[2].Value = Utility.listPipelineType[i].name;
                    }
                }
            }
        }
    }
}