Пример #1
0
        public static XQt1636OutBlock FromQuery(XQt1636 query)
        {
            XQt1636OutBlock block = new XQt1636OutBlock();

            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
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Пример #2
0
        public static XQt1636OutBlock1[] ListFromQuery(XQt1636 query)
        {
            int count = query.GetBlockCount(XQt1636OutBlock1.BlockName);
            List <XQt1636OutBlock1> list = new List <XQt1636OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1636OutBlock1 block = new XQt1636OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.rank        = query.GetFieldData(block.GetBlockName(), "rank", i).ParseLong("rank");               // long 8
                    block.hname       = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?');                   // char 20
                    block.price       = query.GetFieldData(block.GetBlockName(), "price", i).ParseLong("price");             // long 8
                    block.sign        = query.GetFieldData(block.GetBlockName(), "sign", i).FirstOrDefault();                // char 1
                    block.change      = query.GetFieldData(block.GetBlockName(), "change", i).ParseLong("change");           // long 8
                    block.diff        = query.GetFieldData(block.GetBlockName(), "diff", i).ParseFloat("diff");              // float 6.2
                    block.volume      = query.GetFieldData(block.GetBlockName(), "volume", i).ParseLong("volume");           // long 12
                    block.svalue      = query.GetFieldData(block.GetBlockName(), "svalue", i).ParseLong("svalue");           // long 12
                    block.offervalue  = query.GetFieldData(block.GetBlockName(), "offervalue", i).ParseLong("offervalue");   // long 12
                    block.stksvalue   = query.GetFieldData(block.GetBlockName(), "stksvalue", i).ParseLong("stksvalue");     // long 12
                    block.svolume     = query.GetFieldData(block.GetBlockName(), "svolume", i).ParseLong("svolume");         // long 12
                    block.offervolume = query.GetFieldData(block.GetBlockName(), "offervolume", i).ParseLong("offervolume"); // long 12
                    block.stksvolume  = query.GetFieldData(block.GetBlockName(), "stksvolume", i).ParseLong("stksvolume");   // long 12
                    block.sgta        = query.GetFieldData(block.GetBlockName(), "sgta", i).ParseLong("sgta");               // long 15
                    block.rate        = query.GetFieldData(block.GetBlockName(), "rate", i).ParseFloat("rate");              // float 6.2
                    block.shcode      = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?');                  // char 6
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }