Пример #1
0
        public static XQt1411OutBlock1[] ListFromQuery(XQt1411 query)
        {
            int count = query.GetBlockCount(XQt1411OutBlock1.BlockName);
            List <XQt1411OutBlock1> list = new List <XQt1411OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1411OutBlock1 block = new XQt1411OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.shcode   = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?');                 // char 6
                    block.hname    = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?');                  // char 20
                    block.jkrate   = query.GetFieldData(block.GetBlockName(), "jkrate", i).ParseLong("jkrate");          // long 3
                    block.sjkrate  = query.GetFieldData(block.GetBlockName(), "sjkrate", i).ParseLong("sjkrate");        // long 3
                    block.subprice = query.GetFieldData(block.GetBlockName(), "subprice", i).ParseLong("subprice");      // long 8
                    block.recprice = query.GetFieldData(block.GetBlockName(), "recprice", i).ParseLong("recprice");      // long 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.volume   = query.GetFieldData(block.GetBlockName(), "volume", i).ParseLong("volume");          // long 12
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
Пример #2
0
        public static XQAllOutBlocks Get(char gubun = default, char jongchk = default, char jkrate = default, string shcode = default, long idx = default)
        {
            using (XQt1411 instance = new XQt1411())
            {
                instance.SetFieldData(XQt1411InBlock.BlockName, XQt1411InBlock.F.gubun, 0, gubun.ToString());        // char 1
                instance.SetFieldData(XQt1411InBlock.BlockName, XQt1411InBlock.F.jongchk, 0, jongchk.ToString());    // char 1
                instance.SetFieldData(XQt1411InBlock.BlockName, XQt1411InBlock.F.jkrate, 0, jkrate.ToString());      // char 1
                instance.SetFieldData(XQt1411InBlock.BlockName, XQt1411InBlock.F.shcode, 0, shcode);                 // char 6
                instance.SetFieldData(XQt1411InBlock.BlockName, XQt1411InBlock.F.idx, 0, idx.ToString("d4"));        // long 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);
            }
        }
Пример #3
0
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, char gubun = default,char jongchk = default,char jkrate = default,string shcode = default,long idx = default */)
        {
            using (XQt1411 instance = new XQt1411())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt1411OutBlock1" : $"XQt1411OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt1411OutBlock1>(qo);
                return(results);
            }
        }
Пример #4
0
        public static XQt1411OutBlock1[] Get(char gubun = default, char jongchk = default, char jkrate = default, string shcode = default, long idx = default)
        {
            using (XQt1411 instance = new XQt1411())
            {
                instance.SetFieldData(XQt1411InBlock.BlockName, XQt1411InBlock.F.gubun, 0, gubun.ToString());        // char 1
                instance.SetFieldData(XQt1411InBlock.BlockName, XQt1411InBlock.F.jongchk, 0, jongchk.ToString());    // char 1
                instance.SetFieldData(XQt1411InBlock.BlockName, XQt1411InBlock.F.jkrate, 0, jkrate.ToString());      // char 1
                instance.SetFieldData(XQt1411InBlock.BlockName, XQt1411InBlock.F.shcode, 0, shcode);                 // char 6
                instance.SetFieldData(XQt1411InBlock.BlockName, XQt1411InBlock.F.idx, 0, idx.ToString("d4"));        // long 4

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

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

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.jkrate  = query.GetFieldData(block.GetBlockName(), "jkrate", 0).ParseLong("jkrate");       // long 3
                block.sjkrate = query.GetFieldData(block.GetBlockName(), "sjkrate", 0).ParseLong("sjkrate");     // long 3
                block.idx     = query.GetFieldData(block.GetBlockName(), "idx", 0).ParseLong("idx");             // long 4
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }