예제 #1
0
파일: t8432.cs 프로젝트: iPeterPan/XingAPI
        public static XQt8432OutBlock[] ListFromQuery(XQt8432 query)
        {
            int count = query.GetBlockCount(XQt8432OutBlock.BlockName);
            List <XQt8432OutBlock> list = new List <XQt8432OutBlock>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt8432OutBlock block = new XQt8432OutBlock();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.hname      = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?');                  // char 20
                    block.shcode     = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?');                 // char 8
                    block.expcode    = query.GetFieldData(block.GetBlockName(), "expcode", i).TrimEnd('?');                // char 12
                    block.uplmtprice = query.GetFieldData(block.GetBlockName(), "uplmtprice", i).ParseFloat("uplmtprice"); // float 6.2
                    block.dnlmtprice = query.GetFieldData(block.GetBlockName(), "dnlmtprice", i).ParseFloat("dnlmtprice"); // float 6.2
                    block.jnilclose  = query.GetFieldData(block.GetBlockName(), "jnilclose", i).ParseFloat("jnilclose");   // float 6.2
                    block.jnilhigh   = query.GetFieldData(block.GetBlockName(), "jnilhigh", i).ParseFloat("jnilhigh");     // float 6.2
                    block.jnillow    = query.GetFieldData(block.GetBlockName(), "jnillow", i).ParseFloat("jnillow");       // float 6.2
                    block.recprice   = query.GetFieldData(block.GetBlockName(), "recprice", i).ParseFloat("recprice");     // float 6.2
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
예제 #2
0
파일: t8432.cs 프로젝트: tdoobw/XingAPI
        public static XQt8432OutBlock[] ReadFromDB(string tableNamePostfix = null /*, char gubun = default */)
        {
            using (XQt8432 instance = new XQt8432())
            {
                string      tableName = (tableNamePostfix == null) ? "XQt8432OutBlock" : $"XQt8432OutBlock_{tableNamePostfix}";
                QueryOption qo        = new QueryOption(tableName);
                // if (gubun != default) qo.Add("gubun", gubun);


                var outBlock = instance.SelectMany <XQt8432OutBlock>(qo);
                return(outBlock);
            }
        }
예제 #3
0
파일: t8432.cs 프로젝트: iPeterPan/XingAPI
        public static XQt8432OutBlock[] Get(char gubun = default)
        {
            using (XQt8432 instance = new XQt8432())
            {
                instance.SetFieldData(XQt8432InBlock.BlockName, XQt8432InBlock.F.gubun, 0, gubun.ToString());                 // char 1

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

                var outBlock = instance.GetBlocks();
                return(outBlock);
            }
        }