예제 #1
0
        public static XQt1514OutBlock FromQuery(XQt1514 query)
        {
            XQt1514OutBlock block = new XQt1514OutBlock();

            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
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
예제 #2
0
        public static XQt1514OutBlock1[] ListFromQuery(XQt1514 query)
        {
            int count = query.GetBlockCount(XQt1514OutBlock1.BlockName);
            List <XQt1514OutBlock1> list = new List <XQt1514OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1514OutBlock1 block = new XQt1514OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.date       = query.GetFieldData(block.GetBlockName(), "date", i).TrimEnd('?');                  // char 8
                    block.jisu       = query.GetFieldData(block.GetBlockName(), "jisu", i).ParseFloat("jisu");            // float 12.2
                    block.sign       = query.GetFieldData(block.GetBlockName(), "sign", i).FirstOrDefault();              // char 1
                    block.change     = query.GetFieldData(block.GetBlockName(), "change", i).ParseFloat("change");        // float 7.2
                    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.diff_vol   = query.GetFieldData(block.GetBlockName(), "diff_vol", i).ParseFloat("diff_vol");    // float 12.2
                    block.value1     = query.GetFieldData(block.GetBlockName(), "value1", i).ParseLong("value1");         // long 12
                    block.high       = query.GetFieldData(block.GetBlockName(), "high", i).ParseLong("high");             // long 4
                    block.unchg      = query.GetFieldData(block.GetBlockName(), "unchg", i).ParseLong("unchg");           // long 4
                    block.low        = query.GetFieldData(block.GetBlockName(), "low", i).ParseLong("low");               // long 4
                    block.uprate     = query.GetFieldData(block.GetBlockName(), "uprate", i).ParseFloat("uprate");        // float 6.2
                    block.frgsvolume = query.GetFieldData(block.GetBlockName(), "frgsvolume", i).ParseLong("frgsvolume"); // long 8
                    block.openjisu   = query.GetFieldData(block.GetBlockName(), "openjisu", i).ParseFloat("openjisu");    // float 12.2
                    block.highjisu   = query.GetFieldData(block.GetBlockName(), "highjisu", i).ParseFloat("highjisu");    // float 12.2
                    block.lowjisu    = query.GetFieldData(block.GetBlockName(), "lowjisu", i).ParseFloat("lowjisu");      // float 12.2
                    block.value2     = query.GetFieldData(block.GetBlockName(), "value2", i).ParseLong("value2");         // long 12
                    block.up         = query.GetFieldData(block.GetBlockName(), "up", i).ParseLong("up");                 // long 4
                    block.down       = query.GetFieldData(block.GetBlockName(), "down", i).ParseLong("down");             // long 4
                    block.totjo      = query.GetFieldData(block.GetBlockName(), "totjo", i).ParseLong("totjo");           // long 4
                    block.orgsvolume = query.GetFieldData(block.GetBlockName(), "orgsvolume", i).ParseLong("orgsvolume"); // long 8
                    block.upcode     = query.GetFieldData(block.GetBlockName(), "upcode", i).TrimEnd('?');                // char 3
                    block.rate       = query.GetFieldData(block.GetBlockName(), "rate", i).ParseFloat("rate");            // float 7.2
                    block.divrate    = query.GetFieldData(block.GetBlockName(), "divrate", i).ParseFloat("divrate");      // float 7.2
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }