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

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt3102OutBlock1 block = new XQt3102OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.sBody = query.GetFieldData(block.GetBlockName(), "sBody", i).TrimEnd('?');                     // char 100
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
예제 #2
0
파일: t3102.cs 프로젝트: iPeterPan/XingAPI
        public static XQt3102OutBlock2 FromQuery(XQt3102 query)
        {
            XQt3102OutBlock2 block = new XQt3102OutBlock2();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.sTitle = query.GetFieldData(block.GetBlockName(), "sTitle", 0).TrimEnd('?');                 // char 300
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }