private void TakeNextClaim() { Console.Clear(); // Queue<Claim> queueList = _repo.ShowListOfClaims(); Claim peekClaim = _repo.ViewNextClaim(); Console.Clear(); DisplayContent(peekClaim); // Console.WriteLine(peekClaim); Console.WriteLine("Do you want to deal with this claim now(y/n)?"); string response = Console.ReadLine().ToLower(); if (response == "y") { _repo.RemoveClaimFromQueue(); Console.WriteLine("Claim Successfully removed from Queue"); Console.Read(); } else { Console.WriteLine("Press any key to return to main menu."); Console.Read(); } }
private void AddNewClaim() { Console.Clear(); Claim newClaim = new Claim(); Console.WriteLine("Enter ClaimID Number: "); string iDAsString = Console.ReadLine(); int idAsInt = Int32.Parse(iDAsString); newClaim.ClaimID = idAsInt; Console.WriteLine("Enter Claim Type:\n" + "1. Car\n" + "2. Home\n" + "3. Theft"); string typeinput = Console.ReadLine(); int typeAsInt = int.Parse(typeinput); newClaim.ClaimType = (ClaimType)typeAsInt; Console.WriteLine("Enter Claim Description: "); newClaim.Description = Console.ReadLine(); Console.WriteLine("Enter Amount of Claim(no $ sign)"); newClaim.ClaimAmount = Convert.ToDecimal(Console.ReadLine()); Console.WriteLine("Enter Date of Incident(MM/DD/YYYY): "); newClaim.DateOfIncident = DateTime.Parse(Console.ReadLine()); Console.WriteLine("Enter Date of Claim(MM/DD/YYYY): "); newClaim.DateOfClaim = DateTime.Parse(Console.ReadLine()); double checkValidity = CalculateIsValid(newClaim.DateOfClaim, newClaim.DateOfIncident); if (checkValidity <= 30) { newClaim.IsValid = true; } else { newClaim.IsValid = false; } bool claimCreated = _repo.CreateClaim(newClaim); if (claimCreated == true) { Console.WriteLine("Claim successfully added to queue"); } else { Console.WriteLine("Oops something went wrong. Claim not added."); } Console.Read(); }
private void DisplayContent(Claim claim) { Console.WriteLine($"CLaimID: {claim.ClaimID}"); Console.WriteLine($"Type: {claim.ClaimType}"); Console.WriteLine($"Description: {claim.Description}"); Console.WriteLine($"Amount: {claim.ClaimAmount}"); Console.WriteLine($"DateOfIncident: {claim.DateOfIncident.Date.ToString("d")}"); Console.WriteLine($"DateOfClaim: {claim.DateOfClaim.Date.ToString("d")}"); Console.WriteLine($"IsValid {claim.IsValid}"); }
private void SeedContent() { Claim claim1 = new Claim(1, ClaimType.Car, "Car accident on 465", 400.00m, new DateTime(2018, 4, 25), new DateTime(2018, 4, 27), true); Claim claim2 = new Claim(2, ClaimType.Home, "House fire in kitchen", 4000.00m, new DateTime(2018, 4, 11), new DateTime(2018, 4, 18), true); Claim claim3 = new Claim(3, ClaimType.Theft, "Stolen pancakes", 4.00m, new DateTime(2018, 4, 27), new DateTime(2018, 6, 1), false); _repo.CreateClaim(claim1); _repo.CreateClaim(claim2); _repo.CreateClaim(claim3); }
private void AllClaims(Claim claims) { Console.Clear(); Console.WriteLine("{0, -5}{1, 8}{2, 25}{3, 10}{4, 25}{5, 25}{6, 15}", "ClaimID", "Type", "Description", "Amount", "DateOfAccident", "DateOfClaim", "IsValid"); // Console.WriteLine("ClaimId Type Description Amount DateOfAccident DateOfClaim IsValid"); Queue <Claim> queueList = _repo.ShowListOfClaims(); foreach (Claim claim in queueList) { DisplayContent2(claim); Console.WriteLine(); } }
private void DisplayContent2(Claim claim) { Console.WriteLine("{0, 0}{1, 14}{2, 25}{3, 10}{4, 25}{5, 25}{6, 15}", claim.ClaimID, claim.ClaimType, claim.Description, claim.ClaimAmount, claim.DateOfIncident.Date.ToString("d"), claim.DateOfClaim.Date.ToString("d"), claim.IsValid); //Console.WriteLine($" {claim.ClaimID} {claim.ClaimType} {claim.Description} {claim.ClaimAmount}" + // $" {claim.DateOfIncident} {claim.DateOfClaim} {claim.IsValid}"); }