示例#1
0
        public static XQt8401OutBlock[] ListFromQuery(XQt8401 query)
        {
            int count = query.GetBlockCount(XQt8401OutBlock.BlockName);
            List <XQt8401OutBlock> list = new List <XQt8401OutBlock>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt8401OutBlock block = new XQt8401OutBlock();
                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.basecode = query.GetFieldData(block.GetBlockName(), "basecode", i).TrimEnd('?');               // char 9
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
示例#2
0
文件: t8401.cs 项目: tdoobw/XingAPI
        public static XQt8401OutBlock[] ReadFromDB(string tableNamePostfix = null /*, char dummy = default */)
        {
            using (XQt8401 instance = new XQt8401())
            {
                string      tableName = (tableNamePostfix == null) ? "XQt8401OutBlock" : $"XQt8401OutBlock_{tableNamePostfix}";
                QueryOption qo        = new QueryOption(tableName);
                // if (dummy != default) qo.Add("dummy", dummy);


                var outBlock = instance.SelectMany <XQt8401OutBlock>(qo);
                return(outBlock);
            }
        }
示例#3
0
        public static XQt8401OutBlock[] Get(char dummy = default)
        {
            using (XQt8401 instance = new XQt8401())
            {
                instance.SetFieldData(XQt8401InBlock.BlockName, XQt8401InBlock.F.dummy, 0, dummy.ToString());                 // char 1

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

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