Exemple #1
0
        public static XQt2106OutBlock1[] ListFromQuery(XQt2106 query)
        {
            int count = query.GetBlockCount(XQt2106OutBlock1.BlockName);
            List <XQt2106OutBlock1> list = new List <XQt2106OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt2106OutBlock1 block = new XQt2106OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.indx = query.GetFieldData(block.GetBlockName(), "indx", i).FirstOrDefault();                 // char 1
                    block.gubn = query.GetFieldData(block.GetBlockName(), "gubn", i).FirstOrDefault();                 // char 1
                    block.vals = query.GetFieldData(block.GetBlockName(), "vals", i).TrimEnd('?');                     // char 8
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
Exemple #2
0
        public static XQt2106OutBlock FromQuery(XQt2106 query)
        {
            XQt2106OutBlock block = new XQt2106OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.nrec = query.GetFieldData(block.GetBlockName(), "nrec", 0).TrimEnd('?');                 // char 2
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }