public static XQt1981OutBlock1[] ListFromQuery(XQt1981 query) { int count = query.GetBlockCount(XQt1981OutBlock1.BlockName); List <XQt1981OutBlock1> list = new List <XQt1981OutBlock1>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt1981OutBlock1 block = new XQt1981OutBlock1(); block.IsValidData = true; block.InvalidReason = ""; try { block.shcode = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?'); // char 6 block.expcode = query.GetFieldData(block.GetBlockName(), "expcode", i).TrimEnd('?'); // char 12 block.hname = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?'); // char 20 block.price = query.GetFieldData(block.GetBlockName(), "price", i).TrimEnd('?'); // char 12 block.sign = query.GetFieldData(block.GetBlockName(), "sign", i).FirstOrDefault(); // char 1 block.change = query.GetFieldData(block.GetBlockName(), "change", i).TrimEnd('?'); // char 12 block.rate = query.GetFieldData(block.GetBlockName(), "rate", i).ParseFloat("rate"); // float 5.2 block.volume = query.GetFieldData(block.GetBlockName(), "volume", i).TrimEnd('?'); // char 12 block.value = query.GetFieldData(block.GetBlockName(), "value", i).TrimEnd('?'); // char 12 block.mkt_gb = query.GetFieldData(block.GetBlockName(), "mkt_gb", 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 XQt1981OutBlock1[] Get(char mkt_gb = default) { using (XQt1981 instance = new XQt1981()) { instance.SetFieldData(XQt1981InBlock.BlockName, XQt1981InBlock.F.mkt_gb, 0, mkt_gb.ToString()); // char 1 if (instance.Request() < 0) { return(null); } var outBlock = instance.GetBlock1s(); return(outBlock); } }
public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, char mkt_gb = default */) { using (XQt1981 instance = new XQt1981()) { XQAllOutBlocks results = new XQAllOutBlocks(); string tableName = (tableNamePostfix == null) ? "XQt1981OutBlock" : $"XQt1981OutBlock_{tableNamePostfix}"; QueryOption qo = new QueryOption(tableName); results.OutBlock = instance.Select <XQt1981OutBlock>(qo); tableName = (tableNamePostfix == null) ? "XQt1981OutBlock1" : $"XQt1981OutBlock1_{tableNamePostfix}"; qo = new QueryOption(tableName); results.OutBlock1 = instance.SelectMany <XQt1981OutBlock1>(qo); return(results); } }
public static XQt1981OutBlock FromQuery(XQt1981 query) { XQt1981OutBlock block = new XQt1981OutBlock(); block.IsValidData = true; block.InvalidReason = ""; if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { block.IsValidData = false; block.InvalidReason = query.ReceiveMessage; return(block); } try { block.ksp_cnt = query.GetFieldData(block.GetBlockName(), "ksp_cnt", 0).TrimEnd('?'); // char 4 block.ksd_cnt = query.GetFieldData(block.GetBlockName(), "ksd_cnt", 0).TrimEnd('?'); // char 4 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }
public static XQAllOutBlocks Get(char mkt_gb = default) { using (XQt1981 instance = new XQt1981()) { instance.SetFieldData(XQt1981InBlock.BlockName, XQt1981InBlock.F.mkt_gb, 0, mkt_gb.ToString()); // char 1 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); } }