public static XREH0OutBlock FromQuery(XREH0 query) { XREH0OutBlock block = new XREH0OutBlock(); block.IsValidData = true; block.InvalidReason = ""; try { block.hotime = query.GetFieldData(block.GetBlockName(), "hotime").TrimEnd('?'); // char 6 block.hotime1 = query.GetFieldData(block.GetBlockName(), "hotime1").TrimEnd('?'); // char 6 block.offerho1 = query.GetFieldData(block.GetBlockName(), "offerho1").ParseDouble("offerho1"); // double 6.2 block.bidho1 = query.GetFieldData(block.GetBlockName(), "bidho1").ParseDouble("bidho1"); // double 6.2 block.offerrem1 = query.GetFieldData(block.GetBlockName(), "offerrem1").ParseLong("offerrem1"); // long 7 block.bidrem1 = query.GetFieldData(block.GetBlockName(), "bidrem1").ParseLong("bidrem1"); // long 7 block.offercnt1 = query.GetFieldData(block.GetBlockName(), "offercnt1").ParseLong("offercnt1"); // long 5 block.bidcnt1 = query.GetFieldData(block.GetBlockName(), "bidcnt1").ParseLong("bidcnt1"); // long 5 block.offerho2 = query.GetFieldData(block.GetBlockName(), "offerho2").ParseDouble("offerho2"); // double 6.2 block.bidho2 = query.GetFieldData(block.GetBlockName(), "bidho2").ParseDouble("bidho2"); // double 6.2 block.offerrem2 = query.GetFieldData(block.GetBlockName(), "offerrem2").ParseLong("offerrem2"); // long 7 block.bidrem2 = query.GetFieldData(block.GetBlockName(), "bidrem2").ParseLong("bidrem2"); // long 7 block.offercnt2 = query.GetFieldData(block.GetBlockName(), "offercnt2").ParseLong("offercnt2"); // long 5 block.bidcnt2 = query.GetFieldData(block.GetBlockName(), "bidcnt2").ParseLong("bidcnt2"); // long 5 block.offerho3 = query.GetFieldData(block.GetBlockName(), "offerho3").ParseDouble("offerho3"); // double 6.2 block.bidho3 = query.GetFieldData(block.GetBlockName(), "bidho3").ParseDouble("bidho3"); // double 6.2 block.offerrem3 = query.GetFieldData(block.GetBlockName(), "offerrem3").ParseLong("offerrem3"); // long 7 block.bidrem3 = query.GetFieldData(block.GetBlockName(), "bidrem3").ParseLong("bidrem3"); // long 7 block.offercnt3 = query.GetFieldData(block.GetBlockName(), "offercnt3").ParseLong("offercnt3"); // long 5 block.bidcnt3 = query.GetFieldData(block.GetBlockName(), "bidcnt3").ParseLong("bidcnt3"); // long 5 block.offerho4 = query.GetFieldData(block.GetBlockName(), "offerho4").ParseDouble("offerho4"); // double 6.2 block.bidho4 = query.GetFieldData(block.GetBlockName(), "bidho4").ParseDouble("bidho4"); // double 6.2 block.offerrem4 = query.GetFieldData(block.GetBlockName(), "offerrem4").ParseLong("offerrem4"); // long 7 block.bidrem4 = query.GetFieldData(block.GetBlockName(), "bidrem4").ParseLong("bidrem4"); // long 7 block.offercnt4 = query.GetFieldData(block.GetBlockName(), "offercnt4").ParseLong("offercnt4"); // long 5 block.bidcnt4 = query.GetFieldData(block.GetBlockName(), "bidcnt4").ParseLong("bidcnt4"); // long 5 block.offerho5 = query.GetFieldData(block.GetBlockName(), "offerho5").ParseDouble("offerho5"); // double 6.2 block.bidho5 = query.GetFieldData(block.GetBlockName(), "bidho5").ParseDouble("bidho5"); // double 6.2 block.offerrem5 = query.GetFieldData(block.GetBlockName(), "offerrem5").ParseLong("offerrem5"); // long 7 block.bidrem5 = query.GetFieldData(block.GetBlockName(), "bidrem5").ParseLong("bidrem5"); // long 7 block.offercnt5 = query.GetFieldData(block.GetBlockName(), "offercnt5").ParseLong("offercnt5"); // long 5 block.bidcnt5 = query.GetFieldData(block.GetBlockName(), "bidcnt5").ParseLong("bidcnt5"); // long 5 block.totofferrem = query.GetFieldData(block.GetBlockName(), "totofferrem").ParseLong("totofferrem"); // long 7 block.totbidrem = query.GetFieldData(block.GetBlockName(), "totbidrem").ParseLong("totbidrem"); // long 7 block.totoffercnt = query.GetFieldData(block.GetBlockName(), "totoffercnt").ParseLong("totoffercnt"); // long 5 block.totbidcnt = query.GetFieldData(block.GetBlockName(), "totbidcnt").ParseLong("totbidcnt"); // long 5 block.optcode = query.GetFieldData(block.GetBlockName(), "optcode").TrimEnd('?'); // char 8 block.danhochk = query.GetFieldData(block.GetBlockName(), "danhochk").FirstOrDefault(); // char 1 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }
public XREH0OutBlock GetBlock() { XREH0OutBlock instance = XREH0OutBlock.FromQuery(this); return(instance); }