}//logon //Verify Member and Submit Claim use cases //Allows the provider to continue to submit a claim after verifying the //member only if the member's status is Active. private void verifyMember() { try { Members members = new Members(); members.open(); bool canContinue = false; //Prompt the provider for a member number. long number = ui.promptForLong("Member Number: "); theMember = members.find(number); //Display the status of the member. if (theMember == null) { ui.message("Invalid member number."); } else if (theMember.getStatus() == 'A') { ui.message("Active Member\n"); canContinue = true; } else if (theMember.getStatus() == 'S') { ui.message("Suspended\n"); } else { ui.errorMessage("Invalid status: " + theMember.getStatus()); } if (canContinue) //Can continue only if member is active { //Submit Claim Use Case extension to the Verify Member Use Case string answer = ui.promptForString ("Continue to submit claim? (Y)es or (N)o: "); if (answer != null && answer.Length >= 1) { if (char.ToUpper(answer[0]) == 'Y') { //Create a new ClaimSubmitter control object new ClaimSubmitter(theProvider, theMember); } } } members.close(); } catch (FileNotFoundException ex) { //occurs if the file cannot be created ui.errorMessage(ex.Message); } }//verifyMember
/** Creates a new provider report generator which creates a new provider report. * @param provider the provider about whom the report is generated * @param endDate a date within the week for which the report is to be * generated * @throws FileNotFoundException if the file cannot be created. */ public ProviderReportGenerator(Provider provider, DateTime endDate) { Claims claims = null; Members members = null; Services services = null; //Create a new provider report report = new ProviderReport(provider, endDate); try { //create and open the collections of claims, members and services claims = new Claims(); claims.open(); members = new Members(); members.open(); services = new Services(); services.open(); int noConsultations = 0; //use to count number of consultations double totalFee = 0; //use to accumulate fee //get all claims submitted by provider List <Claim> providerClaims = claims.findByProvider(provider.getNumber()); //for each claim foreach (Claim nextClaim in providerClaims) { //test whether within date range if (nextClaim.getSubmissionDate().after(report.getStartDateRange()) && nextClaim.getSubmissionDate().before(report.getEndDateRange())) { //get the member to whom the service was provided string memberName; Member member = members.find(nextClaim.getMemberNumber()); if (member == null) { memberName = "Invalid Number"; } else { memberName = member.getName(); } //get the fee for the service double serviceFee; Service service = services.find(nextClaim.getServiceCode()); if (service == null) { serviceFee = 0; //indicates invalid code } else { serviceFee = service.getFee(); } //add claim details to report report.addDetail(nextClaim.getSubmissionDate(), nextClaim.getServiceDate(), nextClaim.getMemberNumber(), memberName, nextClaim.getServiceCode(), serviceFee); //increment number of consultations noConsultations++; //accumulate fee totalFee += serviceFee; } //if date in specified week } //for //add summary details to report report.addSummary(noConsultations, totalFee); }//try catch (FormatException ex) { report.addErrorMessage(ex.Message); } finally { if (claims != null) { claims.close(); } if (members != null) { members.close(); } if (services != null) { services.close(); } } }//constructor