Example #1
0
        public static XQt1640OutBlock FromQuery(XQt1640 query)
        {
            XQt1640OutBlock block = new XQt1640OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.offervolume  = query.GetFieldData(block.GetBlockName(), "offervolume", 0).ParseLong("offervolume");     // long 8
                block.bidvolume    = query.GetFieldData(block.GetBlockName(), "bidvolume", 0).ParseLong("bidvolume");         // long 8
                block.volume       = query.GetFieldData(block.GetBlockName(), "volume", 0).ParseLong("volume");               // long 8
                block.offerdiff    = query.GetFieldData(block.GetBlockName(), "offerdiff", 0).ParseLong("offerdiff");         // long 8
                block.biddiff      = query.GetFieldData(block.GetBlockName(), "biddiff", 0).ParseLong("biddiff");             // long 8
                block.sundiff      = query.GetFieldData(block.GetBlockName(), "sundiff", 0).ParseLong("sundiff");             // long 8
                block.basis        = query.GetFieldData(block.GetBlockName(), "basis", 0).ParseFloat("basis");                // float 6.2
                block.offervalue   = query.GetFieldData(block.GetBlockName(), "offervalue", 0).ParseDouble("offervalue");     // double 12.0
                block.bidvalue     = query.GetFieldData(block.GetBlockName(), "bidvalue", 0).ParseDouble("bidvalue");         // double 12.0
                block.value        = query.GetFieldData(block.GetBlockName(), "value", 0).ParseDouble("value");               // double 12.0
                block.offervaldiff = query.GetFieldData(block.GetBlockName(), "offervaldiff", 0).ParseDouble("offervaldiff"); // double 12.0
                block.bidvaldiff   = query.GetFieldData(block.GetBlockName(), "bidvaldiff", 0).ParseDouble("bidvaldiff");     // double 12.0
                block.sunvaldiff   = query.GetFieldData(block.GetBlockName(), "sunvaldiff", 0).ParseDouble("sunvaldiff");     // double 12.0
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Example #2
0
        public static XQt1640OutBlock ReadFromDB(string tableNamePostfix = null /*, string gubun = default */)
        {
            using (XQt1640 instance = new XQt1640())
            {
                string      tableName = (tableNamePostfix == null) ? "XQt1640OutBlock" : $"XQt1640OutBlock_{tableNamePostfix}";
                QueryOption qo        = new QueryOption(tableName);
                // if (gubun != default) qo.Add("gubun", gubun);


                var outBlock = instance.Select <XQt1640OutBlock>(qo);
                return(outBlock);
            }
        }
Example #3
0
        public static XQt1640OutBlock Get(string gubun = default)
        {
            using (XQt1640 instance = new XQt1640())
            {
                instance.SetFieldData(XQt1640InBlock.BlockName, XQt1640InBlock.F.gubun, 0, gubun);                 // char 2

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

                var outBlock = instance.GetBlock();
                if (outBlock.IsValidData == false)
                {
                    return(null);
                }
                return(outBlock);
            }
        }