Esempio n. 1
0
        public static XQt4201OutBlock FromQuery(XQt4201 query)
        {
            XQt4201OutBlock block = new XQt4201OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.shcode    = query.GetFieldData(block.GetBlockName(), "shcode", 0).TrimEnd('?');              // char 6
                block.jisiga    = query.GetFieldData(block.GetBlockName(), "jisiga", 0).ParseLong("jisiga");       // long 8
                block.jihigh    = query.GetFieldData(block.GetBlockName(), "jihigh", 0).ParseLong("jihigh");       // long 8
                block.jilow     = query.GetFieldData(block.GetBlockName(), "jilow", 0).ParseLong("jilow");         // long 8
                block.jiclose   = query.GetFieldData(block.GetBlockName(), "jiclose", 0).ParseLong("jiclose");     // long 8
                block.jivolume  = query.GetFieldData(block.GetBlockName(), "jivolume", 0).ParseLong("jivolume");   // long 12
                block.disiga    = query.GetFieldData(block.GetBlockName(), "disiga", 0).ParseLong("disiga");       // long 8
                block.dihigh    = query.GetFieldData(block.GetBlockName(), "dihigh", 0).ParseLong("dihigh");       // long 8
                block.dilow     = query.GetFieldData(block.GetBlockName(), "dilow", 0).ParseLong("dilow");         // long 8
                block.diclose   = query.GetFieldData(block.GetBlockName(), "diclose", 0).ParseLong("diclose");     // long 8
                block.highend   = query.GetFieldData(block.GetBlockName(), "highend", 0).ParseLong("highend");     // long 8
                block.lowend    = query.GetFieldData(block.GetBlockName(), "lowend", 0).ParseLong("lowend");       // long 8
                block.cts_date  = query.GetFieldData(block.GetBlockName(), "cts_date", 0).TrimEnd('?');            // char 8
                block.cts_time  = query.GetFieldData(block.GetBlockName(), "cts_time", 0).TrimEnd('?');            // char 10
                block.cts_daygb = query.GetFieldData(block.GetBlockName(), "cts_daygb", 0).FirstOrDefault();       // char 1
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Esempio n. 2
0
        public XQt4201OutBlock GetBlock()
        {
            XQt4201OutBlock instance = XQt4201OutBlock.FromQuery(this);

            return(instance);
        }