public static XQt1764OutBlock[] ListFromQuery(XQt1764 query) { int count = query.GetBlockCount(XQt1764OutBlock.BlockName); List <XQt1764OutBlock> list = new List <XQt1764OutBlock>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt1764OutBlock block = new XQt1764OutBlock(); block.IsValidData = true; block.InvalidReason = ""; try { block.rank = query.GetFieldData(block.GetBlockName(), "rank", i).ParseLong("rank"); // long 4 block.tradno = query.GetFieldData(block.GetBlockName(), "tradno", i).TrimEnd('?'); // char 3 block.tradname = query.GetFieldData(block.GetBlockName(), "tradname", i).TrimEnd('?'); // char 20 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }
public static XQt1764OutBlock[] ReadFromDB(string tableNamePostfix = null /*, string shcode = default,char gubun1 = default */) { using (XQt1764 instance = new XQt1764()) { string tableName = (tableNamePostfix == null) ? "XQt1764OutBlock" : $"XQt1764OutBlock_{tableNamePostfix}"; QueryOption qo = new QueryOption(tableName); // if (shcode != default) qo.Add("shcode", shcode); // if (gubun1 != default) qo.Add("gubun1", gubun1); var outBlock = instance.SelectMany <XQt1764OutBlock>(qo); return(outBlock); } }
public static XQt1764OutBlock[] Get(string shcode = default, char gubun1 = default) { using (XQt1764 instance = new XQt1764()) { instance.SetFieldData(XQt1764InBlock.BlockName, XQt1764InBlock.F.shcode, 0, shcode); // char 6 instance.SetFieldData(XQt1764InBlock.BlockName, XQt1764InBlock.F.gubun1, 0, gubun1.ToString()); // char 1 if (instance.Request() < 0) { return(null); } var outBlock = instance.GetBlocks(); return(outBlock); } }