/// <summary> /// 删除按钮响应 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsBtnDel_Click(object sender, EventArgs e) { if (Alert.confirm(Const.DEL_CONFIRM_MSG)) { var searchCount = _rowsCount; var bResult = false; for (var i = 0; i < _rowsCount; i++) { _tmpRowIndex = fpDayReportHChuan.Sheets[0].ActiveRowIndex; //遍历“选择”是否选中 if (fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, 0].Value != null && (bool)fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, 0].Value) { //主键 tunnelHChuanEntity.Id = Convert.ToInt32(_ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.ID]); var tmp = 0; //主运顺槽 if (int.TryParse(_ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_ID1].ToString(), out tmp)) { tunnelHChuanEntity.TunnelId1 = tmp; tmp = 0; } //辅运顺槽 if (int.TryParse(_ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_ID2].ToString(), out tmp)) { tunnelHChuanEntity.TunnelId2 = tmp; tmp = 0; } //重设巷道类型 var tunnel1 = Tunnel.Find(tunnelHChuanEntity.TunnelId1); tunnel1.TunnelType = TunnelTypeEnum.OTHER; tunnel1.Save(); var tunnel2 = Tunnel.Find(tunnelHChuanEntity.TunnelId2); tunnel2.TunnelType = TunnelTypeEnum.OTHER; tunnel2.Save(); //删除回采巷道信息 bResult = TunnelHChuanBLL.deleteTunnelHChuan(tunnelHChuanEntity); } } if (bResult) { //TODO:删除后事件 //将图层中对应的信息删除 DelHChuanjc(tunnelHChuanEntity.TunnelId1, tunnelHChuanEntity.TunnelId2); //删除工作面中对应的回采信息 /////Mark } bindFpTunnelHChuanInfo(); FarPointOperate.farPointFocusSetDel(fpDayReportHChuan, _tmpRowIndex); } }
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); }
/// <summary> /// farpoint数据绑定 /// </summary> private void bindFpTunnelHChuanInfo() { // 清空HashTabl(必须实装) _htSelIdxs.Clear(); //清空Farpoint FarPointOperate.farPointClear(fpDayReportHChuan, _rowDetailStartIndex, _rowsCount); _checkCount = 0; chkSelAll.Checked = false; // ※分页必须 _iRecordCount = TunnelHChuanBLL.selectTunnelHChuan().Tables[0].Rows.Count; // ※分页必须 dataPager1.PageControlInit(_iRecordCount); var iStartIndex = dataPager1.getStartIndex(); var iEndIndex = dataPager1.getEndIndex(); _ds = TunnelHChuanBLL.selectTunnelHChuan(iStartIndex, iEndIndex); _rowsCount = _ds.Tables[0].Rows.Count; //重绘Farpoint FarPointOperate.farPointReAdd(fpDayReportHChuan, _rowDetailStartIndex, _rowsCount); if (_rowsCount > 0) { var ckbxcell = new CheckBoxCellType(); //取消三选 ckbxcell.ThreeState = false; for (var i = 0; i < _ds.Tables[0].Rows.Count; i++) { var index = 0; fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, index].CellType = ckbxcell; //主运顺槽 var tunnelID1 = Convert.ToInt32(_ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_ID1]); //辅运顺槽 var tunnelID2 = Convert.ToInt32(_ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_ID2]); var tmpTunnelID = (tunnelID1 == 0 ? (tunnelID2 == 0 ? 0 : tunnelID2) : tunnelID1); //矿井名称 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.NAME_HCHUAN].ToString(); ; //关联巷道1 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_ID1].ToString(); ; //关联巷道2 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_ID2].ToString(); ; //x1 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_X1].ToString(); //y1 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_Y1].ToString(); //z1 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_Z1].ToString(); //x2 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_X2].ToString(); //y2 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_Y2].ToString(); //z2 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_Z2].ToString(); //azimuth fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_AZIMUTH].ToString(); //队别 if (int.TryParse(_ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TEAM_NAME_ID].ToString(), out tmpInt)) { fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = Team.Find(tmpInt).TeamName; tmpInt = 0; } //开工日期 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.START_DATE].ToString() .Substring(0, _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.START_DATE].ToString().IndexOf(' ')); //是否回采完毕 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = Convert.ToInt32(_ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.IS_FINISH].ToString()) == 1 ? Const.MSG_YES : Const.MSG_NO; //停工日期 if (Convert.ToInt32(_ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.IS_FINISH].ToString()) == 1) { fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.STOP_DATE].ToString() .Substring(0, _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.STOP_DATE].ToString().IndexOf(' ')); } else { ++index; } //工作制式 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.WORK_STYLE].ToString(); //班次 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.WORK_TIME].ToString(); //状态 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_STATE].ToString(); //bid fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.ID].ToString(); fpDayReportHChuan.Sheets[0].Columns[_BIDIndex].Visible = false; } } //设置按钮可操作性 setButtenEnable(); }