public static XQt3401OutBlock1[] ListFromQuery(XQt3401 query) { int count = query.GetBlockCount(XQt3401OutBlock1.BlockName); List <XQt3401OutBlock1> list = new List <XQt3401OutBlock1>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt3401OutBlock1 block = new XQt3401OutBlock1(); block.IsValidData = true; block.InvalidReason = ""; try { block.shcode = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?'); // char 9 block.tradno = query.GetFieldData(block.GetBlockName(), "tradno", i).TrimEnd('?'); // char 3 block.date = query.GetFieldData(block.GetBlockName(), "date", i).TrimEnd('?'); // char 8 block.tradname = query.GetFieldData(block.GetBlockName(), "tradname", i).TrimEnd('?'); // char 30 block.bopn = query.GetFieldData(block.GetBlockName(), "bopn", i).TrimEnd('?'); // char 30 block.nopn = query.GetFieldData(block.GetBlockName(), "nopn", i).TrimEnd('?'); // char 30 block.boga = query.GetFieldData(block.GetBlockName(), "boga", i).ParseLong("boga"); // long 12 block.noga = query.GetFieldData(block.GetBlockName(), "noga", i).ParseLong("noga"); // long 12 block.close = query.GetFieldData(block.GetBlockName(), "close", i).ParseLong("close"); // long 8 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }
public static XQt3401OutBlock FromQuery(XQt3401 query) { XQt3401OutBlock block = new XQt3401OutBlock(); block.IsValidData = true; block.InvalidReason = ""; if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { block.IsValidData = false; block.InvalidReason = query.ReceiveMessage; return(block); } try { block.cts_date = query.GetFieldData(block.GetBlockName(), "cts_date", 0).TrimEnd('?'); // char 8 block.price = query.GetFieldData(block.GetBlockName(), "price", 0).ParseLong("price"); // long 8 block.sign = query.GetFieldData(block.GetBlockName(), "sign", 0).FirstOrDefault(); // char 1 block.change = query.GetFieldData(block.GetBlockName(), "change", 0).ParseLong("change"); // long 8 block.diff = query.GetFieldData(block.GetBlockName(), "diff", 0).ParseFloat("diff"); // float 6.2 block.volume = query.GetFieldData(block.GetBlockName(), "volume", 0).ParseLong("volume"); // long 12 block.value = query.GetFieldData(block.GetBlockName(), "value", 0).ParseLong("value"); // long 12 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }
public static XQAllOutBlocks Get(string shcode = default, char gubun1 = default, string tradno = default, string cts_date = default) { using (XQt3401 instance = new XQt3401()) { instance.SetFieldData(XQt3401InBlock.BlockName, XQt3401InBlock.F.shcode, 0, shcode); // char 9 instance.SetFieldData(XQt3401InBlock.BlockName, XQt3401InBlock.F.gubun1, 0, gubun1.ToString()); // char 1 instance.SetFieldData(XQt3401InBlock.BlockName, XQt3401InBlock.F.tradno, 0, tradno); // char 3 instance.SetFieldData(XQt3401InBlock.BlockName, XQt3401InBlock.F.cts_date, 0, cts_date); // char 8 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 XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string shcode = default,char gubun1 = default,string tradno = default,string cts_date = default */) { using (XQt3401 instance = new XQt3401()) { XQAllOutBlocks results = new XQAllOutBlocks(); string tableName = (tableNamePostfix == null) ? "XQt3401OutBlock" : $"XQt3401OutBlock_{tableNamePostfix}"; QueryOption qo = new QueryOption(tableName); results.OutBlock = instance.Select <XQt3401OutBlock>(qo); tableName = (tableNamePostfix == null) ? "XQt3401OutBlock1" : $"XQt3401OutBlock1_{tableNamePostfix}"; qo = new QueryOption(tableName); results.OutBlock1 = instance.SelectMany <XQt3401OutBlock1>(qo); return(results); } }
public static XQt3401OutBlock1[] Get(string shcode = default, char gubun1 = default, string tradno = default, string cts_date = default) { using (XQt3401 instance = new XQt3401()) { instance.SetFieldData(XQt3401InBlock.BlockName, XQt3401InBlock.F.shcode, 0, shcode); // char 9 instance.SetFieldData(XQt3401InBlock.BlockName, XQt3401InBlock.F.gubun1, 0, gubun1.ToString()); // char 1 instance.SetFieldData(XQt3401InBlock.BlockName, XQt3401InBlock.F.tradno, 0, tradno); // char 3 instance.SetFieldData(XQt3401InBlock.BlockName, XQt3401InBlock.F.cts_date, 0, cts_date); // char 8 if (instance.Request() < 0) { return(null); } var outBlock = instance.GetBlock1s(); return(outBlock); } }