Beispiel #1
0
        public static XQt4201OutBlock FromQuery(XQt4201 query)
        {
            XQt4201OutBlock block = new XQt4201OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.shcode    = query.GetFieldData(block.GetBlockName(), "shcode", 0).TrimEnd('?');              // char 6
                block.jisiga    = query.GetFieldData(block.GetBlockName(), "jisiga", 0).ParseLong("jisiga");       // long 8
                block.jihigh    = query.GetFieldData(block.GetBlockName(), "jihigh", 0).ParseLong("jihigh");       // long 8
                block.jilow     = query.GetFieldData(block.GetBlockName(), "jilow", 0).ParseLong("jilow");         // long 8
                block.jiclose   = query.GetFieldData(block.GetBlockName(), "jiclose", 0).ParseLong("jiclose");     // long 8
                block.jivolume  = query.GetFieldData(block.GetBlockName(), "jivolume", 0).ParseLong("jivolume");   // long 12
                block.disiga    = query.GetFieldData(block.GetBlockName(), "disiga", 0).ParseLong("disiga");       // long 8
                block.dihigh    = query.GetFieldData(block.GetBlockName(), "dihigh", 0).ParseLong("dihigh");       // long 8
                block.dilow     = query.GetFieldData(block.GetBlockName(), "dilow", 0).ParseLong("dilow");         // long 8
                block.diclose   = query.GetFieldData(block.GetBlockName(), "diclose", 0).ParseLong("diclose");     // long 8
                block.highend   = query.GetFieldData(block.GetBlockName(), "highend", 0).ParseLong("highend");     // long 8
                block.lowend    = query.GetFieldData(block.GetBlockName(), "lowend", 0).ParseLong("lowend");       // long 8
                block.cts_date  = query.GetFieldData(block.GetBlockName(), "cts_date", 0).TrimEnd('?');            // char 8
                block.cts_time  = query.GetFieldData(block.GetBlockName(), "cts_time", 0).TrimEnd('?');            // char 10
                block.cts_daygb = query.GetFieldData(block.GetBlockName(), "cts_daygb", 0).FirstOrDefault();       // char 1
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Beispiel #2
0
        public static XQAllOutBlocks Get(string shcode = default, char gubun = default, long ncnt = default, long qrycnt = default, char tdgb = default, string sdate = default, string edate = default, string cts_date = default, string cts_time = default, char cts_daygb = default)
        {
            using (XQt4201 instance = new XQt4201())
            {
                instance.SetFieldData(XQt4201InBlock.BlockName, XQt4201InBlock.F.shcode, 0, shcode);                  // char 6
                instance.SetFieldData(XQt4201InBlock.BlockName, XQt4201InBlock.F.gubun, 0, gubun.ToString());         // char 1
                instance.SetFieldData(XQt4201InBlock.BlockName, XQt4201InBlock.F.ncnt, 0, ncnt.ToString("d4"));       // long 4
                instance.SetFieldData(XQt4201InBlock.BlockName, XQt4201InBlock.F.qrycnt, 0, qrycnt.ToString("d4"));   // long 4
                instance.SetFieldData(XQt4201InBlock.BlockName, XQt4201InBlock.F.tdgb, 0, tdgb.ToString());           // char 1
                instance.SetFieldData(XQt4201InBlock.BlockName, XQt4201InBlock.F.sdate, 0, sdate);                    // char 8
                instance.SetFieldData(XQt4201InBlock.BlockName, XQt4201InBlock.F.edate, 0, edate);                    // char 8
                instance.SetFieldData(XQt4201InBlock.BlockName, XQt4201InBlock.F.cts_date, 0, cts_date);              // char 8
                instance.SetFieldData(XQt4201InBlock.BlockName, XQt4201InBlock.F.cts_time, 0, cts_time);              // char 10
                instance.SetFieldData(XQt4201InBlock.BlockName, XQt4201InBlock.F.cts_daygb, 0, cts_daygb.ToString()); // char 1

                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);
            }
        }
Beispiel #3
0
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string shcode = default,char gubun = default,long ncnt = default,long qrycnt = default,char tdgb = default,string sdate = default,string edate = default,string cts_date = default,string cts_time = default,char cts_daygb = default */)
        {
            using (XQt4201 instance = new XQt4201())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt4201OutBlock1" : $"XQt4201OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt4201OutBlock1>(qo);
                return(results);
            }
        }
Beispiel #4
0
        public static XQt4201OutBlock1[] ListFromQuery(XQt4201 query)
        {
            int count = query.GetBlockCount(XQt4201OutBlock1.BlockName);
            List <XQt4201OutBlock1> list = new List <XQt4201OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt4201OutBlock1 block = new XQt4201OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.date      = query.GetFieldData(block.GetBlockName(), "date", i).TrimEnd('?');                // char 8
                    block.time      = query.GetFieldData(block.GetBlockName(), "time", i).TrimEnd('?');                // char 10
                    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
                    block.close     = query.GetFieldData(block.GetBlockName(), "close", i).ParseLong("close");         // long 8
                    block.jdiff_vol = query.GetFieldData(block.GetBlockName(), "jdiff_vol", i).ParseLong("jdiff_vol"); // long 12
                    block.value     = query.GetFieldData(block.GetBlockName(), "value", i).ParseLong("value");         // long 12
                    block.jongchk   = query.GetFieldData(block.GetBlockName(), "jongchk", i).ParseLong("jongchk");     // long 13
                    block.rate      = query.GetFieldData(block.GetBlockName(), "rate", i).ParseDouble("rate");         // double 6.2
                    block.pricechk  = query.GetFieldData(block.GetBlockName(), "pricechk", i).ParseLong("pricechk");   // long 13
                    block.ratevalue = query.GetFieldData(block.GetBlockName(), "ratevalue", i).ParseLong("ratevalue"); // long 12
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }