public static XQt8430OutBlock[] ListFromQuery(XQt8430 query) { int count = query.GetBlockCount(XQt8430OutBlock.BlockName); List <XQt8430OutBlock> list = new List <XQt8430OutBlock>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt8430OutBlock block = new XQt8430OutBlock(); 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 6 block.expcode = query.GetFieldData(block.GetBlockName(), "expcode", i).TrimEnd('?'); // char 12 block.etfgubun = query.GetFieldData(block.GetBlockName(), "etfgubun", i).FirstOrDefault(); // char 1 block.uplmtprice = query.GetFieldData(block.GetBlockName(), "uplmtprice", i).ParseLong("uplmtprice"); // long 8 block.dnlmtprice = query.GetFieldData(block.GetBlockName(), "dnlmtprice", i).ParseLong("dnlmtprice"); // long 8 block.jnilclose = query.GetFieldData(block.GetBlockName(), "jnilclose", i).ParseLong("jnilclose"); // long 8 block.memedan = query.GetFieldData(block.GetBlockName(), "memedan", i).TrimEnd('?'); // char 5 block.recprice = query.GetFieldData(block.GetBlockName(), "recprice", i).ParseLong("recprice"); // long 8 block.gubun = query.GetFieldData(block.GetBlockName(), "gubun", i).FirstOrDefault(); // char 1 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }
public static XQt8430OutBlock[] ReadFromDB(string tableNamePostfix = null /*, char gubun = default */) { using (XQt8430 instance = new XQt8430()) { string tableName = (tableNamePostfix == null) ? "XQt8430OutBlock" : $"XQt8430OutBlock_{tableNamePostfix}"; QueryOption qo = new QueryOption(tableName); // if (gubun != default) qo.Add("gubun", gubun); var outBlock = instance.SelectMany <XQt8430OutBlock>(qo); return(outBlock); } }
public static XQt8430OutBlock[] Get(char gubun = default) { using (XQt8430 instance = new XQt8430()) { instance.SetFieldData(XQt8430InBlock.BlockName, XQt8430InBlock.F.gubun, 0, gubun.ToString()); // char 1 if (instance.Request() < 0) { return(null); } var outBlock = instance.GetBlocks(); return(outBlock); } }