Ejemplo n.º 1
0
        public static XQAllOutBlocks Get(char gubun1 = default, char gubun2 = default, string shcode = default, string date = default, string time = default, long cts_idx = default)
        {
            using (XQt1637 instance = new XQt1637())
            {
                instance.SetFieldData(XQt1637InBlock.BlockName, XQt1637InBlock.F.gubun1, 0, gubun1.ToString());       // char 1
                instance.SetFieldData(XQt1637InBlock.BlockName, XQt1637InBlock.F.gubun2, 0, gubun2.ToString());       // char 1
                instance.SetFieldData(XQt1637InBlock.BlockName, XQt1637InBlock.F.shcode, 0, shcode);                  // char 6
                instance.SetFieldData(XQt1637InBlock.BlockName, XQt1637InBlock.F.date, 0, date);                      // char 8
                instance.SetFieldData(XQt1637InBlock.BlockName, XQt1637InBlock.F.time, 0, time);                      // char 6
                instance.SetFieldData(XQt1637InBlock.BlockName, XQt1637InBlock.F.cts_idx, 0, cts_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);
            }
        }
Ejemplo n.º 2
0
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, char gubun1 = default,char gubun2 = default,string shcode = default,string date = default,string time = default,long cts_idx = default */)
        {
            using (XQt1637 instance = new XQt1637())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt1637OutBlock1" : $"XQt1637OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt1637OutBlock1>(qo);
                return(results);
            }
        }
Ejemplo n.º 3
0
        public static XQt1637OutBlock1[] Get(char gubun1 = default, char gubun2 = default, string shcode = default, string date = default, string time = default, long cts_idx = default)
        {
            using (XQt1637 instance = new XQt1637())
            {
                instance.SetFieldData(XQt1637InBlock.BlockName, XQt1637InBlock.F.gubun1, 0, gubun1.ToString());       // char 1
                instance.SetFieldData(XQt1637InBlock.BlockName, XQt1637InBlock.F.gubun2, 0, gubun2.ToString());       // char 1
                instance.SetFieldData(XQt1637InBlock.BlockName, XQt1637InBlock.F.shcode, 0, shcode);                  // char 6
                instance.SetFieldData(XQt1637InBlock.BlockName, XQt1637InBlock.F.date, 0, date);                      // char 8
                instance.SetFieldData(XQt1637InBlock.BlockName, XQt1637InBlock.F.time, 0, time);                      // char 6
                instance.SetFieldData(XQt1637InBlock.BlockName, XQt1637InBlock.F.cts_idx, 0, cts_idx.ToString("d4")); // long 4

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

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }
Ejemplo n.º 4
0
        public static XQt1637OutBlock FromQuery(XQt1637 query)
        {
            XQt1637OutBlock block = new XQt1637OutBlock();

            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_idx = query.GetFieldData(block.GetBlockName(), "cts_idx", 0).ParseLong("cts_idx");                 // long 4
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Ejemplo n.º 5
0
        public static XQt1637OutBlock1[] ListFromQuery(XQt1637 query)
        {
            int count = query.GetBlockCount(XQt1637OutBlock1.BlockName);
            List <XQt1637OutBlock1> list = new List <XQt1637OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1637OutBlock1 block = new XQt1637OutBlock1();
                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 6
                    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.svalue      = query.GetFieldData(block.GetBlockName(), "svalue", i).ParseLong("svalue");           // long 15
                    block.offervalue  = query.GetFieldData(block.GetBlockName(), "offervalue", i).ParseLong("offervalue");   // long 15
                    block.stksvalue   = query.GetFieldData(block.GetBlockName(), "stksvalue", i).ParseLong("stksvalue");     // long 15
                    block.svolume     = query.GetFieldData(block.GetBlockName(), "svolume", i).ParseLong("svolume");         // long 12
                    block.offervolume = query.GetFieldData(block.GetBlockName(), "offervolume", i).ParseLong("offervolume"); // long 12
                    block.stksvolume  = query.GetFieldData(block.GetBlockName(), "stksvolume", i).ParseLong("stksvolume");   // long 12
                    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());
        }