public async Task LoadLASFile(ConnectParameters source, ConnectParameters target, string fileName, string ReferenceTableDefJson) { _logSource = fileName; connectionString = target.ConnectionString; _dataDef = JsonConvert.DeserializeObject <List <DataAccessDef> >(target.DataAccessDefinition); _references = JsonConvert.DeserializeObject <List <ReferenceTable> >(ReferenceTableDefJson); lasAccessJson = JObject.Parse(await fileStorageService.ReadFile("connectdefinition", "LASDataAccess.json")); string lasMappingsStr = await fileStorageService.ReadFile("connectdefinition", "LASDataAccess.json"); lasMappings = JsonConvert.DeserializeObject <LASMappings>(lasMappingsStr); lasSections = new List <LASSections>(); LASSections ls = await GetLASSections(source.Catalog, fileName); lasSections.Add(ls); _dbConn.OpenConnection(target); _dbUserName = _dbConn.GetUsername(); GetVersionInfo(ls.versionInfo); string json = GetHeaderInfo(ls.wellInfo); LoadHeader(json); GetCurveInfo(ls.curveInfo); GetDataInfo(ls.dataInfo); LoadParameterInfo(); LoadLogs(); _dbConn.CloseConnection(); }
public async Task <DataTable> GetLASWellHeaders(ConnectParameters source, ConnectParameters target) { string accessJson = await fileStorageService.ReadFile("connectdefinition", "PPDMDataAccess.json"); _dataDef = JsonConvert.DeserializeObject <List <DataAccessDef> >(accessJson); //lasAccessJson = JObject.Parse(await fileStorageService.ReadFile("connectdefinition", "LASDataAccess.json")); string lasMappingsStr = await fileStorageService.ReadFile("connectdefinition", "LASDataAccess.json"); lasMappings = JsonConvert.DeserializeObject <LASMappings>(lasMappingsStr); List <string> files = new List <string>(); files = await GetLASFileNames(source.Catalog); DataAccessDef dataType = _dataDef.First(x => x.DataType == "WellBore"); string select = dataType.Select; string query = $" where 0 = 1"; _dbConn.OpenConnection(target); DataTable dt = _dbConn.GetDataTable(select, query); foreach (string file in files) { LASSections ls = await GetLASSections(source.Catalog, file); lasSections.Add(ls); GetVersionInfo(ls.versionInfo); string json = GetHeaderInfo(ls.wellInfo); DataRow row = dt.NewRow(); JObject jo = JObject.Parse(json); foreach (JProperty property in jo.Properties()) { string strValue = property.Value.ToString(); if (!string.IsNullOrEmpty(strValue)) { if (row.Table.Columns.Contains(property.Name)) { row[property.Name] = property.Value; } } } dt.Rows.Add(row); } return(dt); }