public static XQt2805OutBlock FromQuery(XQt2805 query) { XQt2805OutBlock block = new XQt2805OutBlock(); block.IsValidData = true; block.InvalidReason = ""; if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { block.IsValidData = false; block.InvalidReason = query.ReceiveMessage; return(block); } try { block.date = query.GetFieldData(block.GetBlockName(), "date", 0).TrimEnd('?'); // char 8 block.cts_code = query.GetFieldData(block.GetBlockName(), "cts_code", 0).TrimEnd('?'); // char 8 block.lastdate = query.GetFieldData(block.GetBlockName(), "lastdate", 0).TrimEnd('?'); // char 8 block.nowfutyn = query.GetFieldData(block.GetBlockName(), "nowfutyn", 0).FirstOrDefault(); // char 1 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }
public XQt2805OutBlock GetBlock() { XQt2805OutBlock instance = XQt2805OutBlock.FromQuery(this); return(instance); }