Esempio n. 1
0
        public static XQt8433OutBlock[] ListFromQuery(XQt8433 query)
        {
            int count = query.GetBlockCount(XQt8433OutBlock.BlockName);
            List <XQt8433OutBlock> list = new List <XQt8433OutBlock>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt8433OutBlock block = new XQt8433OutBlock();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.hname     = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?');                 // char 20
                    block.shcode    = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?');                // char 8
                    block.expcode   = query.GetFieldData(block.GetBlockName(), "expcode", i).TrimEnd('?');               // char 12
                    block.hprice    = query.GetFieldData(block.GetBlockName(), "hprice", i).ParseFloat("hprice");        // float 6.2
                    block.lprice    = query.GetFieldData(block.GetBlockName(), "lprice", i).ParseFloat("lprice");        // float 6.2
                    block.jnilclose = query.GetFieldData(block.GetBlockName(), "jnilclose", i).ParseFloat("jnilclose");  // float 6.2
                    block.jnilhigh  = query.GetFieldData(block.GetBlockName(), "jnilhigh", i).ParseFloat("jnilhigh");    // float 6.2
                    block.jnillow   = query.GetFieldData(block.GetBlockName(), "jnillow", i).ParseFloat("jnillow");      // float 6.2
                    block.recprice  = query.GetFieldData(block.GetBlockName(), "recprice", i).ParseFloat("recprice");    // float 6.2
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
Esempio n. 2
0
        public static XQt8433OutBlock[] ReadFromDB(string tableNamePostfix = null /*, char dummy = default */)
        {
            using (XQt8433 instance = new XQt8433())
            {
                string      tableName = (tableNamePostfix == null) ? "XQt8433OutBlock" : $"XQt8433OutBlock_{tableNamePostfix}";
                QueryOption qo        = new QueryOption(tableName);
                // if (dummy != default) qo.Add("dummy", dummy);


                var outBlock = instance.SelectMany <XQt8433OutBlock>(qo);
                return(outBlock);
            }
        }
Esempio n. 3
0
        public static XQt8433OutBlock[] Get(char dummy = default)
        {
            using (XQt8433 instance = new XQt8433())
            {
                instance.SetFieldData(XQt8433InBlock.BlockName, XQt8433InBlock.F.dummy, 0, dummy.ToString());                 // char 1

                if (instance.Request() < 0)
                {
                    return(null);
                }

                var outBlock = instance.GetBlocks();
                return(outBlock);
            }
        }