public static XQt1603OutBlock1[] ListFromQuery(XQt1603 query) { int count = query.GetBlockCount(XQt1603OutBlock1.BlockName); List <XQt1603OutBlock1> list = new List <XQt1603OutBlock1>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt1603OutBlock1 block = new XQt1603OutBlock1(); block.IsValidData = true; block.InvalidReason = ""; try { block.time = query.GetFieldData(block.GetBlockName(), "time", i).TrimEnd('?'); // char 8 block.tjjcode = query.GetFieldData(block.GetBlockName(), "tjjcode", i).TrimEnd('?'); // char 4 block.msvolume = query.GetFieldData(block.GetBlockName(), "msvolume", i).ParseLong("msvolume"); // long 8 block.mdvolume = query.GetFieldData(block.GetBlockName(), "mdvolume", i).ParseLong("mdvolume"); // long 8 block.msvalue = query.GetFieldData(block.GetBlockName(), "msvalue", i).ParseLong("msvalue"); // long 12 block.mdvalue = query.GetFieldData(block.GetBlockName(), "mdvalue", i).ParseLong("mdvalue"); // long 12 block.svolume = query.GetFieldData(block.GetBlockName(), "svolume", i).ParseLong("svolume"); // long 8 block.svalue = query.GetFieldData(block.GetBlockName(), "svalue", i).ParseLong("svalue"); // long 12 } 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 market = default, char gubun1 = default, char gubun2 = default, string cts_time = default, long cts_idx = default, int cnt = default, string upcode = default) { using (XQt1603 instance = new XQt1603()) { instance.SetFieldData(XQt1603InBlock.BlockName, XQt1603InBlock.F.market, 0, market.ToString()); // char 1 instance.SetFieldData(XQt1603InBlock.BlockName, XQt1603InBlock.F.gubun1, 0, gubun1.ToString()); // char 1 instance.SetFieldData(XQt1603InBlock.BlockName, XQt1603InBlock.F.gubun2, 0, gubun2.ToString()); // char 1 instance.SetFieldData(XQt1603InBlock.BlockName, XQt1603InBlock.F.cts_time, 0, cts_time); // char 8 instance.SetFieldData(XQt1603InBlock.BlockName, XQt1603InBlock.F.cts_idx, 0, cts_idx.ToString("d4")); // long 4 instance.SetFieldData(XQt1603InBlock.BlockName, XQt1603InBlock.F.cnt, 0, cnt.ToString("d3")); // int 3 instance.SetFieldData(XQt1603InBlock.BlockName, XQt1603InBlock.F.upcode, 0, upcode); // char 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 XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, char market = default,char gubun1 = default,char gubun2 = default,string cts_time = default,long cts_idx = default,int cnt = default,string upcode = default */) { using (XQt1603 instance = new XQt1603()) { XQAllOutBlocks results = new XQAllOutBlocks(); string tableName = (tableNamePostfix == null) ? "XQt1603OutBlock" : $"XQt1603OutBlock_{tableNamePostfix}"; QueryOption qo = new QueryOption(tableName); results.OutBlock = instance.Select <XQt1603OutBlock>(qo); tableName = (tableNamePostfix == null) ? "XQt1603OutBlock1" : $"XQt1603OutBlock1_{tableNamePostfix}"; qo = new QueryOption(tableName); results.OutBlock1 = instance.SelectMany <XQt1603OutBlock1>(qo); return(results); } }
public static XQt1603OutBlock FromQuery(XQt1603 query) { XQt1603OutBlock block = new XQt1603OutBlock(); 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 block.cts_time = query.GetFieldData(block.GetBlockName(), "cts_time", 0).TrimEnd('?'); // char 8 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }