public static XQAllOutBlocks Get(string shcode = default, string tradno = default, char gubun1 = default, string traddate1 = default, string traddate2 = default, long cts_idx = default, int cnt = default) { using (XQt1771 instance = new XQt1771()) { instance.SetFieldData(XQt1771InBlock.BlockName, XQt1771InBlock.F.shcode, 0, shcode); // char 6 instance.SetFieldData(XQt1771InBlock.BlockName, XQt1771InBlock.F.tradno, 0, tradno); // char 3 instance.SetFieldData(XQt1771InBlock.BlockName, XQt1771InBlock.F.gubun1, 0, gubun1.ToString()); // char 1 instance.SetFieldData(XQt1771InBlock.BlockName, XQt1771InBlock.F.traddate1, 0, traddate1); // char 8 instance.SetFieldData(XQt1771InBlock.BlockName, XQt1771InBlock.F.traddate2, 0, traddate2); // char 8 instance.SetFieldData(XQt1771InBlock.BlockName, XQt1771InBlock.F.cts_idx, 0, cts_idx.ToString("d4")); // long 4 instance.SetFieldData(XQt1771InBlock.BlockName, XQt1771InBlock.F.cnt, 0, cnt.ToString("d3")); // int 3 if (instance.Request() < 0) { return(null); } XQAllOutBlocks results = new XQAllOutBlocks(); results.OutBlock = instance.GetBlock(); if (results.OutBlock.IsValidData == false) { return(null); } results.OutBlock2 = instance.GetBlock2s(); return(results); } }
public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string shcode = default,string tradno = default,char gubun1 = default,string traddate1 = default,string traddate2 = default,long cts_idx = default,int cnt = default */) { using (XQt1771 instance = new XQt1771()) { XQAllOutBlocks results = new XQAllOutBlocks(); string tableName = (tableNamePostfix == null) ? "XQt1771OutBlock" : $"XQt1771OutBlock_{tableNamePostfix}"; QueryOption qo = new QueryOption(tableName); results.OutBlock = instance.Select <XQt1771OutBlock>(qo); tableName = (tableNamePostfix == null) ? "XQt1771OutBlock2" : $"XQt1771OutBlock2_{tableNamePostfix}"; qo = new QueryOption(tableName); results.OutBlock2 = instance.SelectMany <XQt1771OutBlock2>(qo); return(results); } }
public static XQt1771OutBlock FromQuery(XQt1771 query) { XQt1771OutBlock block = new XQt1771OutBlock(); 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_idx = query.GetFieldData(block.GetBlockName(), "cts_idx", 0).ParseLong("cts_idx"); // long 4 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }
public static XQt1771OutBlock2[] ListFromQuery(XQt1771 query) { int count = query.GetBlockCount(XQt1771OutBlock2.BlockName); List <XQt1771OutBlock2> list = new List <XQt1771OutBlock2>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt1771OutBlock2 block = new XQt1771OutBlock2(); block.IsValidData = true; block.InvalidReason = ""; try { block.traddate = query.GetFieldData(block.GetBlockName(), "traddate", i).TrimEnd('?'); // char 8 block.tradtime = query.GetFieldData(block.GetBlockName(), "tradtime", i).TrimEnd('?'); // char 8 block.price = query.GetFieldData(block.GetBlockName(), "price", i).ParseLong("price"); // 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).ParseLong("volume"); // long 12 block.tradmdcha = query.GetFieldData(block.GetBlockName(), "tradmdcha", i).ParseLong("tradmdcha"); // long 12 block.tradmscha = query.GetFieldData(block.GetBlockName(), "tradmscha", i).ParseLong("tradmscha"); // long 12 block.tradmdval = query.GetFieldData(block.GetBlockName(), "tradmdval", i).ParseLong("tradmdval"); // long 18 block.tradmsval = query.GetFieldData(block.GetBlockName(), "tradmsval", i).ParseLong("tradmsval"); // long 18 block.tradmsscha = query.GetFieldData(block.GetBlockName(), "tradmsscha", i).ParseLong("tradmsscha"); // long 12 block.tradmttvolume = query.GetFieldData(block.GetBlockName(), "tradmttvolume", i).ParseLong("tradmttvolume"); // long 12 block.tradavg = query.GetFieldData(block.GetBlockName(), "tradavg", i).ParseLong("tradavg"); // long 8 block.tradmttavg = query.GetFieldData(block.GetBlockName(), "tradmttavg", i).ParseLong("tradmttavg"); // long 8 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }