/// <summary> /// Gets the collateral array for obligor. /// </summary> /// <param name="ctx">The CTX.</param> /// <param name="errors">The errors.</param> /// <param name="outputs">The outputs.</param> /// <param name="getCollateralForDocIn">The get collateral for document in.</param> /// <returns></returns> private CollateralDetail[] GetCollateralArrayForObligor(ref ClientContext ctx, ref string errors, ref REQUEST_0189_FIELD[] outputs, GetCollateralForObligorInDocument getCollateralForDocIn) { inq.GetCollateralForObligor(ref getCollateralForDocIn.LUW_ID, ref getCollateralForDocIn.LUW_REQUEST_CODE, ref getCollateralForDocIn.LUW_BATCH_ID, ref getCollateralForDocIn.LUW_BANK, ref getCollateralForDocIn.LUW_OBLIGOR, ref getCollateralForDocIn.LUW_OBLIGATION, ref getCollateralForDocIn.LUW_ITEM_NBR, ref getCollateralForDocIn.SEG_COUNTER, ref getCollateralForDocIn.LUW_HEADER_RESTRICTIONS, ref getCollateralForDocIn.LUW_LENGTH, ref errors, out outputs, ref ctx); var collateralList = Array.ConvertAll<REQUEST_0189_FIELD, CollateralDetail>(outputs, delegate(REQUEST_0189_FIELD output) { CollateralDetail collateral = new CollateralDetail(); collateral.x189A_OBLN_ITEM = output.x189A_OBLN_ITEM; collateral.x189A_TYPE = output.x189A_TYPE; collateral.x189A_MODEL_DESC = output.x189A_MODEL_DESC; collateral.x189A_DESC = output.x189A_DESC; return collateral; }); return collateralList; }
/// <summary> /// Gets the collateral for obligor. /// </summary> /// <param name="request">The request.</param> /// <returns></returns> public GetCollateralForObligorResponse GetCollateralForObligor(GetCollateralForObligorRequest request) { ClientContext ctx = GetClientContext(request.User, request.Password); string errors = null; string outputBlock = string.Empty; int noOfRequery = 0; REQUEST_0189_FIELD outputField = new REQUEST_0189_FIELD { x189A_DESC = string.Empty, x189A_MODEL_DESC = string.Empty, x189A_OBLN_ITEM = string.Empty, x189A_TYPE = string.Empty }; REQUEST_0189_FIELD[] outputs = new REQUEST_0189_FIELD[120]; for (int i = 0; i < 120; i++) { outputs[i] = outputField; } var getCollateralForDocIn = new InquiryServicesContext.GetCollateralForObligorInDocument { LUW_BANK = request.BankId, LUW_BATCH_ID = request.BatchID, LUW_ERROR_MESSAGES = request.Errors, LUW_HEADER_RESTRICTIONS = Constants.LUW_HEADER_REST_CALL_APPL, LUW_ID = request.Luw, LUW_ITEM_NBR = request.ItemNumber, LUW_LENGTH = request.DataLength, LUW_OBLIGATION = request.ObligationNumber, LUW_OBLIGOR = request.ObligorNumber, LUW_REQUEST_CODE = request.RestartRequestCode, SEG_COUNTER = request.Segment }; try { var collateralList = GetCollateralArrayForObligor(ref ctx, ref errors, ref outputs, getCollateralForDocIn); //Need to requery for more data if segcounter is populated bool isRequery = int.TryParse(getCollateralForDocIn.SEG_COUNTER, out noOfRequery); if (isRequery && noOfRequery > 0) { //Concat the results FastConcat<CollateralDetail> collateralObligorArray = new FastConcat<CollateralDetail>(); collateralObligorArray.Add(collateralList); while (noOfRequery > 0) { //Set a new requery LUW ID getCollateralForDocIn.LUW_ID = Constants.GET_COLL_OBLGR_REQUERY_LUW_ID; var reQueryCollarteralList = GetCollateralArrayForObligor(ref ctx, ref errors, ref outputs, getCollateralForDocIn); //Append requery collateral list to the concat list collateralObligorArray.Add(reQueryCollarteralList); isRequery = int.TryParse(getCollateralForDocIn.SEG_COUNTER, out noOfRequery); } return new GetCollateralForObligorResponse() { CollateralList = collateralObligorArray.ToList(), Errors = errors }; } return new GetCollateralForObligorResponse() { CollateralList = collateralList.ToList(), Errors = errors }; } catch (Microsoft.HostIntegration.TI.CustomTIException Ex) { return HandleHISException<GetCollateralForObligorResponse>(Ex, request, "GetCollateralForObligor"); } catch (Exception ee) { string msg = ee.Message; throw; } }