public GetAgreementByAgreementIdMobileResponse getAgreement(GetAgreementByAgreementIdMobileRequest agreementByAgreementIdMobileRequest, string token, int vehicleId) { GetAgreementByAgreementIdMobileResponse response = null; GetVehicleDetailsMobileListResponse getVehicleDetailsMobile = null; VehicleService vehicleService = new VehicleService(); int vehicleTypeID = 0; int vehicleID = vehicleId; try { response = agreementService.getAgreement(agreementByAgreementIdMobileRequest, token); getVehicleDetailsMobile = vehicleService.getVehicleTypesMobile(token); foreach (VehicleTypeMobileResult vtmr in getVehicleDetailsMobile.listVehicle) { if (vtmr.VehicleType == response.custAgreement.AgreementDetail.VehicleType) { vehicleTypeID = vtmr.VehicleTypeId; } } if (vehicleId > 0 && vehicleTypeID > 0) { response.agreementVehicle = vehicleService.Getvehicle(vehicleTypeID, vehicleId, token); } } catch (Exception ex) { throw ex; } return(response); }
public List <CustomerAgreementModel> getAgreements(int customerId, string token) { List <CustomerAgreementModel> agreementModels = null; try { agreementModels = registerservice.getAgreements(customerId, token); if (agreementModels != null) { if (agreementModels.Count > 0) { GetVehicleDetailsMobileListResponse getVehicleDetailsMobile = null; VehicleService vehicleService = new VehicleService(); getVehicleDetailsMobile = vehicleService.getVehicleTypesMobile(token); AgreementService agreementService = new AgreementService(); foreach (CustomerAgreementModel cam in agreementModels) { if (cam.Status != null) { int agreeId = cam.AgreementId; int vehId = cam.VehicleId; int vehicleTypeID = 0; GetAgreementByAgreementIdMobileResponse agreementByAgreementIdMobileResponse = null; GetAgreementByAgreementIdMobileRequest agreementIdMobileRequest = new GetAgreementByAgreementIdMobileRequest(); agreementIdMobileRequest.agreementId = agreeId; agreementByAgreementIdMobileResponse = agreementService.getAgreement(agreementIdMobileRequest, token); cam.custAgreement = agreementByAgreementIdMobileResponse.custAgreement; foreach (VehicleTypeMobileResult vtmr in getVehicleDetailsMobile.listVehicle) { if (vtmr.VehicleType == agreementByAgreementIdMobileResponse.custAgreement.AgreementDetail.VehicleType) { vehicleTypeID = vtmr.VehicleTypeId; } } if (vehId > 0 && vehicleTypeID > 0) { cam.agreementVehicle = vehicleService.Getvehicle(vehicleTypeID, vehId, token); } } } } } } catch (Exception ex) { throw ex; } return(agreementModels); }