public static XQt1449OutBlock FromQuery(XQt1449 query) { XQt1449OutBlock block = new XQt1449OutBlock(); block.IsValidData = true; block.InvalidReason = ""; if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { block.IsValidData = false; block.InvalidReason = query.ReceiveMessage; return(block); } try { 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.msvolume = query.GetFieldData(block.GetBlockName(), "msvolume", 0).ParseLong("msvolume"); // long 12 block.mdvolume = query.GetFieldData(block.GetBlockName(), "mdvolume", 0).ParseLong("mdvolume"); // long 12 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }
public static XQt1449OutBlock1[] ListFromQuery(XQt1449 query) { int count = query.GetBlockCount(XQt1449OutBlock1.BlockName); List <XQt1449OutBlock1> list = new List <XQt1449OutBlock1>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt1449OutBlock1 block = new XQt1449OutBlock1(); block.IsValidData = true; block.InvalidReason = ""; try { 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.tickdiff = query.GetFieldData(block.GetBlockName(), "tickdiff", i).ParseFloat("tickdiff"); // float 6.2 block.cvolume = query.GetFieldData(block.GetBlockName(), "cvolume", i).ParseLong("cvolume"); // long 12 block.diff = query.GetFieldData(block.GetBlockName(), "diff", i).ParseFloat("diff"); // float 6.2 block.mdvolume = query.GetFieldData(block.GetBlockName(), "mdvolume", i).ParseLong("mdvolume"); // long 12 block.msvolume = query.GetFieldData(block.GetBlockName(), "msvolume", i).ParseLong("msvolume"); // long 12 block.msdiff = query.GetFieldData(block.GetBlockName(), "msdiff", i).ParseFloat("msdiff"); // float 6.2 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }
public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string shcode = default,char dategb = default */) { using (XQt1449 instance = new XQt1449()) { XQAllOutBlocks results = new XQAllOutBlocks(); string tableName = (tableNamePostfix == null) ? "XQt1449OutBlock" : $"XQt1449OutBlock_{tableNamePostfix}"; QueryOption qo = new QueryOption(tableName); results.OutBlock = instance.Select <XQt1449OutBlock>(qo); tableName = (tableNamePostfix == null) ? "XQt1449OutBlock1" : $"XQt1449OutBlock1_{tableNamePostfix}"; qo = new QueryOption(tableName); results.OutBlock1 = instance.SelectMany <XQt1449OutBlock1>(qo); return(results); } }
public static XQt1449OutBlock1[] Get(string shcode = default, char dategb = default) { using (XQt1449 instance = new XQt1449()) { instance.SetFieldData(XQt1449InBlock.BlockName, XQt1449InBlock.F.shcode, 0, shcode); // char 6 instance.SetFieldData(XQt1449InBlock.BlockName, XQt1449InBlock.F.dategb, 0, dategb.ToString()); // char 1 if (instance.Request() < 0) { return(null); } var outBlock = instance.GetBlock1s(); return(outBlock); } }
public static XQAllOutBlocks Get(string shcode = default, char dategb = default) { using (XQt1449 instance = new XQt1449()) { instance.SetFieldData(XQt1449InBlock.BlockName, XQt1449InBlock.F.shcode, 0, shcode); // char 6 instance.SetFieldData(XQt1449InBlock.BlockName, XQt1449InBlock.F.dategb, 0, dategb.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); } }