Esempio n. 1
0
        public static XQt9942OutBlock[] ListFromQuery(XQt9942 query)
        {
            int count = query.GetBlockCount(XQt9942OutBlock.BlockName);
            List <XQt9942OutBlock> list = new List <XQt9942OutBlock>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt9942OutBlock block = new XQt9942OutBlock();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.hname   = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?');                   // char 40
                    block.shcode  = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?');                  // char 6
                    block.expcode = query.GetFieldData(block.GetBlockName(), "expcode", i).TrimEnd('?');                 // char 12
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
Esempio n. 2
0
        public static XQt9942OutBlock[] ReadFromDB(string tableNamePostfix = null /*, char dummy = default */)
        {
            using (XQt9942 instance = new XQt9942())
            {
                string      tableName = (tableNamePostfix == null) ? "XQt9942OutBlock" : $"XQt9942OutBlock_{tableNamePostfix}";
                QueryOption qo        = new QueryOption(tableName);
                // if (dummy != default) qo.Add("dummy", dummy);


                var outBlock = instance.SelectMany <XQt9942OutBlock>(qo);
                return(outBlock);
            }
        }
Esempio n. 3
0
        public static XQt9942OutBlock[] Get(char dummy = default)
        {
            using (XQt9942 instance = new XQt9942())
            {
                instance.SetFieldData(XQt9942InBlock.BlockName, XQt9942InBlock.F.dummy, 0, dummy.ToString());                 // char 1

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

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