public static XQt8435OutBlock[] ListFromQuery(XQt8435 query) { int count = query.GetBlockCount(XQt8435OutBlock.BlockName); List <XQt8435OutBlock> list = new List <XQt8435OutBlock>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt8435OutBlock block = new XQt8435OutBlock(); block.IsValidData = true; block.InvalidReason = ""; try { block.hname = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?'); // char 20 block.shcode = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?'); // char 8 block.expcode = query.GetFieldData(block.GetBlockName(), "expcode", i).TrimEnd('?'); // char 12 block.uplmtprice = query.GetFieldData(block.GetBlockName(), "uplmtprice", i).ParseFloat("uplmtprice"); // float 6.2 block.dnlmtprice = query.GetFieldData(block.GetBlockName(), "dnlmtprice", i).ParseFloat("dnlmtprice"); // float 6.2 block.jnilclose = query.GetFieldData(block.GetBlockName(), "jnilclose", i).ParseFloat("jnilclose"); // float 6.2 block.jnilhigh = query.GetFieldData(block.GetBlockName(), "jnilhigh", i).ParseFloat("jnilhigh"); // float 6.2 block.jnillow = query.GetFieldData(block.GetBlockName(), "jnillow", i).ParseFloat("jnillow"); // float 6.2 block.recprice = query.GetFieldData(block.GetBlockName(), "recprice", i).ParseFloat("recprice"); // float 6.2 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }
public XQt8435OutBlock[] GetBlocks() { XQt8435OutBlock[] instance = XQt8435OutBlock.ListFromQuery(this); return(instance); }