public static XQt2814OutBlock FromQuery(XQt2814 query) { XQt2814OutBlock block = new XQt2814OutBlock(); block.IsValidData = true; block.InvalidReason = ""; if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { block.IsValidData = false; block.InvalidReason = query.ReceiveMessage; return(block); } try { block.mcode = query.GetFieldData(block.GetBlockName(), "mcode", 0).TrimEnd('?'); // char 8 block.mname = query.GetFieldData(block.GetBlockName(), "mname", 0).TrimEnd('?'); // char 20 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }
public static XQt2814OutBlock1[] ListFromQuery(XQt2814 query) { int count = query.GetBlockCount(XQt2814OutBlock1.BlockName); List <XQt2814OutBlock1> list = new List <XQt2814OutBlock1>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt2814OutBlock1 block = new XQt2814OutBlock1(); block.IsValidData = true; block.InvalidReason = ""; try { block.date = query.GetFieldData(block.GetBlockName(), "date", 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 block.sv_03 = query.GetFieldData(block.GetBlockName(), "sv_03", i).ParseLong("sv_03"); // long 12 block.sv_04 = query.GetFieldData(block.GetBlockName(), "sv_04", i).ParseLong("sv_04"); // long 12 block.sv_02 = query.GetFieldData(block.GetBlockName(), "sv_02", i).ParseLong("sv_02"); // long 12 block.sv_05 = query.GetFieldData(block.GetBlockName(), "sv_05", i).ParseLong("sv_05"); // long 12 block.sv_06 = query.GetFieldData(block.GetBlockName(), "sv_06", i).ParseLong("sv_06"); // long 12 block.sv_07 = query.GetFieldData(block.GetBlockName(), "sv_07", i).ParseLong("sv_07"); // long 12 block.sv_00 = query.GetFieldData(block.GetBlockName(), "sv_00", i).ParseLong("sv_00"); // long 12 block.sv_09 = query.GetFieldData(block.GetBlockName(), "sv_09", i).ParseLong("sv_09"); // long 12 block.sv_10 = query.GetFieldData(block.GetBlockName(), "sv_10", i).ParseLong("sv_10"); // long 12 block.sv_11 = query.GetFieldData(block.GetBlockName(), "sv_11", i).ParseLong("sv_11"); // long 12 block.sv_99 = query.GetFieldData(block.GetBlockName(), "sv_99", i).ParseLong("sv_99"); // long 12 block.sa_08 = query.GetFieldData(block.GetBlockName(), "sa_08", i).ParseDouble("sa_08"); // double 12.0 block.sa_17 = query.GetFieldData(block.GetBlockName(), "sa_17", i).ParseDouble("sa_17"); // double 12.0 block.sa_18 = query.GetFieldData(block.GetBlockName(), "sa_18", i).ParseDouble("sa_18"); // double 12.0 block.sa_01 = query.GetFieldData(block.GetBlockName(), "sa_01", i).ParseDouble("sa_01"); // double 12.0 block.sa_03 = query.GetFieldData(block.GetBlockName(), "sa_03", i).ParseDouble("sa_03"); // double 12.0 block.sa_04 = query.GetFieldData(block.GetBlockName(), "sa_04", i).ParseDouble("sa_04"); // double 12.0 block.sa_02 = query.GetFieldData(block.GetBlockName(), "sa_02", i).ParseDouble("sa_02"); // double 12.0 block.sa_05 = query.GetFieldData(block.GetBlockName(), "sa_05", i).ParseDouble("sa_05"); // double 12.0 block.sa_06 = query.GetFieldData(block.GetBlockName(), "sa_06", i).ParseDouble("sa_06"); // double 12.0 block.sa_07 = query.GetFieldData(block.GetBlockName(), "sa_07", i).ParseDouble("sa_07"); // double 12.0 block.sa_00 = query.GetFieldData(block.GetBlockName(), "sa_00", i).ParseDouble("sa_00"); // double 12.0 block.sa_09 = query.GetFieldData(block.GetBlockName(), "sa_09", i).ParseDouble("sa_09"); // double 12.0 block.sa_10 = query.GetFieldData(block.GetBlockName(), "sa_10", i).ParseDouble("sa_10"); // double 12.0 block.sa_11 = query.GetFieldData(block.GetBlockName(), "sa_11", i).ParseDouble("sa_11"); // double 12.0 block.sa_99 = query.GetFieldData(block.GetBlockName(), "sa_99", i).ParseDouble("sa_99"); // double 12.0 block.jisu = query.GetFieldData(block.GetBlockName(), "jisu", i).ParseFloat("jisu"); // float 7.2 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }