Esempio n. 1
0
        public static XQAllOutBlocks Get(char gubun = default, char sign = default, char jgubun = default, string jongchk = default, long idx = default, char volume = default, long yesprice = default, long yeeprice = default, long yevolume = default)
        {
            using (XQt1488 instance = new XQt1488())
            {
                instance.SetFieldData(XQt1488InBlock.BlockName, XQt1488InBlock.F.gubun, 0, gubun.ToString());            // char 1
                instance.SetFieldData(XQt1488InBlock.BlockName, XQt1488InBlock.F.sign, 0, sign.ToString());              // char 1
                instance.SetFieldData(XQt1488InBlock.BlockName, XQt1488InBlock.F.jgubun, 0, jgubun.ToString());          // char 1
                instance.SetFieldData(XQt1488InBlock.BlockName, XQt1488InBlock.F.jongchk, 0, jongchk);                   // char 12
                instance.SetFieldData(XQt1488InBlock.BlockName, XQt1488InBlock.F.idx, 0, idx.ToString("d4"));            // long 4
                instance.SetFieldData(XQt1488InBlock.BlockName, XQt1488InBlock.F.volume, 0, volume.ToString());          // char 1
                instance.SetFieldData(XQt1488InBlock.BlockName, XQt1488InBlock.F.yesprice, 0, yesprice.ToString("d8"));  // long 8
                instance.SetFieldData(XQt1488InBlock.BlockName, XQt1488InBlock.F.yeeprice, 0, yeeprice.ToString("d8"));  // long 8
                instance.SetFieldData(XQt1488InBlock.BlockName, XQt1488InBlock.F.yevolume, 0, yevolume.ToString("d12")); // long 12

                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);
            }
        }
Esempio n. 2
0
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, char gubun = default,char sign = default,char jgubun = default,string jongchk = default,long idx = default,char volume = default,long yesprice = default,long yeeprice = default,long yevolume = default */)
        {
            using (XQt1488 instance = new XQt1488())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt1488OutBlock1" : $"XQt1488OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt1488OutBlock1>(qo);
                return(results);
            }
        }
Esempio n. 3
0
        public static XQt1488OutBlock FromQuery(XQt1488 query)
        {
            XQt1488OutBlock block = new XQt1488OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                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);
        }
Esempio n. 4
0
        public static XQt1488OutBlock1[] ListFromQuery(XQt1488 query)
        {
            int count = query.GetBlockCount(XQt1488OutBlock1.BlockName);
            List <XQt1488OutBlock1> list = new List <XQt1488OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1488OutBlock1 block = new XQt1488OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.hname      = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?');                 // char 20
                    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
                    block.offerrem   = query.GetFieldData(block.GetBlockName(), "offerrem", i).ParseLong("offerrem");     // long 8
                    block.offerho    = query.GetFieldData(block.GetBlockName(), "offerho", i).ParseLong("offerho");       // long 8
                    block.bidho      = query.GetFieldData(block.GetBlockName(), "bidho", i).ParseLong("bidho");           // long 8
                    block.bidrem     = query.GetFieldData(block.GetBlockName(), "bidrem", i).ParseLong("bidrem");         // long 8
                    block.cnt        = query.GetFieldData(block.GetBlockName(), "cnt", i).ParseLong("cnt");               // long 4
                    block.shcode     = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?');                // char 6
                    block.jkrate     = query.GetFieldData(block.GetBlockName(), "jkrate", i).TrimEnd('?');                // char 3
                    block.jnilvolume = query.GetFieldData(block.GetBlockName(), "jnilvolume", i).ParseLong("jnilvolume"); // long 12
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }