Ejemplo n.º 1
0
        public static XQt3401OutBlock1[] ListFromQuery(XQt3401 query)
        {
            int count = query.GetBlockCount(XQt3401OutBlock1.BlockName);
            List <XQt3401OutBlock1> list = new List <XQt3401OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt3401OutBlock1 block = new XQt3401OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.shcode   = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?');               // char 9
                    block.tradno   = query.GetFieldData(block.GetBlockName(), "tradno", i).TrimEnd('?');               // char 3
                    block.date     = query.GetFieldData(block.GetBlockName(), "date", i).TrimEnd('?');                 // char 8
                    block.tradname = query.GetFieldData(block.GetBlockName(), "tradname", i).TrimEnd('?');             // char 30
                    block.bopn     = query.GetFieldData(block.GetBlockName(), "bopn", i).TrimEnd('?');                 // char 30
                    block.nopn     = query.GetFieldData(block.GetBlockName(), "nopn", i).TrimEnd('?');                 // char 30
                    block.boga     = query.GetFieldData(block.GetBlockName(), "boga", i).ParseLong("boga");            // long 12
                    block.noga     = query.GetFieldData(block.GetBlockName(), "noga", i).ParseLong("noga");            // long 12
                    block.close    = query.GetFieldData(block.GetBlockName(), "close", i).ParseLong("close");          // long 8
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
Ejemplo n.º 2
0
        public static XQt3401OutBlock FromQuery(XQt3401 query)
        {
            XQt3401OutBlock block = new XQt3401OutBlock();

            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_date = query.GetFieldData(block.GetBlockName(), "cts_date", 0).TrimEnd('?');             // char 8
                block.price    = query.GetFieldData(block.GetBlockName(), "price", 0).ParseLong("price");          // long 8
                block.sign     = query.GetFieldData(block.GetBlockName(), "sign", 0).FirstOrDefault();             // char 1
                block.change   = query.GetFieldData(block.GetBlockName(), "change", 0).ParseLong("change");        // long 8
                block.diff     = query.GetFieldData(block.GetBlockName(), "diff", 0).ParseFloat("diff");           // float 6.2
                block.volume   = query.GetFieldData(block.GetBlockName(), "volume", 0).ParseLong("volume");        // long 12
                block.value    = query.GetFieldData(block.GetBlockName(), "value", 0).ParseLong("value");          // long 12
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }