Example #1
0
        public static XQAllOutBlocks Get(string shcode = default, string date = default, string sdate = default, string edate = default)
        {
            using (XQt1927 instance = new XQt1927())
            {
                instance.SetFieldData(XQt1927InBlock.BlockName, XQt1927InBlock.F.shcode, 0, shcode);             // char 6
                instance.SetFieldData(XQt1927InBlock.BlockName, XQt1927InBlock.F.date, 0, date);                 // char 8
                instance.SetFieldData(XQt1927InBlock.BlockName, XQt1927InBlock.F.sdate, 0, sdate);               // char 8
                instance.SetFieldData(XQt1927InBlock.BlockName, XQt1927InBlock.F.edate, 0, edate);               // char 8

                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);
            }
        }
Example #2
0
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string shcode = default,string date = default,string sdate = default,string edate = default */)
        {
            using (XQt1927 instance = new XQt1927())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt1927OutBlock1" : $"XQt1927OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt1927OutBlock1>(qo);
                return(results);
            }
        }
Example #3
0
        public static XQt1927OutBlock1[] Get(string shcode = default, string date = default, string sdate = default, string edate = default)
        {
            using (XQt1927 instance = new XQt1927())
            {
                instance.SetFieldData(XQt1927InBlock.BlockName, XQt1927InBlock.F.shcode, 0, shcode);             // char 6
                instance.SetFieldData(XQt1927InBlock.BlockName, XQt1927InBlock.F.date, 0, date);                 // char 8
                instance.SetFieldData(XQt1927InBlock.BlockName, XQt1927InBlock.F.sdate, 0, sdate);               // char 8
                instance.SetFieldData(XQt1927InBlock.BlockName, XQt1927InBlock.F.edate, 0, edate);               // char 8

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

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }
Example #4
0
        public static XQt1927OutBlock FromQuery(XQt1927 query)
        {
            XQt1927OutBlock block = new XQt1927OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.date = query.GetFieldData(block.GetBlockName(), "date", 0).TrimEnd('?');                 // char 8
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Example #5
0
        public static XQt1927OutBlock1[] ListFromQuery(XQt1927 query)
        {
            int count = query.GetBlockCount(XQt1927OutBlock1.BlockName);
            List <XQt1927OutBlock1> list = new List <XQt1927OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1927OutBlock1 block = new XQt1927OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.date      = query.GetFieldData(block.GetBlockName(), "date", i).TrimEnd('?');                // char 8
                    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.value     = query.GetFieldData(block.GetBlockName(), "value", i).ParseLong("value");         // long 12
                    block.gm_vo     = query.GetFieldData(block.GetBlockName(), "gm_vo", i).ParseLong("gm_vo");         // long 12
                    block.gm_va     = query.GetFieldData(block.GetBlockName(), "gm_va", i).ParseLong("gm_va");         // long 12
                    block.gm_per    = query.GetFieldData(block.GetBlockName(), "gm_per", i).ParseFloat("gm_per");      // float 6.2
                    block.gm_avg    = query.GetFieldData(block.GetBlockName(), "gm_avg", i).ParseLong("gm_avg");       // long 12
                    block.gm_vo_sum = query.GetFieldData(block.GetBlockName(), "gm_vo_sum", i).ParseLong("gm_vo_sum"); // long 12
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }