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

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1486OutBlock1 block = new XQt1486OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.chetime   = query.GetFieldData(block.GetBlockName(), "chetime", 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.diff      = query.GetFieldData(block.GetBlockName(), "diff", i).ParseFloat("diff");              // float 6.2
                    block.cvolume   = query.GetFieldData(block.GetBlockName(), "cvolume", i).ParseLong("cvolume");         // long 12
                    block.offerho1  = query.GetFieldData(block.GetBlockName(), "offerho1", i).ParseLong("offerho1");       // long 8
                    block.bidho1    = query.GetFieldData(block.GetBlockName(), "bidho1", i).ParseLong("bidho1");           // long 8
                    block.offerrem1 = query.GetFieldData(block.GetBlockName(), "offerrem1", i).ParseLong("offerrem1");     // long 12
                    block.bidrem1   = query.GetFieldData(block.GetBlockName(), "bidrem1", i).ParseLong("bidrem1");         // long 12
                } 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 XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string shcode = default,string cts_time = default,int cnt = default */)
        {
            using (XQt1486 instance = new XQt1486())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt1486OutBlock1" : $"XQt1486OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt1486OutBlock1>(qo);
                return(results);
            }
        }
Esempio n. 3
0
        public static XQt1486OutBlock1[] Get(string shcode = default, string cts_time = default, int cnt = default)
        {
            using (XQt1486 instance = new XQt1486())
            {
                instance.SetFieldData(XQt1486InBlock.BlockName, XQt1486InBlock.F.shcode, 0, shcode);                 // char 6
                instance.SetFieldData(XQt1486InBlock.BlockName, XQt1486InBlock.F.cts_time, 0, cts_time);             // char 10
                instance.SetFieldData(XQt1486InBlock.BlockName, XQt1486InBlock.F.cnt, 0, cnt.ToString("d4"));        // int 4

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

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }
Esempio n. 4
0
        public static XQt1486OutBlock FromQuery(XQt1486 query)
        {
            XQt1486OutBlock block = new XQt1486OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.cts_time = query.GetFieldData(block.GetBlockName(), "cts_time", 0).TrimEnd('?');                 // char 10
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Esempio n. 5
0
        public static XQAllOutBlocks Get(string shcode = default, string cts_time = default, int cnt = default)
        {
            using (XQt1486 instance = new XQt1486())
            {
                instance.SetFieldData(XQt1486InBlock.BlockName, XQt1486InBlock.F.shcode, 0, shcode);                 // char 6
                instance.SetFieldData(XQt1486InBlock.BlockName, XQt1486InBlock.F.cts_time, 0, cts_time);             // char 10
                instance.SetFieldData(XQt1486InBlock.BlockName, XQt1486InBlock.F.cnt, 0, cnt.ToString("d4"));        // int 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);
            }
        }