Пример #1
0
        public static XQAllOutBlocks Get(string focode = default, long cvolume = default, string stime = default, string etime = default, string cts_time = default)
        {
            using (XQt2804 instance = new XQt2804())
            {
                instance.SetFieldData(XQt2804InBlock.BlockName, XQt2804InBlock.F.focode, 0, focode);                   // char 8
                instance.SetFieldData(XQt2804InBlock.BlockName, XQt2804InBlock.F.cvolume, 0, cvolume.ToString("d12")); // long 12
                instance.SetFieldData(XQt2804InBlock.BlockName, XQt2804InBlock.F.stime, 0, stime);                     // char 4
                instance.SetFieldData(XQt2804InBlock.BlockName, XQt2804InBlock.F.etime, 0, etime);                     // char 4
                instance.SetFieldData(XQt2804InBlock.BlockName, XQt2804InBlock.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);
            }
        }
Пример #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 (XQt2804 instance = new XQt2804())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt2804OutBlock1" : $"XQt2804OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt2804OutBlock1>(qo);
                return(results);
            }
        }
Пример #3
0
        public static XQt2804OutBlock1[] ListFromQuery(XQt2804 query)
        {
            int count = query.GetBlockCount(XQt2804OutBlock1.BlockName);
            List <XQt2804OutBlock1> list = new List <XQt2804OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt2804OutBlock1 block = new XQt2804OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.chetime      = query.GetFieldData(block.GetBlockName(), "chetime", i).TrimEnd('?');                   // char 10
                    block.chetime24    = query.GetFieldData(block.GetBlockName(), "chetime24", 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.openyak      = query.GetFieldData(block.GetBlockName(), "openyak", i).ParseLong("openyak");           // long 8
                    block.jnilopenupdn = query.GetFieldData(block.GetBlockName(), "jnilopenupdn", i).ParseLong("jnilopenupdn"); // long 8
                    block.ibasis       = query.GetFieldData(block.GetBlockName(), "ibasis", i).ParseFloat("ibasis");            // float 6.2
                    block.sbasis       = query.GetFieldData(block.GetBlockName(), "sbasis", i).ParseFloat("sbasis");            // float 6.2
                    block.kasis        = query.GetFieldData(block.GetBlockName(), "kasis", i).ParseFloat("kasis");              // float 6.2
                    block.value        = query.GetFieldData(block.GetBlockName(), "value", i).ParseDouble("value");             // double 12.0
                    block.j_openupdn   = query.GetFieldData(block.GetBlockName(), "j_openupdn", i).ParseLong("j_openupdn");     // long 8
                    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());
        }
Пример #4
0
        public static XQt2804OutBlock1[] Get(string focode = default, long cvolume = default, string stime = default, string etime = default, string cts_time = default)
        {
            using (XQt2804 instance = new XQt2804())
            {
                instance.SetFieldData(XQt2804InBlock.BlockName, XQt2804InBlock.F.focode, 0, focode);                   // char 8
                instance.SetFieldData(XQt2804InBlock.BlockName, XQt2804InBlock.F.cvolume, 0, cvolume.ToString("d12")); // long 12
                instance.SetFieldData(XQt2804InBlock.BlockName, XQt2804InBlock.F.stime, 0, stime);                     // char 4
                instance.SetFieldData(XQt2804InBlock.BlockName, XQt2804InBlock.F.etime, 0, etime);                     // char 4
                instance.SetFieldData(XQt2804InBlock.BlockName, XQt2804InBlock.F.cts_time, 0, cts_time);               // char 10

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

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }
Пример #5
0
        public static XQt2804OutBlock FromQuery(XQt2804 query)
        {
            XQt2804OutBlock block = new XQt2804OutBlock();

            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);
        }