示例#1
0
        public static XQt1902OutBlock1[] Get(string shcode = default, string time = default)
        {
            using (XQt1902 instance = new XQt1902())
            {
                instance.SetFieldData(XQt1902InBlock.BlockName, XQt1902InBlock.F.shcode, 0, shcode);             // char 6
                instance.SetFieldData(XQt1902InBlock.BlockName, XQt1902InBlock.F.time, 0, time);                 // char 6

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

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }
示例#2
0
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string shcode = default,string time = default */)
        {
            using (XQt1902 instance = new XQt1902())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt1902OutBlock1" : $"XQt1902OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt1902OutBlock1>(qo);
                return(results);
            }
        }
示例#3
0
        public static XQt1902OutBlock FromQuery(XQt1902 query)
        {
            XQt1902OutBlock block = new XQt1902OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.time   = query.GetFieldData(block.GetBlockName(), "time", 0).TrimEnd('?');               // char 6
                block.hname  = query.GetFieldData(block.GetBlockName(), "hname", 0).TrimEnd('?');              // char 20
                block.upname = query.GetFieldData(block.GetBlockName(), "upname", 0).TrimEnd('?');             // char 20
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
示例#4
0
        public static XQAllOutBlocks Get(string shcode = default, string time = default)
        {
            using (XQt1902 instance = new XQt1902())
            {
                instance.SetFieldData(XQt1902InBlock.BlockName, XQt1902InBlock.F.shcode, 0, shcode);             // char 6
                instance.SetFieldData(XQt1902InBlock.BlockName, XQt1902InBlock.F.time, 0, time);                 // char 6

                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);
            }
        }
示例#5
0
        public static XQt1902OutBlock1[] ListFromQuery(XQt1902 query)
        {
            int count = query.GetBlockCount(XQt1902OutBlock1.BlockName);
            List <XQt1902OutBlock1> list = new List <XQt1902OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1902OutBlock1 block = new XQt1902OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.time      = query.GetFieldData(block.GetBlockName(), "time", i).TrimEnd('?');                 // char 8
                    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.volume    = query.GetFieldData(block.GetBlockName(), "volume", i).ParseFloat("volume");       // float 12
                    block.navdiff   = query.GetFieldData(block.GetBlockName(), "navdiff", i).ParseFloat("navdiff");     // float 9.2
                    block.nav       = query.GetFieldData(block.GetBlockName(), "nav", i).ParseFloat("nav");             // float 9.2
                    block.navchange = query.GetFieldData(block.GetBlockName(), "navchange", i).ParseFloat("navchange"); // float 9.2
                    block.crate     = query.GetFieldData(block.GetBlockName(), "crate", i).ParseFloat("crate");         // float 9.2
                    block.grate     = query.GetFieldData(block.GetBlockName(), "grate", i).ParseFloat("grate");         // float 9.2
                    block.jisu      = query.GetFieldData(block.GetBlockName(), "jisu", i).ParseFloat("jisu");           // float 8.2
                    block.jichange  = query.GetFieldData(block.GetBlockName(), "jichange", i).ParseFloat("jichange");   // float 8.2
                    block.jirate    = query.GetFieldData(block.GetBlockName(), "jirate", i).ParseFloat("jirate");       // float 8.2
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }