public static XQt1533OutBlock[] ListFromQuery(XQt1533 query) { int count = query.GetBlockCount(XQt1533OutBlock.BlockName); List <XQt1533OutBlock> list = new List <XQt1533OutBlock>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt1533OutBlock block = new XQt1533OutBlock(); block.IsValidData = true; block.InvalidReason = ""; try { block.tmname = query.GetFieldData(block.GetBlockName(), "tmname", i).TrimEnd('?'); // char 36 block.totcnt = query.GetFieldData(block.GetBlockName(), "totcnt", i).ParseLong("totcnt"); // long 4 block.upcnt = query.GetFieldData(block.GetBlockName(), "upcnt", i).ParseLong("upcnt"); // long 4 block.dncnt = query.GetFieldData(block.GetBlockName(), "dncnt", i).ParseLong("dncnt"); // long 4 block.uprate = query.GetFieldData(block.GetBlockName(), "uprate", i).ParseFloat("uprate"); // float 6.2 block.diff_vol = query.GetFieldData(block.GetBlockName(), "diff_vol", i).ParseFloat("diff_vol"); // float 10.2 block.avgdiff = query.GetFieldData(block.GetBlockName(), "avgdiff", i).ParseFloat("avgdiff"); // float 6.2 block.chgdiff = query.GetFieldData(block.GetBlockName(), "chgdiff", i).ParseFloat("chgdiff"); // float 6.2 block.tmcode = query.GetFieldData(block.GetBlockName(), "tmcode", i).TrimEnd('?'); // char 4 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }
public static XQt1533OutBlock[] ReadFromDB(string tableNamePostfix = null /*, char gubun = default,long chgdate = default */) { using (XQt1533 instance = new XQt1533()) { string tableName = (tableNamePostfix == null) ? "XQt1533OutBlock" : $"XQt1533OutBlock_{tableNamePostfix}"; QueryOption qo = new QueryOption(tableName); // if (gubun != default) qo.Add("gubun", gubun); // if (chgdate != default) qo.Add("chgdate", chgdate); var outBlock = instance.SelectMany <XQt1533OutBlock>(qo); return(outBlock); } }
public static XQt1533OutBlock[] Get(char gubun = default, long chgdate = default) { using (XQt1533 instance = new XQt1533()) { instance.SetFieldData(XQt1533InBlock.BlockName, XQt1533InBlock.F.gubun, 0, gubun.ToString()); // char 1 instance.SetFieldData(XQt1533InBlock.BlockName, XQt1533InBlock.F.chgdate, 0, chgdate.ToString("d2")); // long 2 if (instance.Request() < 0) { return(null); } var outBlock = instance.GetBlocks(); return(outBlock); } }