public static XQAllOutBlocks Get(long indexid = default, string indexname = default, string indexparam = default, char market = default, char period = default, string shcode = default, long qrycnt = default, long ncnt = default, string sdate = default, string edate = default, char Isamend = default, char Isgab = default, char IsReal = default) { using (XQCHARTINDEX instance = new XQCHARTINDEX()) { instance.SetFieldData(XQChartIndexInBlock.BlockName, XQChartIndexInBlock.F.indexid, 0, indexid.ToString("d10")); // long 10 instance.SetFieldData(XQChartIndexInBlock.BlockName, XQChartIndexInBlock.F.indexname, 0, indexname); // char 40 instance.SetFieldData(XQChartIndexInBlock.BlockName, XQChartIndexInBlock.F.indexparam, 0, indexparam); // char 40 instance.SetFieldData(XQChartIndexInBlock.BlockName, XQChartIndexInBlock.F.market, 0, market.ToString()); // char 1 instance.SetFieldData(XQChartIndexInBlock.BlockName, XQChartIndexInBlock.F.period, 0, period.ToString()); // char 1 instance.SetFieldData(XQChartIndexInBlock.BlockName, XQChartIndexInBlock.F.shcode, 0, shcode); // char 8 instance.SetFieldData(XQChartIndexInBlock.BlockName, XQChartIndexInBlock.F.qrycnt, 0, qrycnt.ToString("d4")); // long 4 instance.SetFieldData(XQChartIndexInBlock.BlockName, XQChartIndexInBlock.F.ncnt, 0, ncnt.ToString("d4")); // long 4 instance.SetFieldData(XQChartIndexInBlock.BlockName, XQChartIndexInBlock.F.sdate, 0, sdate); // char 8 instance.SetFieldData(XQChartIndexInBlock.BlockName, XQChartIndexInBlock.F.edate, 0, edate); // char 8 instance.SetFieldData(XQChartIndexInBlock.BlockName, XQChartIndexInBlock.F.Isamend, 0, Isamend.ToString()); // char 1 instance.SetFieldData(XQChartIndexInBlock.BlockName, XQChartIndexInBlock.F.Isgab, 0, Isgab.ToString()); // char 1 instance.SetFieldData(XQChartIndexInBlock.BlockName, XQChartIndexInBlock.F.IsReal, 0, IsReal.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); } }
public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, long indexid = default,string indexname = default,string indexparam = default,char market = default,char period = default,string shcode = default,long qrycnt = default,long ncnt = default,string sdate = default,string edate = default,char Isamend = default,char Isgab = default,char IsReal = default */) { using (XQCHARTINDEX instance = new XQCHARTINDEX()) { XQAllOutBlocks results = new XQAllOutBlocks(); string tableName = (tableNamePostfix == null) ? "XQChartIndexOutBlock" : $"XQChartIndexOutBlock_{tableNamePostfix}"; QueryOption qo = new QueryOption(tableName); results.OutBlock = instance.Select <XQChartIndexOutBlock>(qo); tableName = (tableNamePostfix == null) ? "XQChartIndexOutBlock1" : $"XQChartIndexOutBlock1_{tableNamePostfix}"; qo = new QueryOption(tableName); results.OutBlock1 = instance.SelectMany <XQChartIndexOutBlock1>(qo); return(results); } }
public static XQChartIndexOutBlock FromQuery(XQCHARTINDEX query) { XQChartIndexOutBlock block = new XQChartIndexOutBlock(); block.IsValidData = true; block.InvalidReason = ""; if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { block.IsValidData = false; block.InvalidReason = query.ReceiveMessage; return(block); } try { block.indexid = query.GetFieldData(block.GetBlockName(), "indexid", 0).ParseLong("indexid"); // long 10 block.rec_cnt = query.GetFieldData(block.GetBlockName(), "rec_cnt", 0).ParseLong("rec_cnt"); // long 5 block.validdata_cnt = query.GetFieldData(block.GetBlockName(), "validdata_cnt", 0).ParseLong("validdata_cnt"); // long 2 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }
public static XQChartIndexOutBlock1[] ListFromQuery(XQCHARTINDEX query) { int count = query.GetBlockCount(XQChartIndexOutBlock1.BlockName); List <XQChartIndexOutBlock1> list = new List <XQChartIndexOutBlock1>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQChartIndexOutBlock1 block = new XQChartIndexOutBlock1(); block.IsValidData = true; block.InvalidReason = ""; try { block.date = query.GetFieldData(block.GetBlockName(), "date", i).TrimEnd('?'); // char 8 block.time = query.GetFieldData(block.GetBlockName(), "time", i).TrimEnd('?'); // char 6 block.open = query.GetFieldData(block.GetBlockName(), "open", i).ParseFloat("open"); // float 10 block.high = query.GetFieldData(block.GetBlockName(), "high", i).ParseFloat("high"); // float 10 block.low = query.GetFieldData(block.GetBlockName(), "low", i).ParseFloat("low"); // float 10 block.close = query.GetFieldData(block.GetBlockName(), "close", i).ParseFloat("close"); // float 10 block.volume = query.GetFieldData(block.GetBlockName(), "volume", i).ParseFloat("volume"); // float 12 block.value1 = query.GetFieldData(block.GetBlockName(), "value1", i).ParseFloat("value1"); // float 10 block.value2 = query.GetFieldData(block.GetBlockName(), "value2", i).ParseFloat("value2"); // float 10 block.value3 = query.GetFieldData(block.GetBlockName(), "value3", i).ParseFloat("value3"); // float 10 block.value4 = query.GetFieldData(block.GetBlockName(), "value4", i).ParseFloat("value4"); // float 10 block.value5 = query.GetFieldData(block.GetBlockName(), "value5", i).ParseFloat("value5"); // float 10 block.pos = query.GetFieldData(block.GetBlockName(), "pos", i).ParseLong("pos"); // long 8 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }