Exemple #1
0
        public static XQAllOutBlocks Get(string shcode = default, char gubun = default, string date = default, long idx = default)
        {
            using (XQt1921 instance = new XQt1921())
            {
                instance.SetFieldData(XQt1921InBlock.BlockName, XQt1921InBlock.F.shcode, 0, shcode);             // char 6
                instance.SetFieldData(XQt1921InBlock.BlockName, XQt1921InBlock.F.gubun, 0, gubun.ToString());    // char 1
                instance.SetFieldData(XQt1921InBlock.BlockName, XQt1921InBlock.F.date, 0, date);                 // char 8
                instance.SetFieldData(XQt1921InBlock.BlockName, XQt1921InBlock.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);
            }
        }
Exemple #2
0
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string shcode = default,char gubun = default,string date = default,long idx = default */)
        {
            using (XQt1921 instance = new XQt1921())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt1921OutBlock1" : $"XQt1921OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt1921OutBlock1>(qo);
                return(results);
            }
        }
Exemple #3
0
        public static XQt1921OutBlock1[] Get(string shcode = default, char gubun = default, string date = default, long idx = default)
        {
            using (XQt1921 instance = new XQt1921())
            {
                instance.SetFieldData(XQt1921InBlock.BlockName, XQt1921InBlock.F.shcode, 0, shcode);             // char 6
                instance.SetFieldData(XQt1921InBlock.BlockName, XQt1921InBlock.F.gubun, 0, gubun.ToString());    // char 1
                instance.SetFieldData(XQt1921InBlock.BlockName, XQt1921InBlock.F.date, 0, date);                 // char 8
                instance.SetFieldData(XQt1921InBlock.BlockName, XQt1921InBlock.F.idx, 0, idx.ToString("d4"));    // long 4

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

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }
Exemple #4
0
        public static XQt1921OutBlock FromQuery(XQt1921 query)
        {
            XQt1921OutBlock block = new XQt1921OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.cnt  = query.GetFieldData(block.GetBlockName(), "cnt", 0).ParseLong("cnt");              // long 4
                block.date = query.GetFieldData(block.GetBlockName(), "date", 0).TrimEnd('?');                 // char 8
                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);
        }
Exemple #5
0
        public static XQt1921OutBlock1[] ListFromQuery(XQt1921 query)
        {
            int count = query.GetBlockCount(XQt1921OutBlock1.BlockName);
            List <XQt1921OutBlock1> list = new List <XQt1921OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1921OutBlock1 block = new XQt1921OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.mmdate  = query.GetFieldData(block.GetBlockName(), "mmdate", i).TrimEnd('?');                    // char 8
                    block.close   = query.GetFieldData(block.GetBlockName(), "close", i).ParseLong("close");               // long 8
                    block.sign    = query.GetFieldData(block.GetBlockName(), "sign", i).FirstOrDefault();                  // char 1
                    block.jchange = query.GetFieldData(block.GetBlockName(), "jchange", i).ParseLong("jchange");           // long 8
                    block.diff    = query.GetFieldData(block.GetBlockName(), "diff", i).ParseFloat("diff");                // float 6.2
                    block.nvolume = query.GetFieldData(block.GetBlockName(), "nvolume", i).ParseLong("nvolume");           // long 8
                    block.svolume = query.GetFieldData(block.GetBlockName(), "svolume", i).ParseLong("svolume");           // long 8
                    block.jvolume = query.GetFieldData(block.GetBlockName(), "jvolume", i).ParseLong("jvolume");           // long 8
                    block.price   = query.GetFieldData(block.GetBlockName(), "price", i).ParseLong("price");               // long 8
                    block.change  = query.GetFieldData(block.GetBlockName(), "change", i).ParseLong("change");             // long 8
                    block.gyrate  = query.GetFieldData(block.GetBlockName(), "gyrate", i).ParseFloat("gyrate");            // float 6.2
                    block.jkrate  = query.GetFieldData(block.GetBlockName(), "jkrate", i).ParseFloat("jkrate");            // float 6.2
                    block.shcode  = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?');                    // char 6
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }