public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string shcode = default,string date = default,long cnt = default */) { using (XQt1954 instance = new XQt1954()) { XQAllOutBlocks results = new XQAllOutBlocks(); string tableName = (tableNamePostfix == null) ? "XQt1954OutBlock" : $"XQt1954OutBlock_{tableNamePostfix}"; QueryOption qo = new QueryOption(tableName); results.OutBlock = instance.Select <XQt1954OutBlock>(qo); tableName = (tableNamePostfix == null) ? "XQt1954OutBlock1" : $"XQt1954OutBlock1_{tableNamePostfix}"; qo = new QueryOption(tableName); results.OutBlock1 = instance.SelectMany <XQt1954OutBlock1>(qo); return(results); } }
public static XQt1954OutBlock1[] ListFromQuery(XQt1954 query) { int count = query.GetBlockCount(XQt1954OutBlock1.BlockName); List <XQt1954OutBlock1> list = new List <XQt1954OutBlock1>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt1954OutBlock1 block = new XQt1954OutBlock1(); block.IsValidData = true; block.InvalidReason = ""; try { block.date = query.GetFieldData(block.GetBlockName(), "date", i).TrimEnd('?'); // char 8 block.open = query.GetFieldData(block.GetBlockName(), "open", i).ParseLong("open"); // long 8 block.high = query.GetFieldData(block.GetBlockName(), "high", i).ParseLong("high"); // long 8 block.low = query.GetFieldData(block.GetBlockName(), "low", i).ParseLong("low"); // long 8 block.close = query.GetFieldData(block.GetBlockName(), "close", i).ParseLong("close"); // long 8 block.sign = query.GetFieldData(block.GetBlockName(), "sign", i).FirstOrDefault(); // char 1 block.change = query.GetFieldData(block.GetBlockName(), "change", i).ParseLong("change"); // long 8 block.diff = query.GetFieldData(block.GetBlockName(), "diff", i).ParseFloat("diff"); // float 6.2 block.volume = query.GetFieldData(block.GetBlockName(), "volume", i).ParseFloat("volume"); // float 12 block.bsprice = query.GetFieldData(block.GetBlockName(), "bsprice", i).ParseLong("bsprice"); // long 8 block.bjprice = query.GetFieldData(block.GetBlockName(), "bjprice", i).ParseFloat("bjprice"); // float 8.2 block.bsign = query.GetFieldData(block.GetBlockName(), "bsign", i).FirstOrDefault(); // char 1 block.bschange = query.GetFieldData(block.GetBlockName(), "bschange", i).ParseLong("bschange"); // long 8 block.bjchange = query.GetFieldData(block.GetBlockName(), "bjchange", i).ParseFloat("bjchange"); // float 8.2 block.bdiff = query.GetFieldData(block.GetBlockName(), "bdiff", i).ParseFloat("bdiff"); // float 6.2 block.bvolume = query.GetFieldData(block.GetBlockName(), "bvolume", i).ParseFloat("bvolume"); // float 12 block.parity = query.GetFieldData(block.GetBlockName(), "parity", i).ParseFloat("parity"); // float 6.2 block.egearing = query.GetFieldData(block.GetBlockName(), "egearing", i).ParseFloat("egearing"); // float 6.2 block.premium = query.GetFieldData(block.GetBlockName(), "premium", i).ParseFloat("premium"); // float 6.2 block.berate = query.GetFieldData(block.GetBlockName(), "berate", i).ParseFloat("berate"); // float 6.2 block.capt = query.GetFieldData(block.GetBlockName(), "capt", i).ParseFloat("capt"); // float 6.2 block.gearing = query.GetFieldData(block.GetBlockName(), "gearing", i).ParseFloat("gearing"); // float 6.2 block.mness = query.GetFieldData(block.GetBlockName(), "mness", 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 XQt1954OutBlock1[] Get(string shcode = default, string date = default, long cnt = default) { using (XQt1954 instance = new XQt1954()) { instance.SetFieldData(XQt1954InBlock.BlockName, XQt1954InBlock.F.shcode, 0, shcode); // char 6 instance.SetFieldData(XQt1954InBlock.BlockName, XQt1954InBlock.F.date, 0, date); // char 8 instance.SetFieldData(XQt1954InBlock.BlockName, XQt1954InBlock.F.cnt, 0, cnt.ToString("d3")); // long 3 if (instance.Request() < 0) { return(null); } var outBlock = instance.GetBlock1s(); return(outBlock); } }
public static XQAllOutBlocks Get(string shcode = default, string date = default, long cnt = default) { using (XQt1954 instance = new XQt1954()) { instance.SetFieldData(XQt1954InBlock.BlockName, XQt1954InBlock.F.shcode, 0, shcode); // char 6 instance.SetFieldData(XQt1954InBlock.BlockName, XQt1954InBlock.F.date, 0, date); // char 8 instance.SetFieldData(XQt1954InBlock.BlockName, XQt1954InBlock.F.cnt, 0, cnt.ToString("d3")); // long 3 if (instance.Request() < 0) { return(null); } XQAllOutBlocks results = new XQAllOutBlocks(); results.OutBlock = instance.GetBlock(); if (results.OutBlock.IsValidData == false) { return(null); } results.OutBlock1 = instance.GetBlock1s(); return(results); } }
public static XQt1954OutBlock FromQuery(XQt1954 query) { XQt1954OutBlock block = new XQt1954OutBlock(); block.IsValidData = true; block.InvalidReason = ""; if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { block.IsValidData = false; block.InvalidReason = query.ReceiveMessage; return(block); } try { block.date = query.GetFieldData(block.GetBlockName(), "date", 0).TrimEnd('?'); // char 8 block.bsjgubun = query.GetFieldData(block.GetBlockName(), "bsjgubun", 0).FirstOrDefault(); // char 1 block.bscode = query.GetFieldData(block.GetBlockName(), "bscode", 0).TrimEnd('?'); // char 6 block.bjcode = query.GetFieldData(block.GetBlockName(), "bjcode", 0).TrimEnd('?'); // char 3 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }