Exemplo n.º 1
0
        public static XQAllOutBlocks Get(string upcode = default, char gubun1 = default, char gubun2 = default, string cts_date = default, int cnt = default, char rate_gbn = default)
        {
            using (XQt1514 instance = new XQt1514())
            {
                instance.SetFieldData(XQt1514InBlock.BlockName, XQt1514InBlock.F.upcode, 0, upcode);                 // char 3
                instance.SetFieldData(XQt1514InBlock.BlockName, XQt1514InBlock.F.gubun1, 0, gubun1.ToString());      // char 1
                instance.SetFieldData(XQt1514InBlock.BlockName, XQt1514InBlock.F.gubun2, 0, gubun2.ToString());      // char 1
                instance.SetFieldData(XQt1514InBlock.BlockName, XQt1514InBlock.F.cts_date, 0, cts_date);             // char 8
                instance.SetFieldData(XQt1514InBlock.BlockName, XQt1514InBlock.F.cnt, 0, cnt.ToString("d4"));        // int 4
                instance.SetFieldData(XQt1514InBlock.BlockName, XQt1514InBlock.F.rate_gbn, 0, rate_gbn.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);
            }
        }
Exemplo n.º 2
0
        public static XQt1514OutBlock1[] ListFromQuery(XQt1514 query)
        {
            int count = query.GetBlockCount(XQt1514OutBlock1.BlockName);
            List <XQt1514OutBlock1> list = new List <XQt1514OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1514OutBlock1 block = new XQt1514OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.date       = query.GetFieldData(block.GetBlockName(), "date", i).TrimEnd('?');                  // char 8
                    block.jisu       = query.GetFieldData(block.GetBlockName(), "jisu", i).ParseFloat("jisu");            // float 12.2
                    block.sign       = query.GetFieldData(block.GetBlockName(), "sign", i).FirstOrDefault();              // char 1
                    block.change     = query.GetFieldData(block.GetBlockName(), "change", i).ParseFloat("change");        // float 7.2
                    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.diff_vol   = query.GetFieldData(block.GetBlockName(), "diff_vol", i).ParseFloat("diff_vol");    // float 12.2
                    block.value1     = query.GetFieldData(block.GetBlockName(), "value1", i).ParseLong("value1");         // long 12
                    block.high       = query.GetFieldData(block.GetBlockName(), "high", i).ParseLong("high");             // long 4
                    block.unchg      = query.GetFieldData(block.GetBlockName(), "unchg", i).ParseLong("unchg");           // long 4
                    block.low        = query.GetFieldData(block.GetBlockName(), "low", i).ParseLong("low");               // long 4
                    block.uprate     = query.GetFieldData(block.GetBlockName(), "uprate", i).ParseFloat("uprate");        // float 6.2
                    block.frgsvolume = query.GetFieldData(block.GetBlockName(), "frgsvolume", i).ParseLong("frgsvolume"); // long 8
                    block.openjisu   = query.GetFieldData(block.GetBlockName(), "openjisu", i).ParseFloat("openjisu");    // float 12.2
                    block.highjisu   = query.GetFieldData(block.GetBlockName(), "highjisu", i).ParseFloat("highjisu");    // float 12.2
                    block.lowjisu    = query.GetFieldData(block.GetBlockName(), "lowjisu", i).ParseFloat("lowjisu");      // float 12.2
                    block.value2     = query.GetFieldData(block.GetBlockName(), "value2", i).ParseLong("value2");         // long 12
                    block.up         = query.GetFieldData(block.GetBlockName(), "up", i).ParseLong("up");                 // long 4
                    block.down       = query.GetFieldData(block.GetBlockName(), "down", i).ParseLong("down");             // long 4
                    block.totjo      = query.GetFieldData(block.GetBlockName(), "totjo", i).ParseLong("totjo");           // long 4
                    block.orgsvolume = query.GetFieldData(block.GetBlockName(), "orgsvolume", i).ParseLong("orgsvolume"); // long 8
                    block.upcode     = query.GetFieldData(block.GetBlockName(), "upcode", i).TrimEnd('?');                // char 3
                    block.rate       = query.GetFieldData(block.GetBlockName(), "rate", i).ParseFloat("rate");            // float 7.2
                    block.divrate    = query.GetFieldData(block.GetBlockName(), "divrate", i).ParseFloat("divrate");      // float 7.2
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
Exemplo n.º 3
0
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string upcode = default,char gubun1 = default,char gubun2 = default,string cts_date = default,int cnt = default,char rate_gbn = default */)
        {
            using (XQt1514 instance = new XQt1514())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt1514OutBlock1" : $"XQt1514OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt1514OutBlock1>(qo);
                return(results);
            }
        }
Exemplo n.º 4
0
        public static XQt1514OutBlock1[] Get(string upcode = default, char gubun1 = default, char gubun2 = default, string cts_date = default, int cnt = default, char rate_gbn = default)
        {
            using (XQt1514 instance = new XQt1514())
            {
                instance.SetFieldData(XQt1514InBlock.BlockName, XQt1514InBlock.F.upcode, 0, upcode);                 // char 3
                instance.SetFieldData(XQt1514InBlock.BlockName, XQt1514InBlock.F.gubun1, 0, gubun1.ToString());      // char 1
                instance.SetFieldData(XQt1514InBlock.BlockName, XQt1514InBlock.F.gubun2, 0, gubun2.ToString());      // char 1
                instance.SetFieldData(XQt1514InBlock.BlockName, XQt1514InBlock.F.cts_date, 0, cts_date);             // char 8
                instance.SetFieldData(XQt1514InBlock.BlockName, XQt1514InBlock.F.cnt, 0, cnt.ToString("d4"));        // int 4
                instance.SetFieldData(XQt1514InBlock.BlockName, XQt1514InBlock.F.rate_gbn, 0, rate_gbn.ToString());  // char 1

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

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }
Exemplo n.º 5
0
        public static XQt1514OutBlock FromQuery(XQt1514 query)
        {
            XQt1514OutBlock block = new XQt1514OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.cts_date = query.GetFieldData(block.GetBlockName(), "cts_date", 0).TrimEnd('?');                 // char 8
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }