private GRAT newGRAT(GRAG gg) { GRAT gt = new GRAT { PointID = gg.PointID, Depth = gg.Depth, SAMP_Depth = gg.SAMP_Depth, SAMP_ID = gg.SAMP_ID, SAMP_REF = gg.SAMP_REF, SPEC_REF = gg.SPEC_REF, }; return(gt); }
private async Task <IActionResult> ReadPSDData(ge_search template, ge_log_workbook wb, string sheet) { search_table st = template.search_tables[0]; int psize_col = st.headers.Find(e => e.id == "PARTICLESIZE").found; int descr_row = template.search_items.Find(e => e.name == "soil_description").row; int cobble_row = template.search_items.Find(e => e.name == "cobbles").row; int gravel_row = template.search_items.Find(e => e.name == "gravel").row; int sand_row = template.search_items.Find(e => e.name == "sand").row; int silt_row = template.search_items.Find(e => e.name == "silt").row; int clay_row = template.search_items.Find(e => e.name == "clay").row; int sampid_row = template.search_items.Find(e => e.name == "sample_ref").row; int depth_row = template.search_items.Find(e => e.name == "sample_depth").row; int line_start = template.data_start_row(-1); int line_end = template.data_end_row(40); List <GRAG_WC> GRAG_WC = new List <GRAG_WC>(); foreach (value_header vh in st.headers) { if (vh.id == "PARTICLESIZE") { continue; } GRAG_WC gg = new GRAG_WC(); gg.PointID = vh.id; gg.SAMP_Depth = getDouble(wb.getValue(depth_row, vh.found)).Value; gg.Depth = getDouble(wb.getValue(depth_row, vh.found)).Value; gg.SAMP_ID = Convert.ToString(wb.getValue(sampid_row, vh.found)); gg.SPEC_DESC = Convert.ToString(wb.getValue(descr_row, vh.found)); gg.SAMP_TYPE = "EB"; gg.GRAG_VCRE = getDouble(wb.getValue(cobble_row, vh.found)); gg.GRAG_GRAV = getDouble(wb.getValue(gravel_row, vh.found)); gg.GRAG_SAND = getDouble(wb.getValue(sand_row, vh.found)); gg.GRAG_SILT = getDouble(wb.getValue(silt_row, vh.found)); gg.GRAG_CLAY = getDouble(wb.getValue(clay_row, vh.found)); GRAG_WC.Add(gg); for (int i = line_start; i <= line_end; i++) { string psize = Convert.ToString(wb.getValue(i, psize_col)); if (psize == "") { break; } string ppassing = Convert.ToString(wb.getValue(i, vh.found)); if (ppassing == "") { break; } GRAT gt = newGRAT(gg); gt.Reading = Convert.ToDouble(psize); gt.GRAT_PERP = Convert.ToInt16(ppassing); gg.GRAT.Add(gt); } } return(Ok(GRAG_WC)); }