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

            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
                block.cts_date = query.GetFieldData(block.GetBlockName(), "cts_date", 0).TrimEnd('?');                 // char 8
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Esempio n. 2
0
        public static XQt1702OutBlock1[] ListFromQuery(XQt1702 query)
        {
            int count = query.GetBlockCount(XQt1702OutBlock1.BlockName);
            List <XQt1702OutBlock1> list = new List <XQt1702OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1702OutBlock1 block = new XQt1702OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.date    = query.GetFieldData(block.GetBlockName(), "date", i).TrimEnd('?');                  // char 8
                    block.close   = query.GetFieldData(block.GetBlockName(), "close", i).ParseLong("close");           // 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.amt0000 = query.GetFieldData(block.GetBlockName(), "amt0000", i).ParseLong("amt0000");       // long 12
                    block.amt0001 = query.GetFieldData(block.GetBlockName(), "amt0001", i).ParseLong("amt0001");       // long 12
                    block.amt0002 = query.GetFieldData(block.GetBlockName(), "amt0002", i).ParseLong("amt0002");       // long 12
                    block.amt0003 = query.GetFieldData(block.GetBlockName(), "amt0003", i).ParseLong("amt0003");       // long 12
                    block.amt0004 = query.GetFieldData(block.GetBlockName(), "amt0004", i).ParseLong("amt0004");       // long 12
                    block.amt0005 = query.GetFieldData(block.GetBlockName(), "amt0005", i).ParseLong("amt0005");       // long 12
                    block.amt0006 = query.GetFieldData(block.GetBlockName(), "amt0006", i).ParseLong("amt0006");       // long 12
                    block.amt0007 = query.GetFieldData(block.GetBlockName(), "amt0007", i).ParseLong("amt0007");       // long 12
                    block.amt0008 = query.GetFieldData(block.GetBlockName(), "amt0008", i).ParseLong("amt0008");       // long 12
                    block.amt0009 = query.GetFieldData(block.GetBlockName(), "amt0009", i).ParseLong("amt0009");       // long 12
                    block.amt0010 = query.GetFieldData(block.GetBlockName(), "amt0010", i).ParseLong("amt0010");       // long 12
                    block.amt0011 = query.GetFieldData(block.GetBlockName(), "amt0011", i).ParseLong("amt0011");       // long 12
                    block.amt0018 = query.GetFieldData(block.GetBlockName(), "amt0018", i).ParseLong("amt0018");       // long 12
                    block.amt0088 = query.GetFieldData(block.GetBlockName(), "amt0088", i).ParseLong("amt0088");       // long 12
                    block.amt0099 = query.GetFieldData(block.GetBlockName(), "amt0099", i).ParseLong("amt0099");       // long 12
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }