Exemplo n.º 1
0
        public static XQAllOutBlocks Get(string focode = default, long cvolume = default, string stime = default, string etime = default, string cts_time = default)
        {
            using (XQt2832 instance = new XQt2832())
            {
                instance.SetFieldData(XQt2832InBlock.BlockName, XQt2832InBlock.F.focode, 0, focode);                   // char 8
                instance.SetFieldData(XQt2832InBlock.BlockName, XQt2832InBlock.F.cvolume, 0, cvolume.ToString("d12")); // long 12
                instance.SetFieldData(XQt2832InBlock.BlockName, XQt2832InBlock.F.stime, 0, stime);                     // char 4
                instance.SetFieldData(XQt2832InBlock.BlockName, XQt2832InBlock.F.etime, 0, etime);                     // char 4
                instance.SetFieldData(XQt2832InBlock.BlockName, XQt2832InBlock.F.cts_time, 0, cts_time);               // char 10

                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);
            }
        }
Exemplo n.º 2
0
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string focode = default,long cvolume = default,string stime = default,string etime = default,string cts_time = default */)
        {
            using (XQt2832 instance = new XQt2832())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt2832OutBlock1" : $"XQt2832OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt2832OutBlock1>(qo);
                return(results);
            }
        }
Exemplo n.º 3
0
        public static XQt2832OutBlock1[] Get(string focode = default, long cvolume = default, string stime = default, string etime = default, string cts_time = default)
        {
            using (XQt2832 instance = new XQt2832())
            {
                instance.SetFieldData(XQt2832InBlock.BlockName, XQt2832InBlock.F.focode, 0, focode);                   // char 8
                instance.SetFieldData(XQt2832InBlock.BlockName, XQt2832InBlock.F.cvolume, 0, cvolume.ToString("d12")); // long 12
                instance.SetFieldData(XQt2832InBlock.BlockName, XQt2832InBlock.F.stime, 0, stime);                     // char 4
                instance.SetFieldData(XQt2832InBlock.BlockName, XQt2832InBlock.F.etime, 0, etime);                     // char 4
                instance.SetFieldData(XQt2832InBlock.BlockName, XQt2832InBlock.F.cts_time, 0, cts_time);               // char 10

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

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }
Exemplo n.º 4
0
        public static XQt2832OutBlock FromQuery(XQt2832 query)
        {
            XQt2832OutBlock block = new XQt2832OutBlock();

            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);
        }
Exemplo n.º 5
0
        public static XQt2832OutBlock1[] ListFromQuery(XQt2832 query)
        {
            int count = query.GetBlockCount(XQt2832OutBlock1.BlockName);
            List <XQt2832OutBlock1> list = new List <XQt2832OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt2832OutBlock1 block = new XQt2832OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.chetime    = query.GetFieldData(block.GetBlockName(), "chetime", i).TrimEnd('?');                 // char 10
                    block.price      = query.GetFieldData(block.GetBlockName(), "price", i).ParseFloat("price");            // float 6.2
                    block.sign       = query.GetFieldData(block.GetBlockName(), "sign", i).FirstOrDefault();                // char 1
                    block.change     = query.GetFieldData(block.GetBlockName(), "change", i).ParseFloat("change");          // float 6.2
                    block.cvolume    = query.GetFieldData(block.GetBlockName(), "cvolume", i).ParseLong("cvolume");         // long 8
                    block.chdegree   = query.GetFieldData(block.GetBlockName(), "chdegree", i).ParseFloat("chdegree");      // float 8.2
                    block.offerho    = query.GetFieldData(block.GetBlockName(), "offerho", i).ParseFloat("offerho");        // float 6.2
                    block.bidho      = query.GetFieldData(block.GetBlockName(), "bidho", i).ParseFloat("bidho");            // float 6.2
                    block.volume     = query.GetFieldData(block.GetBlockName(), "volume", i).ParseDouble("volume");         // double 12.0
                    block.n_msvolume = query.GetFieldData(block.GetBlockName(), "n_msvolume", i).ParseDouble("n_msvolume"); // double 12.0
                    block.n_mdvolume = query.GetFieldData(block.GetBlockName(), "n_mdvolume", i).ParseDouble("n_mdvolume"); // double 12.0
                    block.s_msvolume = query.GetFieldData(block.GetBlockName(), "s_msvolume", i).ParseDouble("s_msvolume"); // double 12.0
                    block.n_mschecnt = query.GetFieldData(block.GetBlockName(), "n_mschecnt", i).ParseLong("n_mschecnt");   // long 8
                    block.n_mdchecnt = query.GetFieldData(block.GetBlockName(), "n_mdchecnt", i).ParseLong("n_mdchecnt");   // long 8
                    block.s_mschecnt = query.GetFieldData(block.GetBlockName(), "s_mschecnt", i).ParseLong("s_mschecnt");   // long 8
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }