Пример #1
0
        public static XQt1981OutBlock1[] ListFromQuery(XQt1981 query)
        {
            int count = query.GetBlockCount(XQt1981OutBlock1.BlockName);
            List <XQt1981OutBlock1> list = new List <XQt1981OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1981OutBlock1 block = new XQt1981OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.shcode  = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?');                  // char 6
                    block.expcode = query.GetFieldData(block.GetBlockName(), "expcode", i).TrimEnd('?');                 // char 12
                    block.hname   = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?');                   // char 20
                    block.price   = query.GetFieldData(block.GetBlockName(), "price", i).TrimEnd('?');                   // char 12
                    block.sign    = query.GetFieldData(block.GetBlockName(), "sign", i).FirstOrDefault();                // char 1
                    block.change  = query.GetFieldData(block.GetBlockName(), "change", i).TrimEnd('?');                  // char 12
                    block.rate    = query.GetFieldData(block.GetBlockName(), "rate", i).ParseFloat("rate");              // float 5.2
                    block.volume  = query.GetFieldData(block.GetBlockName(), "volume", i).TrimEnd('?');                  // char 12
                    block.value   = query.GetFieldData(block.GetBlockName(), "value", i).TrimEnd('?');                   // char 12
                    block.mkt_gb  = query.GetFieldData(block.GetBlockName(), "mkt_gb", i).FirstOrDefault();              // char 1
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
Пример #2
0
 public XQt1981OutBlock1[] GetBlock1s()
 {
     XQt1981OutBlock1[] instance = XQt1981OutBlock1.ListFromQuery(this);
     return(instance);
 }