/// <summary> /// 修改岩性时,当前记录为煤时,煤层名称设为可编辑,否则设为不可编辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gvCoalSeamsTexture_RowValidated(object sender, DataGridViewCellEventArgs e) { for (var i = 0; i < gvCoalSeamsTexture.RowCount - 1; i++) { // 岩性 var cell0 = gvCoalSeamsTexture.Rows[i].Cells[0] as DataGridViewComboBoxCell; // 煤层名称 var cell3 = gvCoalSeamsTexture.Rows[i].Cells[3] as DataGridViewTextBoxCell; var lithology = Lithology.FindOneByCoal(); // 当岩性名称选择为“煤”时,煤层名称可编辑,否则煤层名称设置为不可编辑,并清空 if (cell0 != null && Convert.ToString(cell0.Value) == lithology.LithologyName) { if (cell3 != null) { cell3.ReadOnly = false; } } else { if (cell3 == null) { continue; } cell3.Value = ""; cell3.ReadOnly = true; } } }
/// <summary> /// 带参数的构造方法 /// </summary> /// <param name="borehole"></param> public BoreholeInfoEntering(Borehole borehole) { InitializeComponent(); // 设置窗体默认属性 FormDefaultPropertiesSetter.SetEnteringFormDefaultProperties(this, Const_GM.UPDATE_BOREHOLE_INFO); using (new SessionScope()) { borehole = Borehole.Find(borehole.BoreholeId); // 孔号 txtBoreholeNumber.Text = borehole.BoreholeNumber; // 地面标高 txtGroundElevation.Text = borehole.GroundElevation.ToString(CultureInfo.InvariantCulture); // X坐标 txtCoordinateX.Text = borehole.CoordinateX.ToString(CultureInfo.InvariantCulture); // Y坐标 txtCoordinateY.Text = borehole.CoordinateY.ToString(CultureInfo.InvariantCulture); // Z坐标 txtCoordinateZ.Text = borehole.CoordinateZ.ToString(CultureInfo.InvariantCulture); // 获取岩性信息 DataBindUtil.LoadLithology(LITHOLOGY); // 明细 gvCoalSeamsTexture.RowCount = borehole.BoreholeLithologys.Count + 1; for (var i = 0; i < borehole.BoreholeLithologys.Count; i++) { // 岩性名称 var iLithologyId = borehole.BoreholeLithologys[i].Lithology.LithologyId; var lithology = Lithology.Find(iLithologyId); gvCoalSeamsTexture[0, i].Value = lithology.LithologyName; // 底板标高 gvCoalSeamsTexture[1, i].Value = borehole.BoreholeLithologys[i].FloorElevation; // 厚度 gvCoalSeamsTexture[2, i].Value = borehole.BoreholeLithologys[i].Thickness; // 煤层名称 gvCoalSeamsTexture[3, i].Value = borehole.BoreholeLithologys[i].CoalSeamsName; // 坐标X gvCoalSeamsTexture[4, i].Value = borehole.BoreholeLithologys[i].CoordinateX.ToString(CultureInfo.InvariantCulture); // 坐标Y gvCoalSeamsTexture[5, i].Value = borehole.BoreholeLithologys[i].CoordinateY.ToString(CultureInfo.InvariantCulture); // 坐标Z gvCoalSeamsTexture[6, i].Value = borehole.BoreholeLithologys[i].CoordinateX.ToString(CultureInfo.InvariantCulture); } } }
public static void LoadLithology(ListControl lb, String selectedText = "") { var lithologys = Lithology.FindAll(); if (lithologys != null) { DataBindListControl(lb, lithologys, "LithologyName", "LithologyId", selectedText); } }
public static void LoadLithology(DataGridViewComboBoxColumn dgvcbc) { var lithologys = Lithology.FindAll(); if (lithologys == null) { return; } foreach (var li in lithologys) { dgvcbc.Items.Add(li.LithologyName); } }
/// <summary> /// 岩性选择事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gvCoalSeamsTexture_CellEndEdit(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex != 0) { return; } // 岩性 if (gvCoalSeamsTexture.CurrentRow == null) { return; } var cell0 = gvCoalSeamsTexture.Rows[gvCoalSeamsTexture.CurrentRow.Index].Cells[0] as DataGridViewComboBoxCell; // 煤层名称 var cell3 = gvCoalSeamsTexture.Rows[gvCoalSeamsTexture.CurrentRow.Index].Cells[3] as DataGridViewTextBoxCell; var lithology = Lithology.FindOneByCoal(); // 当岩性名称选择为“煤”时,煤层名称可编辑,否则煤层名称设置为不可编辑,并清空 if (cell0 != null && Convert.ToString(cell0.Value) == lithology.LithologyName) { if (cell3 != null) { cell3.ReadOnly = false; } } else { if (cell3 == null) { return; } cell3.Value = ""; cell3.ReadOnly = true; } }
public List <ColumnMetaInfo> GetLithoColumns(string connString) { Lithology ob = new Lithology(); string tableName = "X_Lithology"; List <ColumnMetaInfo> colList = QueryColumns(connString, ob, tableName); List <string> removeStubs = new List <string>(); //removeStubs.Add("Litho"); //Removed due to this segment stripping out LithQual/Percentage etc removeStubs.Add("Version"); removeStubs.Add("Dict"); List <ColumnMetaInfo> colListP = new List <ColumnMetaInfo>(); colListP = PruneColumnList(removeStubs, colList); // now mark only the mandatory fields - for assay this will be header id, from, to and result foreach (ColumnMetaInfo c in colListP) { if (c.columnName.Equals("HeaderID")) { c.isMandatory = true; } else if (c.columnName.Equals("FromDepth")) { c.isMandatory = true; } else if (c.columnName.Equals("ToDepth")) { c.isMandatory = true; } } return(colListP); }
public List<ColumnMetaInfo> GetLithoColumns(string connString) { Lithology ob = new Lithology(); string tableName = "X_Lithology"; List<ColumnMetaInfo> colList = QueryColumns(connString, ob, tableName); List<string> removeStubs = new List<string>(); //removeStubs.Add("Litho"); //Removed due to this segment stripping out LithQual/Percentage etc removeStubs.Add("Version"); removeStubs.Add("Dict"); List<ColumnMetaInfo> colListP = new List<ColumnMetaInfo>(); colListP = PruneColumnList(removeStubs, colList); // now mark only the mandatory fields - for assay this will be header id, from, to and result foreach (ColumnMetaInfo c in colListP) { if (c.columnName.Equals("HeaderID")) { c.isMandatory = true; } else if (c.columnName.Equals("FromDepth")) { c.isMandatory = true; } else if (c.columnName.Equals("ToDepth")) { c.isMandatory = true; } } return colListP; }
/// <summary> /// Reads the lithology and assign to all the JupiterWells in the collection /// </summary> /// <param name="Wells"></param> public void ReadLithology(IWellCollection Wells) { JupiterWell CurrentWell; JXL.ReadInLithology(); CurrentWell = Wells.FirstOrDefault() as JupiterWell; //Loop the lithology foreach (var Lith in JXL.LITHSAMP) { if (CurrentWell.ID == Lith.BOREHOLENO) { Lithology L = new Lithology(); L.Bottom = Lith.BOTTOM; L.Top = Lith.TOP; L.RockSymbol = Lith.ROCKSYMBOL; L.RockType = Lith.ROCKTYPE; L.TotalDescription = Lith.TOTALDESCR; CurrentWell.LithSamples.Add(L); } else { if (Wells.Contains(Lith.BOREHOLENO)) { CurrentWell = Wells[Lith.BOREHOLENO] as JupiterWell; Lithology L = new Lithology(); L.Bottom = Lith.BOTTOM; L.Top = Lith.TOP; L.RockSymbol = Lith.ROCKSYMBOL; L.RockType = Lith.ROCKTYPE; L.TotalDescription = Lith.TOTALDESCR; CurrentWell.LithSamples.Add(L); } } } JXL.LITHSAMP.Clear(); }
private void btnReadMultTxt_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog { RestoreDirectory = true, Filter = @"文本文件(*.txt)|*.txt|所有文件(*.*)|*.*", Multiselect = true }; if (ofd.ShowDialog() != DialogResult.OK) { return; } _errorMsg = @"失败文件名:"; pbCount.Maximum = ofd.FileNames.Length; pbCount.Value = 0; lblTotal.Text = ofd.FileNames.Length.ToString(CultureInfo.InvariantCulture); foreach (var fileName in ofd.FileNames) { var encoder = TxtFileEncoding.GetEncoding(fileName, Encoding.GetEncoding("GB2312")); var sr = new StreamReader(fileName, encoder); string duqu; while ((duqu = sr.ReadLine()) != null) { try { var str = duqu.Split('|'); var borehole = Borehole.FindOneByBoreholeNum(str[0]) ?? new Borehole { BindingId = IDGenerator.NewBindingID() }; borehole.BoreholeNumber = str[0]; borehole.GroundElevation = Convert.ToDouble(str[3]); borehole.CoordinateX = Convert.ToDouble(str[1].Split(',')[0]); borehole.CoordinateY = Convert.ToDouble(str[1].Split(',')[1]); borehole.CoordinateZ = 0; borehole.CoalSeamsTexture = String.Empty; // 创建钻孔岩性实体 var boreholeLithology = new BoreholeLithology { Borehole = borehole, Lithology = Lithology.FindOneByCoal(), FloorElevation = Convert.ToDouble(str[4]), CoalSeamsName = CoalSeams.FindAll().First().CoalSeamsName, Thickness = Convert.ToDouble(str[2]), CoordinateX = Convert.ToDouble(str[1].Split(',')[0]), CoordinateY = Convert.ToDouble(str[1].Split(',')[1]), CoordinateZ = 0 }; borehole.BoreholeLithologys = new[] { boreholeLithology }; DrawZuanKong(borehole, boreholeLithology); borehole.Save(); } catch (Exception) { lblError.Text = (Convert.ToInt32(lblError.Text) + 1).ToString(CultureInfo.InvariantCulture); lblSuccessed.Text = (Convert.ToInt32(lblSuccessed.Text) - 1).ToString(CultureInfo.InvariantCulture); _errorMsg += fileName.Substring(fileName.LastIndexOf(@"\", StringComparison.Ordinal) + 1) + "\n"; btnDetails.Enabled = true; } } lblSuccessed.Text = (Convert.ToInt32(lblSuccessed.Text) + 1).ToString(CultureInfo.InvariantCulture); pbCount.Value++; } Alert.alert("导入成功!"); }
/// <summary> /// 验证画面入力数据 /// </summary> /// <returns>验证结果:true 通过验证, false未通过验证</returns> private bool Check() { // 判断孔号是否录入 if (!LibCommon.Check.isEmpty(txtBoreholeNumber, Const_GM.BOREHOLE_NUMBER)) { return(false); } // 判断地面标高是否录入 if (!LibCommon.Check.isEmpty(txtGroundElevation, Const_GM.GROUND_ELEVATION)) { return(false); } // 判断地面标高是否为数字 if (!LibCommon.Check.IsNumeric(txtGroundElevation, Const_GM.GROUND_ELEVATION)) { return(false); } // 判断坐标X是否录入 if (!LibCommon.Check.isEmpty(txtCoordinateX, Const_GM.COORDINATE_X)) { return(false); } // 判断坐标X是否为数字 if (!LibCommon.Check.IsNumeric(txtCoordinateX, Const_GM.COORDINATE_X)) { return(false); } // 判断坐标Y是否录入 if (!LibCommon.Check.isEmpty(txtCoordinateY, Const_GM.COORDINATE_Y)) { return(false); } // 判断坐标Y是否为数字 if (!LibCommon.Check.IsNumeric(txtCoordinateY, Const_GM.COORDINATE_Y)) { return(false); } // 判断坐标Z是否录入 if (!LibCommon.Check.isEmpty(txtCoordinateZ, Const_GM.COORDINATE_Z)) { return(false); } // 判断坐标Z是否为数字 if (!LibCommon.Check.IsNumeric(txtCoordinateZ, Const_GM.COORDINATE_Z)) { return(false); } // 判断岩性是否入力 if (gvCoalSeamsTexture.Rows.Count - 1 == 0) { Alert.alert(Const_GM.LITHOLOGY_MUST_INPUT); // 请录入煤层的岩性! return(false); } // 临时存储煤层名称 var arrCoalSeamsName = new List <String>(); // 判断底板标高、厚度是否入力,以及入力的是否为数字 for (var i = 0; i < gvCoalSeamsTexture.RowCount; i++) { // 最后一行为空行时,跳出循环 if (i == gvCoalSeamsTexture.RowCount - 1) { break; } // 岩性 var cell0 = gvCoalSeamsTexture.Rows[i].Cells[0] as DataGridViewComboBoxCell; // 判断岩性是否选择 if (cell0 != null && cell0.Value == null) { Alert.alert("第" + (i + 1) + "行,请选择岩性!"); return(false); } // 底板标高 var cell1 = gvCoalSeamsTexture.Rows[i].Cells[1] as DataGridViewTextBoxCell; // 判断底板标高是否入力 if (cell1 != null && cell1.Value == null) { cell1.Style.BackColor = Const.ERROR_FIELD_COLOR; Alert.alert("第" + (i + 1) + "行,底板标高不能为空!"); return(false); } if (cell1 != null) { cell1.Style.BackColor = Const.NO_ERROR_FIELD_COLOR; // 判断底板标高是否为数字 if (!Validator.IsNumeric(cell1.Value.ToString())) { cell1.Style.BackColor = Const.ERROR_FIELD_COLOR; Alert.alert("第" + (i + 1) + "行,底板标高应为数字!"); return(false); } cell1.Style.BackColor = Const.NO_ERROR_FIELD_COLOR; } // 厚度 var cell2 = gvCoalSeamsTexture.Rows[i].Cells[2] as DataGridViewTextBoxCell; // 判断厚度是否入力 if (cell2 != null && cell2.Value == null) { cell2.Style.BackColor = Const.ERROR_FIELD_COLOR; Alert.alert("第" + (i + 1) + "行,厚度不能为空!"); return(false); } if (cell2 != null) { cell2.Style.BackColor = Const.NO_ERROR_FIELD_COLOR; // 判断厚度是否为数字 if (!Validator.IsNumeric(cell2.Value.ToString())) { cell2.Style.BackColor = Const.ERROR_FIELD_COLOR; Alert.alert("第" + (i + 1) + "行,厚度应为数字!"); return(false); } cell2.Style.BackColor = Const.NO_ERROR_FIELD_COLOR; } // 当岩性选择为煤层时 var lithology = Lithology.FindOneByCoal(); if (cell0 != null && Convert.ToString(cell0.Value) == lithology.LithologyName) { // 煤层名称 var cell3 = gvCoalSeamsTexture.Rows[i].Cells[3] as DataGridViewTextBoxCell; if (cell3 != null) { cell3.Style.BackColor = Const.NO_ERROR_FIELD_COLOR; // 特殊符号判断 //if (Validator.checkSpecialCharacters(cell3.Value.ToString())) //{ // cell3.Style.BackColor = Const.ERROR_FIELD_COLOR; // Alert.alert("第" + (i + 1) + "行,煤层结构名称包含特殊符号!"); // return false; //} //else //{ if (cell3.Value.ToString().Trim() != "") { cell3.Style.BackColor = Const.NO_ERROR_FIELD_COLOR; // 煤层名称不能重复 if (!arrCoalSeamsName.Contains(cell3.Value.ToString().Trim())) { arrCoalSeamsName.Add(cell3.Value.ToString().Trim()); cell3.Style.BackColor = Const.NO_ERROR_FIELD_COLOR; } else { cell3.Style.BackColor = Const.ERROR_FIELD_COLOR; Alert.alert("第" + (i + 1) + "行,煤层名称重复!(同一钻孔不能有相同的煤层名称)"); return(false); } } } } var cell40 = gvCoalSeamsTexture.Rows[i].Cells[4] as DataGridViewTextBoxCell; // 判断坐标X是否为数字 if (cell40 != null && !Validator.IsNumeric(Convert.ToString(cell40.Value))) { cell40.Style.BackColor = Const.ERROR_FIELD_COLOR; Alert.alert("第" + (i + 1) + "行,坐标X应为数字!"); return(false); } if (cell40 != null) { cell40.Style.BackColor = Const.NO_ERROR_FIELD_COLOR; } var cell50 = gvCoalSeamsTexture.Rows[i].Cells[5] as DataGridViewTextBoxCell; // 判断坐标Y是否为数字 if (cell50 != null && !Validator.IsNumeric(Convert.ToString(cell50.Value))) { cell50.Style.BackColor = Const.ERROR_FIELD_COLOR; Alert.alert("第" + (i + 1) + "行,坐标Y应为数字!"); return(false); } if (cell50 != null) { cell50.Style.BackColor = Const.NO_ERROR_FIELD_COLOR; } var cell60 = gvCoalSeamsTexture.Rows[i].Cells[6] as DataGridViewTextBoxCell; // 判断坐标Z是否为数字 if (cell60 != null && !Validator.IsNumeric(Convert.ToString(cell60.Value))) { cell60.Style.BackColor = Const.ERROR_FIELD_COLOR; Alert.alert("第" + (i + 1) + "行,坐标Z应为数字!"); return(false); } if (cell60 != null) { cell60.Style.BackColor = Const.NO_ERROR_FIELD_COLOR; } } // 验证通过 return(true); }
/// <summary> /// 提 交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSubmit_Click(object sender, EventArgs e) { // 验证 if (!Check()) { DialogResult = DialogResult.None; return; } var borehole = Borehole.FindOneByBoreholeNum(txtBoreholeNumber.Text) ?? new Borehole { BindingId = IDGenerator.NewBindingID() }; borehole.BoreholeNumber = txtBoreholeNumber.Text.Trim(); borehole.GroundElevation = Convert.ToDouble(txtGroundElevation.Text.Trim()); borehole.CoordinateX = Convert.ToDouble(txtCoordinateX.Text.Trim()); borehole.CoordinateY = Convert.ToDouble(txtCoordinateY.Text.Trim()); borehole.CoordinateZ = Convert.ToDouble(txtCoordinateZ.Text.Trim()); borehole.CoalSeamsTexture = string.Empty; var boreholeLithologys = new List <BoreholeLithology>(); for (var i = 0; i < gvCoalSeamsTexture.RowCount; i++) { // 最后一行为空行时,跳出循环 if (i == gvCoalSeamsTexture.RowCount - 1) { break; } // 创建钻孔岩性实体 var boreholeLithology = new BoreholeLithology { FloorElevation = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[1].Value), Thickness = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[2].Value), CoalSeamsName = gvCoalSeamsTexture.Rows[i].Cells[3].Value.ToString(), CoordinateX = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[4].Value), CoordinateY = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[5].Value), CoordinateZ = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[6].Value), Lithology = Lithology.FindOneByLithologyName(gvCoalSeamsTexture.Rows[i].Cells[0].Value.ToString()), Borehole = borehole }; boreholeLithologys.Add(boreholeLithology); } borehole.BoreholeLithologys = boreholeLithologys; borehole.Save(); // var dlgResult = MessageBox.Show(@"是:见煤钻孔,否:未见煤钻孔,取消:不绘制钻孔", @"绘制钻孔", // MessageBoxButtons.YesNoCancel); // if (dlgResult == DialogResult.Yes) // { // DrawZuanKong(borehole, boreholeLithologyEntityList[0]); // } // else if (dlgResult == DialogResult.No) // { // DrawZuanKong(borehole); // } // else if (dlgResult == DialogResult.Cancel) // { // } //} //else //{ //1.获得当前编辑图层 var drawspecial = new DrawSpecialCommon(); const string sLayerAliasName = LayerNames.DEFALUT_BOREHOLE; //“默认_钻孔”图层 var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); if (featureLayer == null) { MessageBox.Show(@"未找到" + sLayerAliasName + @"图层,无法删钻孔图元。"); return; } if (borehole.BoreholeId != 0) { DataEditCommon.DeleteFeatureByBId(featureLayer, borehole.BindingId); } var dlgResult = MessageBox.Show(@"是:见煤钻孔,否:未见煤钻孔,取消:不绘制钻孔", @"绘制钻孔", MessageBoxButtons.YesNoCancel); switch (dlgResult) { case DialogResult.Yes: DrawZuanKong(borehole, borehole.BoreholeLithologys.First()); break; case DialogResult.No: DrawZuanKong(borehole); break; case DialogResult.Cancel: break; } DialogResult = DialogResult.OK; }
/// <summary> /// Fills the data row with entries common for Intake and Extractions. /// </summary> /// <param name="CurrentIntake"></param> private void AddCommonDataForNovana(JupiterIntake CurrentIntake) { JupiterWell CurrentWell; NovanaTables.IntakeCommonRow CurrentRow = (NovanaTables.IntakeCommonRow)CurrentIntake.Data; CurrentWell = (JupiterWell)CurrentIntake.well; CurrentRow.NOVANAID = CurrentWell.ID.Replace(" ", "") + "_" + CurrentIntake.IDNumber; CurrentRow.XUTM = CurrentWell.X; CurrentRow.YUTM = CurrentWell.Y; //Make sure all the necessary data have been read. if (JXL.ReducedRead) JXL.ReadWells(false, false); if (JXL.LITHSAMP.Count == 0) JXL.ReadInLithology(); var BoringsData = JXL.BOREHOLE.FindByBOREHOLENO(CurrentWell.ID); var IntakeData = BoringsData.GetINTAKERows().First(var => var.INTAKENO == CurrentIntake.IDNumber); CurrentRow.JUPKOTE = BoringsData.ELEVATION; CurrentRow.BOREHOLENO = BoringsData.BOREHOLENO; CurrentRow.INTAKENO = CurrentIntake.IDNumber; CurrentRow.LOCATION = BoringsData.LOCATION; CurrentRow.ANTINT_B = CurrentWell.Intakes.Count(); if (!BoringsData.IsDRILENDATENull()) CurrentRow.DRILENDATE = BoringsData.DRILENDATE; if (!BoringsData.IsABANDONDATNull()) CurrentRow.ABANDONDAT = BoringsData.ABANDONDAT; CurrentRow.ABANDCAUSE = BoringsData.ABANDCAUSE; CurrentRow.DRILLDEPTH = BoringsData.DRILLDEPTH; CurrentRow.CASIBOT = -999; //Assumes that the string no from the intake identifies the correct Casing foreach (var Casing in BoringsData.GetCASINGRows()) { if (!IntakeData.IsSTRINGNONull() & !Casing.IsSTRINGNONull()) if (IntakeData.STRINGNO == Casing.STRINGNO & !Casing.IsBOTTOMNull()) CurrentRow.CASIBOT = Casing.BOTTOM; } CurrentRow.PURPOSE = BoringsData.PURPOSE; CurrentRow.USE = BoringsData.USE; if (CurrentIntake.Screens.Count != 0) { CurrentRow.INTAKETOP = CurrentIntake.Screens.Min(var => var.DepthToTop); CurrentRow.INTAKEBOT = CurrentIntake.Screens.Max(var => var.DepthToBottom); } else { CurrentRow.INTAKETOP = -999; CurrentRow.INTAKEBOT = -999; } CurrentRow.INTAKTOPK = -999; CurrentRow.INTAKBOTK = -999; if (CurrentRow.JUPKOTE != -999) { if (CurrentRow.INTAKETOP != -999) CurrentRow.INTAKTOPK = CurrentRow.JUPKOTE - CurrentRow.INTAKETOP; if (CurrentRow.INTAKEBOT != -999) CurrentRow.INTAKBOTK = CurrentRow.JUPKOTE - CurrentRow.INTAKEBOT; } //Takes the minimum of all non-null dates IEnumerable<JupiterXL.SCREENRow> NonNullList = IntakeData.GetSCREENRows().Where(x => !x.IsSTARTDATENull()); if (NonNullList.Count() > 0) CurrentRow.INTSTDATE2 = NonNullList.Min(x => x.STARTDATE); //Takes the maximum of all non-null dates NonNullList = IntakeData.GetSCREENRows().Where(x => !x.IsENDDATENull()); if (NonNullList.Count() > 0) CurrentRow.INTENDATE2 = NonNullList.Max(x => x.ENDDATE); CurrentRow.RESROCK = IntakeData.RESERVOIRROCK; //Loop the lithology //This loop is entered foreach intake thus only read lithology once. if (CurrentWell.LithSamples.Count == 0) { foreach (var Lith in BoringsData.GetLITHSAMPRows()) { Lithology L = new Lithology(); L.Bottom = Lith.BOTTOM; L.Top = Lith.TOP; L.RockSymbol = Lith.ROCKSYMBOL; L.RockType = Lith.ROCKTYPE; L.TotalDescription = Lith.TOTALDESCR; CurrentWell.LithSamples.Add(L); } } CurrentRow.RESROCK = "-999"; CurrentRow.SUMSAND = -999; CurrentRow.BOTROCK = "-999"; if (CurrentWell.LithSamples.Count != 0 & CurrentIntake.Screens.Count!=0) { CurrentWell.LithSamples.Sort(); CurrentRow.BOTROCK = CurrentWell.LithSamples[CurrentWell.LithSamples.Count - 1].RockSymbol; Dictionary<string, double> SoilLengths = new Dictionary<string, double>(); double ScreenLength = 0; //Now build information about reservoir rock in front of screen //Loop all screens foreach (Screen SC in CurrentIntake.Screens) { //Do not use dummy values if (SC.DepthToBottom != -999 & SC.DepthToTop != -999) { ScreenLength += SC.DepthToBottom - SC.DepthToTop; //Get the samples that are within the filter var sampleswithinFilter = CurrentWell.LithSamples.Where(var => var.Top < SC.DepthToBottom & var.Bottom > SC.DepthToTop); //Now calculate the percentages foreach (Lithology L in sampleswithinFilter) { double percent = (Math.Min(SC.DepthToBottom, L.Bottom) - Math.Max(SC.DepthToTop, L.Top)); if (SoilLengths.ContainsKey(L.RockSymbol)) SoilLengths[L.RockSymbol] += percent; else SoilLengths.Add(L.RockSymbol, percent); } } } if (SoilLengths.Count != 0) { double sumsand = 0; string[] magasiner = new string[] { "s", "k", "g" }; //Build the resrock string StringBuilder resrock = new StringBuilder(); foreach (KeyValuePair<string, double> KVP in SoilLengths) { double percent = KVP.Value / ScreenLength * 100; resrock.Append(KVP.Key + ": " + percent.ToString("###") + "% "); if (magasiner.Contains(KVP.Key.ToLower())) sumsand += percent; if (KVP.Key.Length >= 2 && magasiner.Contains(KVP.Key.Substring(1, 1).ToLower())) sumsand += percent; } CurrentRow.RESROCK = resrock.ToString(); CurrentRow.SUMSAND = sumsand; } } }
public Dictionary<string, IWell> WellsForNovana(bool Lithology, bool WaterLevel, bool Chemistry, bool OnlyRo) { string[] NotExtractionPurpose = new string[] { "A", "G", "I", "J", "L", "R", "U", "M", "P"}; string[] ExtractionUse = new string[]{"C","V","VA","VD","VH","VI","VM","VP","VV"}; string[] NotExtractionUse = new string[] { "A", "G", "I", "J", "L", "R", "U", "M", "P"}; Dictionary<string, IWell> Wells = new Dictionary<string, IWell>(); //Construct the data set if (WaterLevel) JXL.ReadWaterLevels(OnlyRo); if (Lithology) JXL.ReadInLithology(); if (Chemistry) JXL.ReadInChemistrySamples(); JXL.ReadWells(false, WaterLevel); JupiterWell CurrentWell; IIntake CurrentIntake; //Loop the wells foreach (var Boring in JXL.BOREHOLE) { CurrentWell = new JupiterWell(Boring.BOREHOLENO); Wells.Add(Boring.BOREHOLENO, CurrentWell); if (!Boring.IsXUTMNull()) CurrentWell.X = Boring.XUTM; else //If no x set x to 0! CurrentWell.X = 0; if (!Boring.IsYUTMNull()) CurrentWell.Y = Boring.YUTM; else CurrentWell.Y = 0; CurrentWell.Description = Boring.LOCATION; CurrentWell.Terrain = Boring.ELEVATION; CurrentWell.UsedForExtraction = true; //Hvis USE er noget andet end indvinding if (NotExtractionUse.Contains(Boring.USE.ToUpper())) CurrentWell.UsedForExtraction = false; //Hvis den er oprettet med et andet formål og USE ikke er sat til indvinding er det ikke en indvindingsboring if (NotExtractionPurpose.Contains(Boring.PURPOSE.ToUpper()) & !ExtractionUse.Contains(Boring.USE.ToUpper())) CurrentWell.UsedForExtraction = false; //Loop the lithology foreach (var Lith in Boring.GetLITHSAMPRows()) { Lithology L = new Lithology(); L.Bottom = Lith.BOTTOM; L.Top = Lith.TOP; L.RockSymbol = Lith.ROCKSYMBOL; L.RockType = Lith.ROCKTYPE; L.TotalDescription = Lith.TOTALDESCR; CurrentWell.LithSamples.Add(L); } //Reads in chemistry foreach (var Chem in Boring.GetGRWCHEMSAMPLERows()) { foreach (var analysis in Chem.GetGRWCHEMANALYSISRows()) { ChemistrySample C = new ChemistrySample(); C.SampleDate = Chem.SAMPLEDATE; C.CompoundNo = analysis.COMPOUNDNO; C.Amount = analysis.AMOUNT; C.Unit = analysis.UNIT; C.CompoundName = JXL.COMPOUNDLIST.FindByCOMPOUNDNO(C.CompoundNo).LONG_TEXT; CurrentWell.ChemSamples.Add(C); } } //Loop the intakes foreach (var Intake in Boring.GetINTAKERows()) { CurrentIntake = CurrentWell.AddNewIntake(Intake.INTAKENO); //Loop the screens. One intake can in special cases have multiple screens foreach (var ScreenData in Intake.GetSCREENRows()) { Screen CurrentScreen = new Screen(CurrentIntake); CurrentScreen.DepthToTop = ScreenData.TOP; CurrentScreen.DepthToBottom = ScreenData.BOTTOM; CurrentScreen.Number = ScreenData.SCREENNO; }//Screen loop //Read in the water levels foreach (var WatLev in Intake.GetWATLEVELRows()) { ((JupiterIntake)CurrentIntake).RefPoint = WatLev.REFPOINT; FillInWaterLevel(CurrentIntake, WatLev); } }//Intake loop }//Bore loop JXL.WATLEVEL.Clear(); return Wells; }