Exemple #1
0
        public static XQt1537OutBlock1[] Get(string tmcode = default)
        {
            using (XQt1537 instance = new XQt1537())
            {
                instance.SetFieldData(XQt1537InBlock.BlockName, XQt1537InBlock.F.tmcode, 0, tmcode);                 // char 4

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

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }
Exemple #2
0
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string tmcode = default */)
        {
            using (XQt1537 instance = new XQt1537())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

                string      tableName = (tableNamePostfix == null) ? "XQt1537OutBlock" : $"XQt1537OutBlock_{tableNamePostfix}";
                QueryOption qo        = new QueryOption(tableName);
                results.OutBlock = instance.Select <XQt1537OutBlock>(qo);

                tableName         = (tableNamePostfix == null) ? "XQt1537OutBlock1" : $"XQt1537OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt1537OutBlock1>(qo);
                return(results);
            }
        }
Exemple #3
0
        public static XQAllOutBlocks Get(string tmcode = default)
        {
            using (XQt1537 instance = new XQt1537())
            {
                instance.SetFieldData(XQt1537InBlock.BlockName, XQt1537InBlock.F.tmcode, 0, tmcode);                 // char 4

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

                XQAllOutBlocks results = new XQAllOutBlocks();
                results.OutBlock = instance.GetBlock();
                if (results.OutBlock.IsValidData == false)
                {
                    return(null);
                }

                results.OutBlock1 = instance.GetBlock1s();
                return(results);
            }
        }
Exemple #4
0
        public static XQt1537OutBlock1[] ListFromQuery(XQt1537 query)
        {
            int count = query.GetBlockCount(XQt1537OutBlock1.BlockName);
            List <XQt1537OutBlock1> list = new List <XQt1537OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1537OutBlock1 block = new XQt1537OutBlock1();
                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.jniltime  = query.GetFieldData(block.GetBlockName(), "jniltime", i).ParseFloat("jniltime");    // float 9.2
                    block.shcode    = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?');                // char 6
                    block.yeprice   = query.GetFieldData(block.GetBlockName(), "yeprice", i).ParseLong("yeprice");       // long 8
                    block.open      = query.GetFieldData(block.GetBlockName(), "open", i).ParseLong("open");             // long 8
                    block.high      = query.GetFieldData(block.GetBlockName(), "high", i).ParseLong("high");             // long 8
                    block.low       = query.GetFieldData(block.GetBlockName(), "low", i).ParseLong("low");               // long 8
                    block.value     = query.GetFieldData(block.GetBlockName(), "value", i).ParseLong("value");           // long 12
                    block.marketcap = query.GetFieldData(block.GetBlockName(), "marketcap", i).ParseLong("marketcap");   // long 12
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
Exemple #5
0
        public static XQt1537OutBlock FromQuery(XQt1537 query)
        {
            XQt1537OutBlock block = new XQt1537OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.upcnt  = query.GetFieldData(block.GetBlockName(), "upcnt", 0).ParseLong("upcnt");            // long 4
                block.tmcnt  = query.GetFieldData(block.GetBlockName(), "tmcnt", 0).ParseLong("tmcnt");            // long 4
                block.uprate = query.GetFieldData(block.GetBlockName(), "uprate", 0).ParseLong("uprate");          // long 4
                block.tmname = query.GetFieldData(block.GetBlockName(), "tmname", 0).TrimEnd('?');                 // char 36
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }