public static XQt0151OutBlock1[] ListFromQuery(XQt0151 query) { int count = query.GetBlockCount(XQt0151OutBlock1.BlockName); List <XQt0151OutBlock1> list = new List <XQt0151OutBlock1>(); if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { return(list.ToArray()); } for (int i = 0; i < count; i++) { XQt0151OutBlock1 block = new XQt0151OutBlock1(); block.IsValidData = true; block.InvalidReason = ""; try { block.medosu = query.GetFieldData(block.GetBlockName(), "medosu", i).TrimEnd('?'); // char 10 block.expcode = query.GetFieldData(block.GetBlockName(), "expcode", i).TrimEnd('?'); // char 12 block.qty = query.GetFieldData(block.GetBlockName(), "qty", i).ParseLong("qty"); // long 9 block.price = query.GetFieldData(block.GetBlockName(), "price", i).ParseLong("price"); // long 9 block.amt = query.GetFieldData(block.GetBlockName(), "amt", i).ParseLong("amt"); // long 18 block.fee = query.GetFieldData(block.GetBlockName(), "fee", i).ParseLong("fee"); // long 18 block.tax = query.GetFieldData(block.GetBlockName(), "tax", i).ParseLong("tax"); // long 18 block.argtax = query.GetFieldData(block.GetBlockName(), "argtax", i).ParseLong("argtax"); // long 18 block.adjamt = query.GetFieldData(block.GetBlockName(), "adjamt", i).ParseLong("adjamt"); // long 18 block.middiv = query.GetFieldData(block.GetBlockName(), "middiv", 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 XQt0151OutBlock FromQuery(XQt0151 query) { XQt0151OutBlock block = new XQt0151OutBlock(); block.IsValidData = true; block.InvalidReason = ""; if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { block.IsValidData = false; block.InvalidReason = query.ReceiveMessage; return(block); } try { block.mdqty = query.GetFieldData(block.GetBlockName(), "mdqty", 0).ParseLong("mdqty"); // long 9 block.mdamt = query.GetFieldData(block.GetBlockName(), "mdamt", 0).ParseLong("mdamt"); // long 18 block.mdfee = query.GetFieldData(block.GetBlockName(), "mdfee", 0).ParseLong("mdfee"); // long 18 block.mdtax = query.GetFieldData(block.GetBlockName(), "mdtax", 0).ParseLong("mdtax"); // long 18 block.mdargtax = query.GetFieldData(block.GetBlockName(), "mdargtax", 0).ParseLong("mdargtax"); // long 18 block.tmdtax = query.GetFieldData(block.GetBlockName(), "tmdtax", 0).ParseLong("tmdtax"); // long 18 block.mdadjamt = query.GetFieldData(block.GetBlockName(), "mdadjamt", 0).ParseLong("mdadjamt"); // long 18 block.msqty = query.GetFieldData(block.GetBlockName(), "msqty", 0).ParseLong("msqty"); // long 9 block.msamt = query.GetFieldData(block.GetBlockName(), "msamt", 0).ParseLong("msamt"); // long 18 block.msfee = query.GetFieldData(block.GetBlockName(), "msfee", 0).ParseLong("msfee"); // long 18 block.tmstax = query.GetFieldData(block.GetBlockName(), "tmstax", 0).ParseLong("tmstax"); // long 18 block.msadjamt = query.GetFieldData(block.GetBlockName(), "msadjamt", 0).ParseLong("msadjamt"); // long 18 block.tqty = query.GetFieldData(block.GetBlockName(), "tqty", 0).ParseLong("tqty"); // long 9 block.tamt = query.GetFieldData(block.GetBlockName(), "tamt", 0).ParseLong("tamt"); // long 18 block.tfee = query.GetFieldData(block.GetBlockName(), "tfee", 0).ParseLong("tfee"); // long 18 block.tottax = query.GetFieldData(block.GetBlockName(), "tottax", 0).ParseLong("tottax"); // long 18 block.targtax = query.GetFieldData(block.GetBlockName(), "targtax", 0).ParseLong("targtax"); // long 18 block.ttax = query.GetFieldData(block.GetBlockName(), "ttax", 0).ParseLong("ttax"); // long 18 block.tadjamt = query.GetFieldData(block.GetBlockName(), "tadjamt", 0).ParseLong("tadjamt"); // long 18 block.cts_medosu = query.GetFieldData(block.GetBlockName(), "cts_medosu", 0).FirstOrDefault(); // char 1 block.cts_expcode = query.GetFieldData(block.GetBlockName(), "cts_expcode", 0).TrimEnd('?'); // char 12 block.cts_price = query.GetFieldData(block.GetBlockName(), "cts_price", 0).TrimEnd('?'); // char 9 block.cts_middiv = query.GetFieldData(block.GetBlockName(), "cts_middiv", 0).TrimEnd('?'); // char 2 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }