public static XQt3202OutBlock[] ListFromQuery(XQt3202 query) { int count = query.GetBlockCount(XQt3202OutBlock.BlockName); List <XQt3202OutBlock> list = new List <XQt3202OutBlock>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt3202OutBlock block = new XQt3202OutBlock(); block.IsValidData = true; block.InvalidReason = ""; try { block.recdt = query.GetFieldData(block.GetBlockName(), "recdt", i).TrimEnd('?'); // char 8 block.tableid = query.GetFieldData(block.GetBlockName(), "tableid", i).TrimEnd('?'); // char 6 block.upgu = query.GetFieldData(block.GetBlockName(), "upgu", i).TrimEnd('?'); // char 2 block.custno = query.GetFieldData(block.GetBlockName(), "custno", i).TrimEnd('?'); // char 5 block.custnm = query.GetFieldData(block.GetBlockName(), "custnm", i).TrimEnd('?'); // char 80 block.shcode = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?'); // char 6 block.upnm = query.GetFieldData(block.GetBlockName(), "upnm", 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 XQt3202OutBlock[] ReadFromDB(string tableNamePostfix = null /*, string shcode = default,string date = default */) { using (XQt3202 instance = new XQt3202()) { string tableName = (tableNamePostfix == null) ? "XQt3202OutBlock" : $"XQt3202OutBlock_{tableNamePostfix}"; QueryOption qo = new QueryOption(tableName); // if (shcode != default) qo.Add("shcode", shcode); // if (date != default) qo.Add("date", date); var outBlock = instance.SelectMany <XQt3202OutBlock>(qo); return(outBlock); } }
public static XQt3202OutBlock[] Get(string shcode = default, string date = default) { using (XQt3202 instance = new XQt3202()) { instance.SetFieldData(XQt3202InBlock.BlockName, XQt3202InBlock.F.shcode, 0, shcode); // char 6 instance.SetFieldData(XQt3202InBlock.BlockName, XQt3202InBlock.F.date, 0, date); // char 8 if (instance.Request() < 0) { return(null); } var outBlock = instance.GetBlocks(); return(outBlock); } }