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

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1603OutBlock1 block = new XQt1603OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.time     = query.GetFieldData(block.GetBlockName(), "time", i).TrimEnd('?');                 // char 8
                    block.tjjcode  = query.GetFieldData(block.GetBlockName(), "tjjcode", i).TrimEnd('?');              // char 4
                    block.msvolume = query.GetFieldData(block.GetBlockName(), "msvolume", i).ParseLong("msvolume");    // long 8
                    block.mdvolume = query.GetFieldData(block.GetBlockName(), "mdvolume", i).ParseLong("mdvolume");    // long 8
                    block.msvalue  = query.GetFieldData(block.GetBlockName(), "msvalue", i).ParseLong("msvalue");      // long 12
                    block.mdvalue  = query.GetFieldData(block.GetBlockName(), "mdvalue", i).ParseLong("mdvalue");      // long 12
                    block.svolume  = query.GetFieldData(block.GetBlockName(), "svolume", i).ParseLong("svolume");      // long 8
                    block.svalue   = query.GetFieldData(block.GetBlockName(), "svalue", i).ParseLong("svalue");        // long 12
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
Пример #2
0
        public static XQt1603OutBlock FromQuery(XQt1603 query)
        {
            XQt1603OutBlock block = new XQt1603OutBlock();

            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_idx  = query.GetFieldData(block.GetBlockName(), "cts_idx", 0).ParseLong("cts_idx");          // long 4
                block.cts_time = query.GetFieldData(block.GetBlockName(), "cts_time", 0).TrimEnd('?');                 // char 8
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }