private WellTrajectory WellTrajectoryFromRow(DataRow dr) { WellTrajectory wt = new WellTrajectory(); wt.ID = 1; //just set indicator wt.MD = double.Parse(dr["MD"].ToString()); wt.VD = double.Parse(dr["TVD"].ToString()); wt.Inclination = double.Parse(dr["INCLINATION"].ToString()); wt.Azimuth = double.Parse(dr["AZIMUTH"].ToString()); wt.NS = double.Parse(dr["NS"].ToString()); wt.EW = double.Parse(dr["WE"].ToString()); return(wt); }
private void button1_Click(object sender, EventArgs e) { WellRoot wellRoot = WellRoot.Get(PetrelProject.PrimaryProject); BoreholeCollection boreholeColl = wellRoot.BoreholeCollection; string WellTextData = ""; string TrajTextData = ""; foreach (Borehole bh in boreholeColl) { bool bok = false; foreach (object itemChecked in WellsList.CheckedItems) { if (itemChecked.ToString() == bh.Name) { bok = true; break; } } if (!bok) { continue; } PetrelLogger.InfoOutputWindow("Loading: " + bh.Name); Well w = WellsImporter.Borehole2Well(bh); WellTextData += w.Serialize() + Environment.NewLine; IEnumerable <TrajectoryRecord> ie = bh.Trajectory.Records; foreach (TrajectoryRecord r in ie) { WellTrajectory t = new WellTrajectory(r); TrajTextData += t.Serialize(bh.Name) + Environment.NewLine; } } if (!string.IsNullOrEmpty(WellTextData)) { string datafile = System.IO.Path.GetTempPath() + "petrelwells.txt"; System.IO.File.WriteAllText(datafile, Well.TxtHeader + Environment.NewLine + WellTextData); WebImporterWrapper wi = new WebImporterWrapper(WebConfiguration.Current); int id = wi.UploadWells(datafile); } if (!string.IsNullOrEmpty(TrajTextData)) { string datafile = System.IO.Path.GetTempPath() + "petreltraj.txt"; System.IO.File.WriteAllText(datafile, WellTrajectory.TxtHeader + Environment.NewLine + TrajTextData); WebImporterWrapper wi = new WebImporterWrapper(WebConfiguration.Current); int id = wi.UploadTraj(datafile); } }