public static XQt8434OutBlock1[] ListFromQuery(XQt8434 query) { int count = query.GetBlockCount(XQt8434OutBlock1.BlockName); List <XQt8434OutBlock1> list = new List <XQt8434OutBlock1>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt8434OutBlock1 block = new XQt8434OutBlock1(); block.IsValidData = true; block.InvalidReason = ""; try { block.hname = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?'); // char 20 block.price = query.GetFieldData(block.GetBlockName(), "price", i).ParseFloat("price"); // float 6.2 block.sign = query.GetFieldData(block.GetBlockName(), "sign", i).FirstOrDefault(); // char 1 block.change = query.GetFieldData(block.GetBlockName(), "change", i).ParseFloat("change"); // float 6.2 block.diff = query.GetFieldData(block.GetBlockName(), "diff", i).ParseFloat("diff"); // float 6.2 block.volume = query.GetFieldData(block.GetBlockName(), "volume", i).ParseLong("volume"); // long 12 block.checnt = query.GetFieldData(block.GetBlockName(), "checnt", i).ParseLong("checnt"); // long 8 block.focode = query.GetFieldData(block.GetBlockName(), "focode", i).TrimEnd('?'); // char 8 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }
public static XQt8434OutBlock1[] ReadFromDB(string tableNamePostfix = null /*, long qrycnt = default,string focode = default */) { using (XQt8434 instance = new XQt8434()) { string tableName = (tableNamePostfix == null) ? "XQt8434OutBlock1" : $"XQt8434OutBlock1_{tableNamePostfix}"; QueryOption qo = new QueryOption(tableName); // if (qrycnt != default) qo.Add("qrycnt", qrycnt); // if (focode != default) qo.Add("focode", focode); var outBlock = instance.SelectMany <XQt8434OutBlock1>(qo); return(outBlock); } }
public static XQt8434OutBlock1[] Get(long qrycnt = default, string focode = default) { using (XQt8434 instance = new XQt8434()) { instance.SetFieldData(XQt8434InBlock.BlockName, XQt8434InBlock.F.qrycnt, 0, qrycnt.ToString("d3")); // long 3 instance.SetFieldData(XQt8434InBlock.BlockName, XQt8434InBlock.F.focode, 0, focode); // char 400 if (instance.Request() < 0) { return(null); } var outBlock = instance.GetBlock1s(); return(outBlock); } }