public static XQt1617OutBlock1[] ListFromQuery(XQt1617 query) { int count = query.GetBlockCount(XQt1617OutBlock1.BlockName); List <XQt1617OutBlock1> list = new List <XQt1617OutBlock1>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt1617OutBlock1 block = new XQt1617OutBlock1(); block.IsValidData = true; block.InvalidReason = ""; try { block.date = query.GetFieldData(block.GetBlockName(), "date", i).TrimEnd('?'); // char 8 block.time = query.GetFieldData(block.GetBlockName(), "time", i).TrimEnd('?'); // char 8 block.sv_08 = query.GetFieldData(block.GetBlockName(), "sv_08", i).ParseLong("sv_08"); // long 12 block.sv_17 = query.GetFieldData(block.GetBlockName(), "sv_17", i).ParseLong("sv_17"); // long 12 block.sv_18 = query.GetFieldData(block.GetBlockName(), "sv_18", i).ParseLong("sv_18"); // long 12 block.sv_01 = query.GetFieldData(block.GetBlockName(), "sv_01", i).ParseLong("sv_01"); // long 12 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } list.Add(block); } return(list.ToArray()); }
public static XQAllOutBlocks Get(char gubun1 = default, char gubun2 = default, char gubun3 = default, string cts_date = default, string cts_time = default) { using (XQt1617 instance = new XQt1617()) { instance.SetFieldData(XQt1617InBlock.BlockName, XQt1617InBlock.F.gubun1, 0, gubun1.ToString()); // char 1 instance.SetFieldData(XQt1617InBlock.BlockName, XQt1617InBlock.F.gubun2, 0, gubun2.ToString()); // char 1 instance.SetFieldData(XQt1617InBlock.BlockName, XQt1617InBlock.F.gubun3, 0, gubun3.ToString()); // char 1 instance.SetFieldData(XQt1617InBlock.BlockName, XQt1617InBlock.F.cts_date, 0, cts_date); // char 8 instance.SetFieldData(XQt1617InBlock.BlockName, XQt1617InBlock.F.cts_time, 0, cts_time); // char 8 if (instance.Request() < 0) { return(null); } XQAllOutBlocks results = new XQAllOutBlocks(); results.OutBlock = instance.GetBlock(); if (results.OutBlock.IsValidData == false) { return(null); } results.OutBlock1 = instance.GetBlock1s(); return(results); } }
public static XQt1617OutBlock FromQuery(XQt1617 query) { XQt1617OutBlock block = new XQt1617OutBlock(); block.IsValidData = true; block.InvalidReason = ""; if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { block.IsValidData = false; block.InvalidReason = query.ReceiveMessage; return(block); } try { block.cts_date = query.GetFieldData(block.GetBlockName(), "cts_date", 0).TrimEnd('?'); // char 8 block.cts_time = query.GetFieldData(block.GetBlockName(), "cts_time", 0).TrimEnd('?'); // char 8 block.ms_08 = query.GetFieldData(block.GetBlockName(), "ms_08", 0).ParseLong("ms_08"); // long 12 block.md_08 = query.GetFieldData(block.GetBlockName(), "md_08", 0).ParseLong("md_08"); // long 12 block.sv_08 = query.GetFieldData(block.GetBlockName(), "sv_08", 0).ParseLong("sv_08"); // long 12 block.ms_17 = query.GetFieldData(block.GetBlockName(), "ms_17", 0).ParseLong("ms_17"); // long 12 block.md_17 = query.GetFieldData(block.GetBlockName(), "md_17", 0).ParseLong("md_17"); // long 12 block.sv_17 = query.GetFieldData(block.GetBlockName(), "sv_17", 0).ParseLong("sv_17"); // long 12 block.ms_18 = query.GetFieldData(block.GetBlockName(), "ms_18", 0).ParseLong("ms_18"); // long 12 block.md_18 = query.GetFieldData(block.GetBlockName(), "md_18", 0).ParseLong("md_18"); // long 12 block.sv_18 = query.GetFieldData(block.GetBlockName(), "sv_18", 0).ParseLong("sv_18"); // long 12 block.ms_01 = query.GetFieldData(block.GetBlockName(), "ms_01", 0).ParseLong("ms_01"); // long 12 block.md_01 = query.GetFieldData(block.GetBlockName(), "md_01", 0).ParseLong("md_01"); // long 12 block.sv_01 = query.GetFieldData(block.GetBlockName(), "sv_01", 0).ParseLong("sv_01"); // long 12 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }
public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, char gubun1 = default,char gubun2 = default,char gubun3 = default,string cts_date = default,string cts_time = default */) { using (XQt1617 instance = new XQt1617()) { XQAllOutBlocks results = new XQAllOutBlocks(); string tableName = (tableNamePostfix == null) ? "XQt1617OutBlock" : $"XQt1617OutBlock_{tableNamePostfix}"; QueryOption qo = new QueryOption(tableName); results.OutBlock = instance.Select <XQt1617OutBlock>(qo); tableName = (tableNamePostfix == null) ? "XQt1617OutBlock1" : $"XQt1617OutBlock1_{tableNamePostfix}"; qo = new QueryOption(tableName); results.OutBlock1 = instance.SelectMany <XQt1617OutBlock1>(qo); return(results); } }