Esempio n. 1
0
        public ge_data_table NewFile(ge_search dic,
                                     string[] lines,
                                     Guid dataId,
                                     Guid templateId)
        {
            search_table st         = dic.search_tables[0];
            search_range sr         = st.header;
            string       header_row = dic.search_items.Find(e => e.name == sr.search_item_name).row_text;

            string[] columns    = Split(header_row, 100);
            int      line_start = dic.data_start_row(NOT_FOUND);
            int      line_end   = dic.data_end_row(lines.Count());

            ge_data_table _dt = new ge_data_table(st.name, columns);


            for (int i = line_start; i < line_end; i++)
            {
                string line = lines[i];
                if (line.Length > 0)
                {
                    string[] values = Split(line, _dt.dt.Columns.Count);
                    DataRow  row    = _dt.dt.NewRow();
                    set_values(columns, values, row);
                    _dt.dt.Rows.Add(row);
                }
            }

            return(_dt);
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        public ge_log_file NewFile(ge_search dic,
                                   string[] lines,
                                   Guid dataId,
                                   Guid templateId)
        {
            ge_log_file file = new ge_log_file();

            file.dataId     = dataId;
            file.templateId = templateId;

            file.search_template = dic;

            file.file_headers = dic.search_items;
            file.file_array   = dic.array_items;

            search_table st = dic.search_tables.FirstOrDefault();

            file.search_table  = st;
            file.field_headers = st.headers;
            file.channel       = st.name;

            value_header DateTimeReading = dic.getHeader(ge_log_constants.READINGDATETIME);

            int intReadTime = NOT_FOUND;

            if (DateTimeReading != null)
            {
                intReadTime = DateTimeReading.found;
            }

            value_header Duration    = dic.getHeader(ge_log_constants.DURATION);
            int          intDuration = NOT_FOUND;

            if (Duration != null)
            {
                intDuration = Duration.found;
            }

            value_header Header1   = dic.getHeader(ge_log_constants.VALUE1);
            int          intValue1 = NOT_FOUND;

            if (Header1 != null)
            {
                intValue1 = Header1.found;
            }

            value_header Header2   = dic.getHeader(ge_log_constants.VALUE2);
            int          intValue2 = NOT_FOUND;

            if (Header2 != null)
            {
                intValue2 = Header2.found;
            }

            value_header Header3   = dic.getHeader(ge_log_constants.VALUE3);
            int          intValue3 = NOT_FOUND;

            if (Header3 != null)
            {
                intValue3 = Header3.found;
            }

            value_header Header4   = dic.getHeader(ge_log_constants.VALUE4);
            int          intValue4 = NOT_FOUND;

            if (Header4 != null)
            {
                intValue4 = Header4.found;
            }

            value_header Header5   = dic.getHeader(ge_log_constants.VALUE5);
            int          intValue5 = NOT_FOUND;

            if (Header5 != null)
            {
                intValue5 = Header5.found;
            }

            value_header Header6   = dic.getHeader(ge_log_constants.VALUE6);
            int          intValue6 = NOT_FOUND;

            if (Header6 != null)
            {
                intValue6 = Header6.found;
            }

            value_header Header7   = dic.getHeader(ge_log_constants.VALUE7);
            int          intValue7 = NOT_FOUND;

            if (Header7 != null)
            {
                intValue7 = Header7.found;
            }

            value_header Header8   = dic.getHeader(ge_log_constants.VALUE8);
            int          intValue8 = NOT_FOUND;

            if (Header8 != null)
            {
                intValue8 = Header8.found;
            }

            value_header Header9   = dic.getHeader(ge_log_constants.VALUE9);
            int          intValue9 = NOT_FOUND;

            if (Header9 != null)
            {
                intValue9 = Header9.found;
            }

            value_header Header10   = dic.getHeader(ge_log_constants.VALUE10);
            int          intValue10 = NOT_FOUND;

            if (Header10 != null)
            {
                intValue10 = Header10.found;
            }

            value_header Header11   = dic.getHeader(ge_log_constants.VALUE11);
            int          intValue11 = NOT_FOUND;

            if (Header11 != null)
            {
                intValue11 = Header11.found;
            }

            value_header Header12   = dic.getHeader(ge_log_constants.VALUE12);
            int          intValue12 = NOT_FOUND;

            if (Header12 != null)
            {
                intValue12 = Header12.found;
            }

            value_header Header13   = dic.getHeader(ge_log_constants.VALUE13);
            int          intValue13 = NOT_FOUND;

            if (Header13 != null)
            {
                intValue13 = Header13.found;
            }

            value_header Header14   = dic.getHeader(ge_log_constants.VALUE14);
            int          intValue14 = NOT_FOUND;

            if (Header14 != null)
            {
                intValue14 = Header14.found;
            }

            value_header Header15   = dic.getHeader(ge_log_constants.VALUE15);
            int          intValue15 = NOT_FOUND;

            if (Header15 != null)
            {
                intValue15 = Header15.found;
            }

            value_header Header16   = dic.getHeader(ge_log_constants.VALUE16);
            int          intValue16 = NOT_FOUND;

            if (Header16 != null)
            {
                intValue16 = Header16.found;
            }

            value_header Header17   = dic.getHeader(ge_log_constants.VALUE17);
            int          intValue17 = NOT_FOUND;

            if (Header17 != null)
            {
                intValue17 = Header17.found;
            }

            value_header Header18   = dic.getHeader(ge_log_constants.VALUE18);
            int          intValue18 = NOT_FOUND;

            if (Header18 != null)
            {
                intValue18 = Header18.found;
            }
            value_header HeaderRemark = dic.getHeader(ge_log_constants.REMARK);
            int          intRemark    = NOT_FOUND;

            if (HeaderRemark != null)
            {
                intRemark = HeaderRemark.found;
            }

            value_header log_wdepthM         = file.getHeaderByIdUnits(ge_log_constants.WDEPTH, "m");
            int          intCheckValueForDry = NOT_FOUND;

            if (log_wdepthM != null)
            {
                intCheckValueForDry = log_wdepthM.found;
            }

            file.readings = new List <ge_log_reading>();

            int line_start = dic.data_start_row(NOT_FOUND);

            int line_end = dic.data_end_row(lines.Count());


            int readlines = addReadingsAny(file.readings,
                                           lines,
                                           line_start,
                                           line_end,
                                           intReadTime,
                                           intDuration,
                                           intValue1,
                                           intValue2,
                                           intValue3,
                                           intValue4,
                                           intValue5,
                                           intValue6,
                                           intValue7,
                                           intValue8,
                                           intValue9,
                                           intValue10,
                                           intValue11,
                                           intValue12,
                                           intValue13,
                                           intValue14,
                                           intValue15,
                                           intValue16,
                                           intValue17,
                                           intValue18,
                                           intRemark,
                                           intCheckValueForDry,
                                           DateTimeReading.format
                                           );

            if (readlines <= 0)
            {
                return(null);
            }

            file.init_new_file();
            file.calcReadingAggregates();

            return(file);
        }