public static XQt8407OutBlock1[] ReadFromDB(string tableNamePostfix = null /*, long nrec = default,string shcode = default */) { using (XQt8407 instance = new XQt8407()) { string tableName = (tableNamePostfix == null) ? "XQt8407OutBlock1" : $"XQt8407OutBlock1_{tableNamePostfix}"; QueryOption qo = new QueryOption(tableName); // if (nrec != default) qo.Add("nrec", nrec); // if (shcode != default) qo.Add("shcode", shcode); var outBlock = instance.SelectMany <XQt8407OutBlock1>(qo); return(outBlock); } }
public static XQt8407OutBlock1[] Get(long nrec = default, string shcode = default) { using (XQt8407 instance = new XQt8407()) { instance.SetFieldData(XQt8407InBlock.BlockName, XQt8407InBlock.F.nrec, 0, nrec.ToString("d3")); // long 3 instance.SetFieldData(XQt8407InBlock.BlockName, XQt8407InBlock.F.shcode, 0, shcode); // char 300 if (instance.Request() < 0) { return(null); } var outBlock = instance.GetBlock1s(); return(outBlock); } }
public static XQt8407OutBlock1[] ListFromQuery(XQt8407 query) { int count = query.GetBlockCount(XQt8407OutBlock1.BlockName); List <XQt8407OutBlock1> list = new List <XQt8407OutBlock1>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt8407OutBlock1 block = new XQt8407OutBlock1(); block.IsValidData = true; block.InvalidReason = ""; try { block.shcode = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?'); // char 6 block.hname = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?'); // char 40 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.volume = query.GetFieldData(block.GetBlockName(), "volume", i).ParseLong("volume"); // long 12 block.offerho = query.GetFieldData(block.GetBlockName(), "offerho", i).ParseLong("offerho"); // long 8 block.bidho = query.GetFieldData(block.GetBlockName(), "bidho", i).ParseLong("bidho"); // long 8 block.cvolume = query.GetFieldData(block.GetBlockName(), "cvolume", i).ParseLong("cvolume"); // long 8 block.chdegree = query.GetFieldData(block.GetBlockName(), "chdegree", i).ParseFloat("chdegree"); // float 9.2 block.open = query.GetFieldData(block.GetBlockName(), "open", i).ParseLong("open"); // long 8 block.high = query.GetFieldData(block.GetBlockName(), "high", i).ParseLong("high"); // long 8 block.low = query.GetFieldData(block.GetBlockName(), "low", i).ParseLong("low"); // long 8 block.value = query.GetFieldData(block.GetBlockName(), "value", i).ParseLong("value"); // long 12 block.offerrem = query.GetFieldData(block.GetBlockName(), "offerrem", i).ParseLong("offerrem"); // long 12 block.bidrem = query.GetFieldData(block.GetBlockName(), "bidrem", i).ParseLong("bidrem"); // long 12 block.totofferrem = query.GetFieldData(block.GetBlockName(), "totofferrem", i).ParseLong("totofferrem"); // long 12 block.totbidrem = query.GetFieldData(block.GetBlockName(), "totbidrem", i).ParseLong("totbidrem"); // long 12 block.jnilclose = query.GetFieldData(block.GetBlockName(), "jnilclose", i).ParseLong("jnilclose"); // long 8 block.uplmtprice = query.GetFieldData(block.GetBlockName(), "uplmtprice", i).ParseLong("uplmtprice"); // long 8 block.dnlmtprice = query.GetFieldData(block.GetBlockName(), "dnlmtprice", i).ParseLong("dnlmtprice"); // long 8 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }