Esempio n. 1
0
        public static XQt1308OutBlock1[] ReadFromDB(string tableNamePostfix = null /*, string shcode = default,string starttime = default,string endtime = default,string bun_term = default */)
        {
            using (XQt1308 instance = new XQt1308())
            {
                string      tableName = (tableNamePostfix == null) ? "XQt1308OutBlock1" : $"XQt1308OutBlock1_{tableNamePostfix}";
                QueryOption qo        = new QueryOption(tableName);
                // if (shcode != default) qo.Add("shcode", shcode);
                // if (starttime != default) qo.Add("starttime", starttime);
                // if (endtime != default) qo.Add("endtime", endtime);
                // if (bun_term != default) qo.Add("bun_term", bun_term);


                var outBlock = instance.SelectMany <XQt1308OutBlock1>(qo);
                return(outBlock);
            }
        }
Esempio n. 2
0
        public static XQt1308OutBlock1[] Get(string shcode = default, string starttime = default, string endtime = default, string bun_term = default)
        {
            using (XQt1308 instance = new XQt1308())
            {
                instance.SetFieldData(XQt1308InBlock.BlockName, XQt1308InBlock.F.shcode, 0, shcode);                 // char 6
                instance.SetFieldData(XQt1308InBlock.BlockName, XQt1308InBlock.F.starttime, 0, starttime);           // char 4
                instance.SetFieldData(XQt1308InBlock.BlockName, XQt1308InBlock.F.endtime, 0, endtime);               // char 4
                instance.SetFieldData(XQt1308InBlock.BlockName, XQt1308InBlock.F.bun_term, 0, bun_term);             // char 2

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

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }
Esempio n. 3
0
        public static XQt1308OutBlock1[] ListFromQuery(XQt1308 query)
        {
            int count = query.GetBlockCount(XQt1308OutBlock1.BlockName);
            List <XQt1308OutBlock1> list = new List <XQt1308OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1308OutBlock1 block = new XQt1308OutBlock1();
                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 8
                    block.chdegvol = query.GetFieldData(block.GetBlockName(), "chdegvol", i).ParseFloat("chdegvol");     // float 8.2
                    block.chdegcnt = query.GetFieldData(block.GetBlockName(), "chdegcnt", i).ParseFloat("chdegcnt");     // float 8.2
                    block.volume   = query.GetFieldData(block.GetBlockName(), "volume", i).ParseLong("volume");          // long 12
                    block.mdvolume = query.GetFieldData(block.GetBlockName(), "mdvolume", i).ParseLong("mdvolume");      // long 12
                    block.mdchecnt = query.GetFieldData(block.GetBlockName(), "mdchecnt", i).ParseLong("mdchecnt");      // long 8
                    block.msvolume = query.GetFieldData(block.GetBlockName(), "msvolume", i).ParseLong("msvolume");      // long 12
                    block.mschecnt = query.GetFieldData(block.GetBlockName(), "mschecnt", i).ParseLong("mschecnt");      // 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
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }