Exemplo n.º 1
0
        public static XQt1403OutBlock1[] ListFromQuery(XQt1403 query)
        {
            int count = query.GetBlockCount(XQt1403OutBlock1.BlockName);
            List <XQt1403OutBlock1> list = new List <XQt1403OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1403OutBlock1 block = new XQt1403OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.hname    = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?');                // char 20
                    block.price    = query.GetFieldData(block.GetBlockName(), "price", i).ParseLong("price");          // 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.kmprice  = query.GetFieldData(block.GetBlockName(), "kmprice", i).ParseLong("kmprice");      // long 8
                    block.date     = query.GetFieldData(block.GetBlockName(), "date", i).TrimEnd('?');                 // char 8
                    block.recprice = query.GetFieldData(block.GetBlockName(), "recprice", i).ParseLong("recprice");    // long 8
                    block.kmdiff   = query.GetFieldData(block.GetBlockName(), "kmdiff", i).ParseFloat("kmdiff");       // float 6.2
                    block.close    = query.GetFieldData(block.GetBlockName(), "close", i).ParseLong("close");          // long 8
                    block.recdiff  = query.GetFieldData(block.GetBlockName(), "recdiff", i).ParseFloat("recdiff");     // float 6.2
                    block.shcode   = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?');               // char 6
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
Exemplo n.º 2
0
 public XQt1403OutBlock1[] GetBlock1s()
 {
     XQt1403OutBlock1[] instance = XQt1403OutBlock1.ListFromQuery(this);
     return(instance);
 }