Пример #1
0
        public static XQt1104OutBlock1[] ListFromQuery(XQt1104 query)
        {
            int count = query.GetBlockCount(XQt1104OutBlock1.BlockName);
            List <XQt1104OutBlock1> list = new List <XQt1104OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1104OutBlock1 block = new XQt1104OutBlock1();
                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());
        }
Пример #2
0
        public static XQt1104OutBlock FromQuery(XQt1104 query)
        {
            XQt1104OutBlock block = new XQt1104OutBlock();

            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);
        }