Пример #1
0
        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);
            }
        }
Пример #2
0
        public List <WellLogFile> GetWellLogFiles(BoreholeCollection wells)
        {
            var files = new List <WellLogFile>();
            BoreholePropertyCollection bhPropertyColl = wells.BoreholePropertyCollection;
            DictionaryBoreholeProperty dicProperty    = DictionaryBoreholeProperty.NullObject;

            dicProperty = WellsImporter.FindDictionaryProperty(bhPropertyColl, "FIELDPRO ID");

            foreach (Borehole well in wells)
            {
                string id = well.PropertyAccess.GetPropertyValue <string>(dicProperty);
                if (!String.IsNullOrEmpty(id.Trim()))
                {
                    files.AddRange(WellLogFile.Broker.GetAllOfWell(id.Trim()));
                }
            }
            return(files);
        }
Пример #3
0
        private void btnImportWells_Click(object sender, EventArgs e)
        {
            var selectedWells = new List <Well>();

            foreach (Well item in this.wellsListBox.CheckedItems)
            {
                selectedWells.Add(item);
            }
            var wellsImporter = new WellsImporter();

            try
            {
                Cursor.Current = Cursors.WaitCursor;
                wellsImporter.Import(selectedWells, WebConfiguration.Current);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }