Exemple #1
0
        public static XQt3341OutBlock FromQuery(XQt3341 query)
        {
            XQt3341OutBlock block = new XQt3341OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.cnt = query.GetFieldData(block.GetBlockName(), "cnt", 0).ParseLong("cnt");                 // long 4
                block.idx = query.GetFieldData(block.GetBlockName(), "idx", 0).ParseLong("idx");                 // long 4
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Exemple #2
0
        public static XQt3341OutBlock1[] ListFromQuery(XQt3341 query)
        {
            int count = query.GetBlockCount(XQt3341OutBlock1.BlockName);
            List <XQt3341OutBlock1> list = new List <XQt3341OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt3341OutBlock1 block = new XQt3341OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.rank                 = query.GetFieldData(block.GetBlockName(), "rank", i).ParseLong("rank");                                 // long 4
                    block.hname                = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?');                                     // char 20
                    block.salesgrowth          = query.GetFieldData(block.GetBlockName(), "salesgrowth", i).ParseLong("salesgrowth");                   // long 12
                    block.operatingincomegrowt = query.GetFieldData(block.GetBlockName(), "operatingincomegrowt", i).ParseLong("operatingincomegrowt"); // long 12
                    block.ordinaryincomegrowth = query.GetFieldData(block.GetBlockName(), "ordinaryincomegrowth", i).ParseLong("ordinaryincomegrowth"); // long 12
                    block.liabilitytoequity    = query.GetFieldData(block.GetBlockName(), "liabilitytoequity", i).ParseLong("liabilitytoequity");       // long 12
                    block.enterpriseratio      = query.GetFieldData(block.GetBlockName(), "enterpriseratio", i).ParseLong("enterpriseratio");           // long 12
                    block.eps    = query.GetFieldData(block.GetBlockName(), "eps", i).ParseLong("eps");                                                 // long 12
                    block.bps    = query.GetFieldData(block.GetBlockName(), "bps", i).ParseLong("bps");                                                 // long 12
                    block.roe    = query.GetFieldData(block.GetBlockName(), "roe", i).ParseLong("roe");                                                 // long 12
                    block.shcode = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?');                                                  // char 6
                    block.per    = query.GetFieldData(block.GetBlockName(), "per", i).ParseFloat("per");                                                // float 13.2
                    block.pbr    = query.GetFieldData(block.GetBlockName(), "pbr", i).ParseFloat("pbr");                                                // float 13.2
                    block.peg    = query.GetFieldData(block.GetBlockName(), "peg", i).ParseFloat("peg");                                                // float 13.2
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }