public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, char gubun = default,char jongchk = default,string cts_shcode = default */) { using (XQt1404 instance = new XQt1404()) { XQAllOutBlocks results = new XQAllOutBlocks(); string tableName = (tableNamePostfix == null) ? "XQt1404OutBlock" : $"XQt1404OutBlock_{tableNamePostfix}"; QueryOption qo = new QueryOption(tableName); results.OutBlock = instance.Select <XQt1404OutBlock>(qo); tableName = (tableNamePostfix == null) ? "XQt1404OutBlock1" : $"XQt1404OutBlock1_{tableNamePostfix}"; qo = new QueryOption(tableName); results.OutBlock1 = instance.SelectMany <XQt1404OutBlock1>(qo); return(results); } }
public static XQt1404OutBlock1[] Get(char gubun = default, char jongchk = default, string cts_shcode = default) { using (XQt1404 instance = new XQt1404()) { instance.SetFieldData(XQt1404InBlock.BlockName, XQt1404InBlock.F.gubun, 0, gubun.ToString()); // char 1 instance.SetFieldData(XQt1404InBlock.BlockName, XQt1404InBlock.F.jongchk, 0, jongchk.ToString()); // char 1 instance.SetFieldData(XQt1404InBlock.BlockName, XQt1404InBlock.F.cts_shcode, 0, cts_shcode); // char 6 if (instance.Request() < 0) { return(null); } var outBlock = instance.GetBlock1s(); return(outBlock); } }
public static XQt1404OutBlock FromQuery(XQt1404 query) { XQt1404OutBlock block = new XQt1404OutBlock(); 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_shcode = query.GetFieldData(block.GetBlockName(), "cts_shcode", 0).TrimEnd('?'); // char 6 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }
public static XQt1404OutBlock1[] ListFromQuery(XQt1404 query) { int count = query.GetBlockCount(XQt1404OutBlock1.BlockName); List <XQt1404OutBlock1> list = new List <XQt1404OutBlock1>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt1404OutBlock1 block = new XQt1404OutBlock1(); block.IsValidData = true; block.InvalidReason = ""; try { block.hname = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?'); // char 20 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.date = query.GetFieldData(block.GetBlockName(), "date", i).TrimEnd('?'); // char 8 block.tprice = query.GetFieldData(block.GetBlockName(), "tprice", i).ParseLong("tprice"); // long 8 block.tchange = query.GetFieldData(block.GetBlockName(), "tchange", i).ParseLong("tchange"); // long 8 block.tdiff = query.GetFieldData(block.GetBlockName(), "tdiff", i).ParseFloat("tdiff"); // float 6.2 block.reason = query.GetFieldData(block.GetBlockName(), "reason", i).TrimEnd('?'); // char 4 block.shcode = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?'); // char 6 block.edate = query.GetFieldData(block.GetBlockName(), "edate", i).TrimEnd('?'); // char 8 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }
public static XQAllOutBlocks Get(char gubun = default, char jongchk = default, string cts_shcode = default) { using (XQt1404 instance = new XQt1404()) { instance.SetFieldData(XQt1404InBlock.BlockName, XQt1404InBlock.F.gubun, 0, gubun.ToString()); // char 1 instance.SetFieldData(XQt1404InBlock.BlockName, XQt1404InBlock.F.jongchk, 0, jongchk.ToString()); // char 1 instance.SetFieldData(XQt1404InBlock.BlockName, XQt1404InBlock.F.cts_shcode, 0, cts_shcode); // char 6 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); } }