Exemplo n.º 1
0
        public static XQt0441OutBlock FromQuery(XQt0441 query)
        {
            XQt0441OutBlock block = new XQt0441OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.tdtsunik    = query.GetFieldData(block.GetBlockName(), "tdtsunik", 0).ParseLong("tdtsunik");        // long 18
                block.cts_expcode = query.GetFieldData(block.GetBlockName(), "cts_expcode", 0).TrimEnd('?');              // char 8
                block.cts_medocd  = query.GetFieldData(block.GetBlockName(), "cts_medocd", 0).FirstOrDefault();           // char 1
                block.tappamt     = query.GetFieldData(block.GetBlockName(), "tappamt", 0).ParseLong("tappamt");          // long 18
                block.tsunik      = query.GetFieldData(block.GetBlockName(), "tsunik", 0).ParseLong("tsunik");            // long 18
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Exemplo n.º 2
0
        public static XQt0441OutBlock1[] ListFromQuery(XQt0441 query)
        {
            int count = query.GetBlockCount(XQt0441OutBlock1.BlockName);
            List <XQt0441OutBlock1> list = new List <XQt0441OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt0441OutBlock1 block = new XQt0441OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.expcode    = query.GetFieldData(block.GetBlockName(), "expcode", i).TrimEnd('?');                // char 8
                    block.medosu     = query.GetFieldData(block.GetBlockName(), "medosu", i).TrimEnd('?');                 // char 4
                    block.jqty       = query.GetFieldData(block.GetBlockName(), "jqty", i).ParseLong("jqty");              // long 10
                    block.cqty       = query.GetFieldData(block.GetBlockName(), "cqty", i).ParseLong("cqty");              // long 10
                    block.pamt       = query.GetFieldData(block.GetBlockName(), "pamt", i).ParseFloat("pamt");             // float 10.2
                    block.mamt       = query.GetFieldData(block.GetBlockName(), "mamt", i).ParseLong("mamt");              // long 18
                    block.medocd     = query.GetFieldData(block.GetBlockName(), "medocd", i).FirstOrDefault();             // char 1
                    block.dtsunik    = query.GetFieldData(block.GetBlockName(), "dtsunik", i).ParseLong("dtsunik");        // long 18
                    block.sysprocseq = query.GetFieldData(block.GetBlockName(), "sysprocseq", i).ParseLong("sysprocseq");  // long 10
                    block.price      = query.GetFieldData(block.GetBlockName(), "price", i).ParseFloat("price");           // float 9.2
                    block.appamt     = query.GetFieldData(block.GetBlockName(), "appamt", i).ParseLong("appamt");          // long 18
                    block.dtsunik1   = query.GetFieldData(block.GetBlockName(), "dtsunik1", i).ParseLong("dtsunik1");      // long 18
                    block.sunikrt    = query.GetFieldData(block.GetBlockName(), "sunikrt", i).ParseFloat("sunikrt");       // float 10.2
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }