public static XQt9905OutBlock1[] ListFromQuery(XQt9905 query) { int count = query.GetBlockCount(XQt9905OutBlock1.BlockName); List <XQt9905OutBlock1> list = new List <XQt9905OutBlock1>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt9905OutBlock1 block = new XQt9905OutBlock1(); block.IsValidData = true; block.InvalidReason = ""; try { block.shcode = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?'); // char 6 block.expcode = query.GetFieldData(block.GetBlockName(), "expcode", i).TrimEnd('?'); // char 12 block.hname = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?'); // char 20 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }
public static XQt9905OutBlock1[] ReadFromDB(string tableNamePostfix = null /*, char dummy = default */) { using (XQt9905 instance = new XQt9905()) { string tableName = (tableNamePostfix == null) ? "XQt9905OutBlock1" : $"XQt9905OutBlock1_{tableNamePostfix}"; QueryOption qo = new QueryOption(tableName); // if (dummy != default) qo.Add("dummy", dummy); var outBlock = instance.SelectMany <XQt9905OutBlock1>(qo); return(outBlock); } }
public static XQt9905OutBlock1[] Get(char dummy = default) { using (XQt9905 instance = new XQt9905()) { instance.SetFieldData(XQt9905InBlock.BlockName, XQt9905InBlock.F.dummy, 0, dummy.ToString()); // char 1 if (instance.Request() < 0) { return(null); } var outBlock = instance.GetBlock1s(); return(outBlock); } }