/// <summary> /// 带参数的构造方法 /// </summary> /// <params name="strPrimaryKey">主键</params> public ProspectingLineInfoEntering(ProspectingLine prospectingLine) { InitializeComponent(); // 设置业务类型 _bllType = "update"; }
/// <summary> /// 带参数的构造方法 /// </summary> /// <param name="strPrimaryKey">主键</param> public ProspectingLineInfoEntering(ProspectingLine prospectingLine) { InitializeComponent(); // 设置窗体默认属性 FormDefaultPropertiesSetter.SetEnteringFormDefaultProperties(this, Const_GM.UPDATE_PROSPECTING_LINE_INFO); // 设置业务类型 _bllType = "update"; }
/// <summary> /// 验证画面入力数据 /// </summary> /// <returns>验证结果:true 通过验证, false未通过验证</returns> private bool check() { // 判断勘探线名称是否录入 if (!Check.isEmpty(txtProspectingLineName, Const_GM.PROSPECTING_LINE_NAME)) { return(false); } // 勘探线名称特殊字符判断 if (!Check.checkSpecialCharacters(txtProspectingLineName, Const_GM.PROSPECTING_LINE_NAME)) { return(false); } //// 判断勘探线名称是否存在 //if (!Check.isExist(this.txtProspectingLineName, Const_GM.PROSPECTING_LINE_NAME, // ProspectingLineBLL.isProspectingLineNameExist(this.txtProspectingLineName.Text.Trim()))) //{ // return false; //} // 只有当添加新勘探线信息的时候才去判断勘探线名称是否重复 if (_bllType == "add") { // 判断孔号是否存在 if (ProspectingLine.ExistsByProspectingLineName(txtProspectingLineName.Text.Trim())) { return(false); } } else { /* 修改的时候,首先要获取UI输入的钻孔名称到DB中去检索, * 如果检索件数 > 0 并且该断层ID还不是传过来的主键,那么视为输入了已存在的钻孔名称 */ var boreholeId = -1; if (ProspectingLine.ExistsByProspectingLineName(txtProspectingLineName.Text.Trim())) { txtProspectingLineName.BackColor = Const.ERROR_FIELD_COLOR; Alert.alert(Const_GM.PROSPECTING_LINE_EXIST_MSG); // 勘探线名称已存在,请重新录入! txtProspectingLineName.Focus(); return(false); } } // 勘探线钻孔必须选择 if (lstProspectingBoreholeSelected.Items.Count == 0) { Alert.alert(Const_GM.PROSPECTING_BOREHOLE_MUST_CHOOSE_MSG); lstProspectingBoreholeAll.Focus(); return(false); } // 验证通过 return(true); }
/// <summary> /// 修改勘探线图元 /// </summary> /// <params name="prospectingLineEntity"></params> /// <params name="lstProspectingBoreholePts"></params> private void ModifyProspectingLine(ProspectingLine prospectingLineEntity, List <IPoint> lstProspectingBoreholePts) { //1.获得当前编辑图层 var drawspecial = new DrawSpecialCommon(); var sLayerAliasName = LayerNames.DEFALUT_KANTANXIAN; //“勘探线”图层 var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); if (featureLayer == null) { MessageBox.Show("未找到" + sLayerAliasName + "图层,无法修改勘探线图元。"); return; } //2.删除原来图元,重新绘制新图元 var bIsDeleteOldFeature = DataEditCommon.DeleteFeatureByBId(featureLayer, prospectingLineEntity.binding_id); if (bIsDeleteOldFeature) { //绘制图元 DrawProspectingLine(prospectingLineEntity, lstProspectingBoreholePts); } }
/// <summary> /// 根据所选钻孔点绘制勘探线 /// </summary> /// <params name="prospectingLineEntity"></params> /// <params name="lstProspectingBoreholePts"></params> private void DrawProspectingLine(ProspectingLine prospectingLineEntity, List <IPoint> lstProspectingBoreholePts) { //1.获得当前编辑图层 var drawspecial = new DrawSpecialCommon(); var sLayerAliasName = LayerNames.DEFALUT_KANTANXIAN; //“勘探线”图层 var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); if (featureLayer == null) { MessageBox.Show("未找到" + sLayerAliasName + "图层,无法绘制勘探线图元。"); return; } //2.绘制图元 if (lstProspectingBoreholePts.Count == 0) { return; } var prospectingLineID = prospectingLineEntity.binding_id; //绘制推断断层 PointsFit2Polyline.CreateLine(featureLayer, lstProspectingBoreholePts, prospectingLineID); }
/// <summary> /// 修改勘探线图元 /// </summary> /// <params name="prospectingLineEntity"></params> /// <params name="lstProspectingBoreholePts"></params> private void ModifyProspectingLine(ProspectingLine prospectingLineEntity, List<IPoint> lstProspectingBoreholePts) { //1.获得当前编辑图层 var drawspecial = new DrawSpecialCommon(); var sLayerAliasName = LayerNames.DEFALUT_KANTANXIAN; //“勘探线”图层 var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); if (featureLayer == null) { MessageBox.Show("未找到" + sLayerAliasName + "图层,无法修改勘探线图元。"); return; } //2.删除原来图元,重新绘制新图元 var bIsDeleteOldFeature = DataEditCommon.DeleteFeatureByBId(featureLayer, prospectingLineEntity.binding_id); if (bIsDeleteOldFeature) { //绘制图元 DrawProspectingLine(prospectingLineEntity, lstProspectingBoreholePts); } }
/// <summary> /// 根据所选钻孔点绘制勘探线 /// </summary> /// <params name="prospectingLineEntity"></params> /// <params name="lstProspectingBoreholePts"></params> private void DrawProspectingLine(ProspectingLine prospectingLineEntity, List<IPoint> lstProspectingBoreholePts) { //1.获得当前编辑图层 var drawspecial = new DrawSpecialCommon(); var sLayerAliasName = LayerNames.DEFALUT_KANTANXIAN; //“勘探线”图层 var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); if (featureLayer == null) { MessageBox.Show("未找到" + sLayerAliasName + "图层,无法绘制勘探线图元。"); return; } //2.绘制图元 if (lstProspectingBoreholePts.Count == 0) return; var prospectingLineID = prospectingLineEntity.binding_id; //绘制推断断层 PointsFit2Polyline.CreateLine(featureLayer, lstProspectingBoreholePts, prospectingLineID); }
/// <summary> /// 提交 /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void btnSubmit_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; // 创建勘探线实体 var prospectingLineEntity = new ProspectingLine(); // 勘探线名称 prospectingLineEntity.prospecting_line_name = txtProspectingLineName.Text.Trim(); // 勘探线钻孔 var cnt = lstProspectingBoreholeSelected.Items.Count; var lstProspectingBoreholePts = new List<IPoint>(); //20140505 lyf 存储选择的钻孔点要素 for (var i = 0; i < cnt; i++) { var strDisplayName = lstProspectingBoreholeSelected.Items[i].ToString(); if (String.IsNullOrWhiteSpace(prospectingLineEntity.prospecting_borehole)) { prospectingLineEntity.prospecting_borehole = strDisplayName; } else { prospectingLineEntity.prospecting_borehole = prospectingLineEntity.prospecting_borehole + "," + strDisplayName; } IPoint pt = new PointClass(); pt = GetProspectingBoreholePointSelected(strDisplayName); if (pt != null && !lstProspectingBoreholePts.Contains(pt)) { lstProspectingBoreholePts.Add(pt); } } var bResult = false; if (_bllType == "add") { // BIDID prospectingLineEntity.binding_id = IdGenerator.NewBindingId(); // 勘探线信息登录 prospectingLineEntity.Save(); ///20140505 lyf ///绘制勘探线图形 DrawProspectingLine(prospectingLineEntity, lstProspectingBoreholePts); } else { // 主键 prospectingLineEntity.prospecting_line_id = _iPK; // 勘探线信息修改 prospectingLineEntity.Save(); //20140506 lyf //获取勘探线的BID var sBid = ProspectingLine.Find(_iPK).binding_id; if (sBid != "") { prospectingLineEntity.binding_id = sBid; ModifyProspectingLine(prospectingLineEntity, lstProspectingBoreholePts); //修改图元 } } // 添加/修改成功的场合 if (bResult) { } }
/// <summary> /// 提交 /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void btnSubmit_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; // 创建勘探线实体 var prospectingLineEntity = new ProspectingLine(); // 勘探线名称 prospectingLineEntity.prospecting_line_name = txtProspectingLineName.Text.Trim(); // 勘探线钻孔 var cnt = lstProspectingBoreholeSelected.Items.Count; var lstProspectingBoreholePts = new List <IPoint>(); //20140505 lyf 存储选择的钻孔点要素 for (var i = 0; i < cnt; i++) { var strDisplayName = lstProspectingBoreholeSelected.Items[i].ToString(); if (String.IsNullOrWhiteSpace(prospectingLineEntity.prospecting_borehole)) { prospectingLineEntity.prospecting_borehole = strDisplayName; } else { prospectingLineEntity.prospecting_borehole = prospectingLineEntity.prospecting_borehole + "," + strDisplayName; } IPoint pt = new PointClass(); pt = GetProspectingBoreholePointSelected(strDisplayName); if (pt != null && !lstProspectingBoreholePts.Contains(pt)) { lstProspectingBoreholePts.Add(pt); } } var bResult = false; if (_bllType == "add") { // BIDID prospectingLineEntity.binding_id = IdGenerator.NewBindingId(); // 勘探线信息登录 prospectingLineEntity.Save(); ///20140505 lyf ///绘制勘探线图形 DrawProspectingLine(prospectingLineEntity, lstProspectingBoreholePts); } else { // 主键 prospectingLineEntity.prospecting_line_id = _iPK; // 勘探线信息修改 prospectingLineEntity.Save(); //20140506 lyf //获取勘探线的BID var sBid = ProspectingLine.Find(_iPK).binding_id; if (sBid != "") { prospectingLineEntity.binding_id = sBid; ModifyProspectingLine(prospectingLineEntity, lstProspectingBoreholePts); //修改图元 } } // 添加/修改成功的场合 if (bResult) { } }
private void RefreshData() { gcProspectingLine.DataSource = ProspectingLine.FindAll(); }