public static XQAllOutBlocks Get(string shcode = default, long cvolume = default, string starttime = default, string endtime = default, string cts_time = default) { using (XQt1301 instance = new XQt1301()) { instance.SetFieldData(XQt1301InBlock.BlockName, XQt1301InBlock.F.shcode, 0, shcode); // char 6 instance.SetFieldData(XQt1301InBlock.BlockName, XQt1301InBlock.F.cvolume, 0, cvolume.ToString("d12")); // long 12 instance.SetFieldData(XQt1301InBlock.BlockName, XQt1301InBlock.F.starttime, 0, starttime); // char 4 instance.SetFieldData(XQt1301InBlock.BlockName, XQt1301InBlock.F.endtime, 0, endtime); // char 4 instance.SetFieldData(XQt1301InBlock.BlockName, XQt1301InBlock.F.cts_time, 0, cts_time); // char 10 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 /*, string shcode = default,long cvolume = default,string starttime = default,string endtime = default,string cts_time = default */) { using (XQt1301 instance = new XQt1301()) { XQAllOutBlocks results = new XQAllOutBlocks(); string tableName = (tableNamePostfix == null) ? "XQt1301OutBlock" : $"XQt1301OutBlock_{tableNamePostfix}"; QueryOption qo = new QueryOption(tableName); results.OutBlock = instance.Select <XQt1301OutBlock>(qo); tableName = (tableNamePostfix == null) ? "XQt1301OutBlock1" : $"XQt1301OutBlock1_{tableNamePostfix}"; qo = new QueryOption(tableName); results.OutBlock1 = instance.SelectMany <XQt1301OutBlock1>(qo); return(results); } }
public static XQt1301OutBlock1[] Get(string shcode = default, long cvolume = default, string starttime = default, string endtime = default, string cts_time = default) { using (XQt1301 instance = new XQt1301()) { instance.SetFieldData(XQt1301InBlock.BlockName, XQt1301InBlock.F.shcode, 0, shcode); // char 6 instance.SetFieldData(XQt1301InBlock.BlockName, XQt1301InBlock.F.cvolume, 0, cvolume.ToString("d12")); // long 12 instance.SetFieldData(XQt1301InBlock.BlockName, XQt1301InBlock.F.starttime, 0, starttime); // char 4 instance.SetFieldData(XQt1301InBlock.BlockName, XQt1301InBlock.F.endtime, 0, endtime); // char 4 instance.SetFieldData(XQt1301InBlock.BlockName, XQt1301InBlock.F.cts_time, 0, cts_time); // char 10 if (instance.Request() < 0) { return(null); } var outBlock = instance.GetBlock1s(); return(outBlock); } }
public static XQt1301OutBlock FromQuery(XQt1301 query) { XQt1301OutBlock block = new XQt1301OutBlock(); 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_time = query.GetFieldData(block.GetBlockName(), "cts_time", 0).TrimEnd('?'); // char 10 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }
public static XQt1301OutBlock1[] ListFromQuery(XQt1301 query) { int count = query.GetBlockCount(XQt1301OutBlock1.BlockName); List <XQt1301OutBlock1> list = new List <XQt1301OutBlock1>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt1301OutBlock1 block = new XQt1301OutBlock1(); block.IsValidData = true; block.InvalidReason = ""; try { block.chetime = query.GetFieldData(block.GetBlockName(), "chetime", i).TrimEnd('?'); // char 10 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.cvolume = query.GetFieldData(block.GetBlockName(), "cvolume", i).ParseLong("cvolume"); // long 12 block.chdegree = query.GetFieldData(block.GetBlockName(), "chdegree", i).ParseFloat("chdegree"); // float 8.2 block.volume = query.GetFieldData(block.GetBlockName(), "volume", i).ParseLong("volume"); // long 12 block.mdvolume = query.GetFieldData(block.GetBlockName(), "mdvolume", i).ParseLong("mdvolume"); // long 12 block.mdchecnt = query.GetFieldData(block.GetBlockName(), "mdchecnt", i).ParseLong("mdchecnt"); // long 8 block.msvolume = query.GetFieldData(block.GetBlockName(), "msvolume", i).ParseLong("msvolume"); // long 12 block.mschecnt = query.GetFieldData(block.GetBlockName(), "mschecnt", i).ParseLong("mschecnt"); // long 8 block.revolume = query.GetFieldData(block.GetBlockName(), "revolume", i).ParseLong("revolume"); // long 12 block.rechecnt = query.GetFieldData(block.GetBlockName(), "rechecnt", i).ParseLong("rechecnt"); // long 8 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }