Exemple #1
0
        public static XQt8417OutBlock1[] ListFromQuery(XQt8417 query)
        {
            int count = query.GetBlockCount(XQt8417OutBlock1.BlockName);
            List <XQt8417OutBlock1> list = new List <XQt8417OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt8417OutBlock1 block = new XQt8417OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.date      = query.GetFieldData(block.GetBlockName(), "date", i).TrimEnd('?');                // char 8
                    block.time      = query.GetFieldData(block.GetBlockName(), "time", i).TrimEnd('?');                // char 6
                    block.open      = query.GetFieldData(block.GetBlockName(), "open", i).ParseFloat("open");          // float 7.2
                    block.high      = query.GetFieldData(block.GetBlockName(), "high", i).ParseFloat("high");          // float 7.2
                    block.low       = query.GetFieldData(block.GetBlockName(), "low", i).ParseFloat("low");            // float 7.2
                    block.close     = query.GetFieldData(block.GetBlockName(), "close", i).ParseFloat("close");        // float 7.2
                    block.jdiff_vol = query.GetFieldData(block.GetBlockName(), "jdiff_vol", i).ParseLong("jdiff_vol"); // long 12
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
Exemple #2
0
        public static XQt8417OutBlock FromQuery(XQt8417 query)
        {
            XQt8417OutBlock block = new XQt8417OutBlock();

            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 3
                block.jisiga    = query.GetFieldData(block.GetBlockName(), "jisiga", 0).ParseFloat("jisiga");      // float 7.2
                block.jihigh    = query.GetFieldData(block.GetBlockName(), "jihigh", 0).ParseFloat("jihigh");      // float 7.2
                block.jilow     = query.GetFieldData(block.GetBlockName(), "jilow", 0).ParseFloat("jilow");        // float 7.2
                block.jiclose   = query.GetFieldData(block.GetBlockName(), "jiclose", 0).ParseFloat("jiclose");    // float 7.2
                block.jivolume  = query.GetFieldData(block.GetBlockName(), "jivolume", 0).ParseLong("jivolume");   // long 12
                block.disiga    = query.GetFieldData(block.GetBlockName(), "disiga", 0).ParseFloat("disiga");      // float 7.2
                block.dihigh    = query.GetFieldData(block.GetBlockName(), "dihigh", 0).ParseFloat("dihigh");      // float 7.2
                block.dilow     = query.GetFieldData(block.GetBlockName(), "dilow", 0).ParseFloat("dilow");        // float 7.2
                block.diclose   = query.GetFieldData(block.GetBlockName(), "diclose", 0).ParseFloat("diclose");    // float 7.2
                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.s_time    = query.GetFieldData(block.GetBlockName(), "s_time", 0).TrimEnd('?');              // char 6
                block.e_time    = query.GetFieldData(block.GetBlockName(), "e_time", 0).TrimEnd('?');              // char 6
                block.dshmin    = query.GetFieldData(block.GetBlockName(), "dshmin", 0).TrimEnd('?');              // char 2
                block.rec_count = query.GetFieldData(block.GetBlockName(), "rec_count", 0).ParseLong("rec_count"); // long 7
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }