public static XQt1617OutBlock1[] ListFromQuery(XQt1617 query) { int count = query.GetBlockCount(XQt1617OutBlock1.BlockName); List <XQt1617OutBlock1> list = new List <XQt1617OutBlock1>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt1617OutBlock1 block = new XQt1617OutBlock1(); block.IsValidData = true; block.InvalidReason = ""; try { block.date = query.GetFieldData(block.GetBlockName(), "date", i).TrimEnd('?'); // char 8 block.time = query.GetFieldData(block.GetBlockName(), "time", i).TrimEnd('?'); // char 8 block.sv_08 = query.GetFieldData(block.GetBlockName(), "sv_08", i).ParseLong("sv_08"); // long 12 block.sv_17 = query.GetFieldData(block.GetBlockName(), "sv_17", i).ParseLong("sv_17"); // long 12 block.sv_18 = query.GetFieldData(block.GetBlockName(), "sv_18", i).ParseLong("sv_18"); // long 12 block.sv_01 = query.GetFieldData(block.GetBlockName(), "sv_01", i).ParseLong("sv_01"); // long 12 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }
public static XQt1617OutBlock FromQuery(XQt1617 query) { XQt1617OutBlock block = new XQt1617OutBlock(); block.IsValidData = true; block.InvalidReason = ""; if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { block.IsValidData = false; block.InvalidReason = query.ReceiveMessage; return(block); } try { block.cts_date = query.GetFieldData(block.GetBlockName(), "cts_date", 0).TrimEnd('?'); // char 8 block.cts_time = query.GetFieldData(block.GetBlockName(), "cts_time", 0).TrimEnd('?'); // char 8 block.ms_08 = query.GetFieldData(block.GetBlockName(), "ms_08", 0).ParseLong("ms_08"); // long 12 block.md_08 = query.GetFieldData(block.GetBlockName(), "md_08", 0).ParseLong("md_08"); // long 12 block.sv_08 = query.GetFieldData(block.GetBlockName(), "sv_08", 0).ParseLong("sv_08"); // long 12 block.ms_17 = query.GetFieldData(block.GetBlockName(), "ms_17", 0).ParseLong("ms_17"); // long 12 block.md_17 = query.GetFieldData(block.GetBlockName(), "md_17", 0).ParseLong("md_17"); // long 12 block.sv_17 = query.GetFieldData(block.GetBlockName(), "sv_17", 0).ParseLong("sv_17"); // long 12 block.ms_18 = query.GetFieldData(block.GetBlockName(), "ms_18", 0).ParseLong("ms_18"); // long 12 block.md_18 = query.GetFieldData(block.GetBlockName(), "md_18", 0).ParseLong("md_18"); // long 12 block.sv_18 = query.GetFieldData(block.GetBlockName(), "sv_18", 0).ParseLong("sv_18"); // long 12 block.ms_01 = query.GetFieldData(block.GetBlockName(), "ms_01", 0).ParseLong("ms_01"); // long 12 block.md_01 = query.GetFieldData(block.GetBlockName(), "md_01", 0).ParseLong("md_01"); // long 12 block.sv_01 = query.GetFieldData(block.GetBlockName(), "sv_01", 0).ParseLong("sv_01"); // long 12 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }