public static XQt1809OutBlock FromQuery(XQt1809 query) { XQt1809OutBlock block = new XQt1809OutBlock(); 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 = query.GetFieldData(block.GetBlockName(), "cts", 0).TrimEnd('?'); // char 30 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }
public static XQt1809OutBlock1[] ListFromQuery(XQt1809 query) { int count = query.GetBlockCount(XQt1809OutBlock1.BlockName); List <XQt1809OutBlock1> list = new List <XQt1809OutBlock1>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt1809OutBlock1 block = new XQt1809OutBlock1(); 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 6 block.signal_id = query.GetFieldData(block.GetBlockName(), "signal_id", i).TrimEnd('?'); // char 4 block.signal_desc = query.GetFieldData(block.GetBlockName(), "signal_desc", i).TrimEnd('?'); // char 300 block.point = query.GetFieldData(block.GetBlockName(), "point", i).TrimEnd('?'); // char 3 block.keyword = query.GetFieldData(block.GetBlockName(), "keyword", i).TrimEnd('?'); // char 40 block.seq = query.GetFieldData(block.GetBlockName(), "seq", i).TrimEnd('?'); // char 24 block.gubun = query.GetFieldData(block.GetBlockName(), "gubun", i).TrimEnd('?'); // char 2 block.jmcode = query.GetFieldData(block.GetBlockName(), "jmcode", i).TrimEnd('?'); // char 6 block.price = query.GetFieldData(block.GetBlockName(), "price", i).ParseLong("price"); // long 7 block.sign = query.GetFieldData(block.GetBlockName(), "sign", i).FirstOrDefault(); // char 1 block.chgrate = query.GetFieldData(block.GetBlockName(), "chgrate", i).ParseFloat("chgrate"); // float 6.2 block.volume = query.GetFieldData(block.GetBlockName(), "volume", i).ParseLong("volume"); // long 9 block.datetime = query.GetFieldData(block.GetBlockName(), "datetime", i).TrimEnd('?'); // char 16 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }