示例#1
0
        public static XQt2210OutBlock ReadFromDB(string tableNamePostfix = null /*, string focode = default,long cvolume = default,string stime = default,string etime = default */)
        {
            using (XQt2210 instance = new XQt2210())
            {
                string      tableName = (tableNamePostfix == null) ? "XQt2210OutBlock" : $"XQt2210OutBlock_{tableNamePostfix}";
                QueryOption qo        = new QueryOption(tableName);
                // if (focode != default) qo.Add("focode", focode);
                // if (cvolume != default) qo.Add("cvolume", cvolume);
                // if (stime != default) qo.Add("stime", stime);
                // if (etime != default) qo.Add("etime", etime);


                var outBlock = instance.Select <XQt2210OutBlock>(qo);
                return(outBlock);
            }
        }
示例#2
0
        public static XQt2210OutBlock Get(string focode = default, long cvolume = default, string stime = default, string etime = default)
        {
            using (XQt2210 instance = new XQt2210())
            {
                instance.SetFieldData(XQt2210InBlock.BlockName, XQt2210InBlock.F.focode, 0, focode);                   // char 8
                instance.SetFieldData(XQt2210InBlock.BlockName, XQt2210InBlock.F.cvolume, 0, cvolume.ToString("d12")); // long 12
                instance.SetFieldData(XQt2210InBlock.BlockName, XQt2210InBlock.F.stime, 0, stime);                     // char 4
                instance.SetFieldData(XQt2210InBlock.BlockName, XQt2210InBlock.F.etime, 0, etime);                     // char 4

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

                var outBlock = instance.GetBlock();
                if (outBlock.IsValidData == false)
                {
                    return(null);
                }
                return(outBlock);
            }
        }
示例#3
0
        public static XQt2210OutBlock FromQuery(XQt2210 query)
        {
            XQt2210OutBlock block = new XQt2210OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.mdvolume = query.GetFieldData(block.GetBlockName(), "mdvolume", 0).ParseLong("mdvolume");                 // long 8
                block.mdchecnt = query.GetFieldData(block.GetBlockName(), "mdchecnt", 0).ParseLong("mdchecnt");                 // long 8
                block.msvolume = query.GetFieldData(block.GetBlockName(), "msvolume", 0).ParseLong("msvolume");                 // long 8
                block.mschecnt = query.GetFieldData(block.GetBlockName(), "mschecnt", 0).ParseLong("mschecnt");                 // long 8
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }