Esempio n. 1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (!check())
            {
                return;
            }
            bindTunnelHChuanEntity();

            var bResult = false;

            int id;

            //检查导线点I与导线点II对应文本框中的数据是否有效

            //构造横穿点串
            var    pntcols = new List <IPoint>();
            IPoint pnt0    = new PointClass();

            pnt0.X = Convert.ToDouble(textBox_X1.Text);
            pnt0.Y = Convert.ToDouble(textBox_Y1.Text);
            pnt0.Z = Convert.ToDouble(textBox_Z1.Text);
            pntcols.Add(pnt0);

            IPoint pnt1 = new PointClass();

            pnt1.X = Convert.ToDouble(textBox_X2.Text);
            pnt1.Y = Convert.ToDouble(textBox_Y2.Text);
            pnt1.Z = Convert.ToDouble(textBox_Z2.Text);
            pntcols.Add(pnt1);
            var hcwid = Convert.ToDouble(txtWidth.Text);

            //添加
            if (Text == Const_GM.TUNNEL_HCHUAN_ADD)
            {
                id      = TunnelHChuanBLL.insertTunnelHChuan(tunnelHChuanEntity);
                bResult = id > -1;
                //添加横穿
                if (id > 0)
                {
                    frmStop.refreshAdd();
                    tunnelHChuanEntity.Id = id;
                    AddHChuanjc(tunnelHChuanEntity, pntcols, hcwid);
                    //bResult = DrawHengChuanPolygon(tunnelHChuanEntity);
                }
            }
            //修改
            if (Text == Const_GM.TUNNEL_HCHUAN_CHANGE)
            {
                if (tmpTunnelHChuanEntity.TunnelId1 != 0)
                {
                    tunnelHChuanEntity.TunnelId1 = tmpTunnelHChuanEntity.TunnelId1;
                }
                if (tmpTunnelHChuanEntity.TunnelId2 != 0)
                {
                    tunnelHChuanEntity.TunnelId2 = tmpTunnelHChuanEntity.TunnelId2;
                }

                bResult = TunnelHChuanBLL.updateTunnelHChuan(tunnelHChuanEntity);
                //修改回采进尺图上显示信息,更新工作面信息表
                if (bResult)
                {
                    frmStop.refreshUpdate();

                    DataEditCommon.DeleteFeatureByWhereClause(Global.hdfdfulllyr, "bid='" + tunnelHChuanEntity.Id + "'");
                    DataEditCommon.DeleteFeatureByWhereClause(Global.hdfdlyr, "bid='" + tunnelHChuanEntity.Id + "'");
                    AddHChuanjc(tunnelHChuanEntity, pntcols, hcwid);
                    //bResult = RedrawHengChuanPolygon(tunnelHChuanEntity);
                }
            }
            if (bResult)
            {
                //TODO:成功后事件
                DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null);
                Close();
            }
            //暂时保留,是否设置为横川类型。
            //TunnelInfoBLL.setTunnelAsHChuan(tunnelHChuanEntity);
        }