Ejemplo n.º 1
0
        public static XQt2835OutBlock FromQuery(XQt2835 query)
        {
            XQt2835OutBlock block = new XQt2835OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.gmprice  = query.GetFieldData(block.GetBlockName(), "gmprice", 0).ParseFloat("gmprice");         // float 6.2
                block.gmsign   = query.GetFieldData(block.GetBlockName(), "gmsign", 0).FirstOrDefault();               // char 1
                block.gmchange = query.GetFieldData(block.GetBlockName(), "gmchange", 0).ParseFloat("gmchange");       // float 6.2
                block.gmdiff   = query.GetFieldData(block.GetBlockName(), "gmdiff", 0).ParseFloat("gmdiff");           // float 6.2
                block.gmvolume = query.GetFieldData(block.GetBlockName(), "gmvolume", 0).ParseLong("gmvolume");        // long 12
                block.gmshcode = query.GetFieldData(block.GetBlockName(), "gmshcode", 0).TrimEnd('?');                 // char 8
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Ejemplo n.º 2
0
        public XQt2835OutBlock GetBlock()
        {
            XQt2835OutBlock instance = XQt2835OutBlock.FromQuery(this);

            return(instance);
        }