public static XQt2801OutBlock FromQuery(XQt2801 query) { XQt2801OutBlock block = new XQt2801OutBlock(); block.IsValidData = true; block.InvalidReason = ""; if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { block.IsValidData = false; block.InvalidReason = query.ReceiveMessage; return(block); } try { block.hname = query.GetFieldData(block.GetBlockName(), "hname", 0).TrimEnd('?'); // char 20 block.price = query.GetFieldData(block.GetBlockName(), "price", 0).ParseFloat("price"); // float 6.2 block.sign = query.GetFieldData(block.GetBlockName(), "sign", 0).FirstOrDefault(); // char 1 block.change = query.GetFieldData(block.GetBlockName(), "change", 0).ParseFloat("change"); // float 6.2 block.jnilclose = query.GetFieldData(block.GetBlockName(), "jnilclose", 0).ParseFloat("jnilclose"); // float 6.2 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.value = query.GetFieldData(block.GetBlockName(), "value", 0).ParseLong("value"); // long 12 block.mgjv = query.GetFieldData(block.GetBlockName(), "mgjv", 0).ParseLong("mgjv"); // long 8 block.mgjvdiff = query.GetFieldData(block.GetBlockName(), "mgjvdiff", 0).ParseLong("mgjvdiff"); // long 8 block.open = query.GetFieldData(block.GetBlockName(), "open", 0).ParseFloat("open"); // float 6.2 block.high = query.GetFieldData(block.GetBlockName(), "high", 0).ParseFloat("high"); // float 6.2 block.low = query.GetFieldData(block.GetBlockName(), "low", 0).ParseFloat("low"); // float 6.2 block.uplmtprice = query.GetFieldData(block.GetBlockName(), "uplmtprice", 0).ParseFloat("uplmtprice"); // float 6.2 block.dnlmtprice = query.GetFieldData(block.GetBlockName(), "dnlmtprice", 0).ParseFloat("dnlmtprice"); // float 6.2 block.high52w = query.GetFieldData(block.GetBlockName(), "high52w", 0).ParseFloat("high52w"); // float 6.2 block.low52w = query.GetFieldData(block.GetBlockName(), "low52w", 0).ParseFloat("low52w"); // float 6.2 block.basis = query.GetFieldData(block.GetBlockName(), "basis", 0).ParseFloat("basis"); // float 6.2 block.recprice = query.GetFieldData(block.GetBlockName(), "recprice", 0).ParseFloat("recprice"); // float 6.2 block.theoryprice = query.GetFieldData(block.GetBlockName(), "theoryprice", 0).ParseFloat("theoryprice"); // float 6.2 block.glyl = query.GetFieldData(block.GetBlockName(), "glyl", 0).ParseFloat("glyl"); // float 6.3 block.cbhprice = query.GetFieldData(block.GetBlockName(), "cbhprice", 0).ParseFloat("cbhprice"); // float 6.2 block.cblprice = query.GetFieldData(block.GetBlockName(), "cblprice", 0).ParseFloat("cblprice"); // float 6.2 block.lastmonth = query.GetFieldData(block.GetBlockName(), "lastmonth", 0).TrimEnd('?'); // char 8 block.jandatecnt = query.GetFieldData(block.GetBlockName(), "jandatecnt", 0).ParseLong("jandatecnt"); // long 8 block.pricejisu = query.GetFieldData(block.GetBlockName(), "pricejisu", 0).ParseFloat("pricejisu"); // float 6.2 block.jisusign = query.GetFieldData(block.GetBlockName(), "jisusign", 0).FirstOrDefault(); // char 1 block.jisuchange = query.GetFieldData(block.GetBlockName(), "jisuchange", 0).ParseFloat("jisuchange"); // float 6.2 block.jisudiff = query.GetFieldData(block.GetBlockName(), "jisudiff", 0).ParseFloat("jisudiff"); // float 6.2 block.kospijisu = query.GetFieldData(block.GetBlockName(), "kospijisu", 0).ParseFloat("kospijisu"); // float 6.2 block.kospisign = query.GetFieldData(block.GetBlockName(), "kospisign", 0).FirstOrDefault(); // char 1 block.kospichange = query.GetFieldData(block.GetBlockName(), "kospichange", 0).ParseFloat("kospichange"); // float 6.2 block.kospidiff = query.GetFieldData(block.GetBlockName(), "kospidiff", 0).ParseFloat("kospidiff"); // float 6.2 block.listhprice = query.GetFieldData(block.GetBlockName(), "listhprice", 0).ParseFloat("listhprice"); // float 6.2 block.listlprice = query.GetFieldData(block.GetBlockName(), "listlprice", 0).ParseFloat("listlprice"); // float 6.2 block.sbasis = query.GetFieldData(block.GetBlockName(), "sbasis", 0).ParseFloat("sbasis"); // float 6.2 block.ibasis = query.GetFieldData(block.GetBlockName(), "ibasis", 0).ParseFloat("ibasis"); // float 6.2 block.jnilvolume = query.GetFieldData(block.GetBlockName(), "jnilvolume", 0).ParseLong("jnilvolume"); // long 12 block.jnilvalue = query.GetFieldData(block.GetBlockName(), "jnilvalue", 0).ParseLong("jnilvalue"); // long 12 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }
public XQt2801OutBlock GetBlock() { XQt2801OutBlock instance = XQt2801OutBlock.FromQuery(this); return(instance); }