public static XQt9942OutBlock[] ListFromQuery(XQt9942 query) { int count = query.GetBlockCount(XQt9942OutBlock.BlockName); List <XQt9942OutBlock> list = new List <XQt9942OutBlock>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt9942OutBlock block = new XQt9942OutBlock(); block.IsValidData = true; block.InvalidReason = ""; try { block.hname = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?'); // char 40 block.shcode = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?'); // char 6 block.expcode = query.GetFieldData(block.GetBlockName(), "expcode", i).TrimEnd('?'); // char 12 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }
public XQt9942OutBlock[] GetBlocks() { XQt9942OutBlock[] instance = XQt9942OutBlock.ListFromQuery(this); return(instance); }