private void NewClaim() { Console.Clear(); ClaimsContent enterClaim = new ClaimsContent(); Console.WriteLine("Enter the claim ID:"); string claimIdAsString = Console.ReadLine(); enterClaim.ClaimsID = int.Parse(claimIdAsString); Console.WriteLine("Enter the claim type(1, 2, or 3):"); string claimInput = Console.ReadLine(); int claimID = int.Parse(claimInput); enterClaim.TypeOfClaim = (ClaimsType)claimID; Console.WriteLine("Enter a claim description:"); enterClaim.Description = Console.ReadLine(); Console.WriteLine("Amount of damage(no $ necessary)"); string amountAsString = Console.ReadLine(); enterClaim.ClaimAmount = decimal.Parse(amountAsString); Console.WriteLine("Date of Accident(YYYY,MM,DD):"); enterClaim.DateOfIncident = DateTime.Parse(Console.ReadLine()); Console.WriteLine("Date of Claim(YYYY,MM,DD:"); enterClaim.DateOfClaim = DateTime.Parse(Console.ReadLine()); _claimsRepo.AddClaimToQueue(enterClaim); }
private void CreateNewClaim() { ClaimsContent claims = new ClaimsContent(); Console.WriteLine("What is the new claim ID?"); claims.ClaimId = int.Parse(Console.ReadLine()); Console.WriteLine("What is the Claim type?\n" + "1.)Car\n" + "2.)Home\n" + "3.)Theft"); int claimtypenum = int.Parse(Console.ReadLine()); claims.ClaimType = (ClaimType)claimtypenum; Console.WriteLine("Please desrcribe your claim"); claims.Description = Console.ReadLine(); Console.WriteLine("How much is the claim worth?"); claims.ClaimAmount = int.Parse(Console.ReadLine()); Console.WriteLine("What is the Date of the Incdent?"); claims.DateOfIncident = DateTime.Parse(Console.ReadLine()); Console.WriteLine("What date did was the claim filed?"); claims.DateOfClaim = DateTime.Parse(Console.ReadLine()); _claimrepo.AddToQueue(claims); }
public void TakeNextClaim() { Console.Clear(); ClaimsContent nextClaim = _claimsRepo.NextClaim(); Console.WriteLine("Do you want to deal with this claim now (y/n)?"); string answer = Console.ReadLine(); if (answer.ToLower() == "y") { _claimsRepo.TakeAwayClaim(); Console.WriteLine("Once finished. Press any key to save"); Console.ReadKey(); Menu(); } else if (answer.ToLower() == "n") { Console.WriteLine("Press any key to return to Main Menu"); Console.ReadKey(); Menu(); } else { Console.WriteLine("Please enter y or n\n" + "\n" + "Press any key to continue"); Console.ReadKey(); TakeNextClaim(); } }
//View existing Content by Claim ID private void DisplayContentByClaimId() { Console.Clear(); //Prompt for claim ID Console.WriteLine("Enter the claim ID of the claim you would like to see(Last Name, First Initial SmithA:)"); //Get the users input string claimId = Console.ReadLine(); //Find the content by that ID ClaimsContent content = _contentRepo.GetContentByClaimId(claimId); //Display Content if it isn't null if (content != null) { Console.WriteLine($"ClaimId: {content.ClaimId}\n" + $"Description: {content.Description}\n" + $"Claim Amount: {content.ClaimAmount}\n" + $"Date of Incident: {content.DateOfIncident}\n" + $"Date of Claim: {content.DateOfClaim}\n" + $"Is Valid:{content.IsValid}\n" + $"Type of Claim{content.TypeOfClaim}"); } else { Console.WriteLine("No content by that claim ID"); } }
public void CreateNewClaim_AddToClaim_CountShouldBeTheSame() { ////AAA/// ClaimsContent claims = new ClaimsContent(); ClaimsRepository _claimrepo = new ClaimsRepository(); Queue <ClaimsContent> queue = _claimrepo.SeeAllClaims(); ///AA/// ClaimsContent claim1 = new ClaimsContent(20, ClaimType.Home, "whole house burned down", 308987.34m, DateTime.Parse("03/01/2019"), DateTime.Parse("03/28/2019")); claim1.ClaimType = ClaimType.Home; ClaimType expected = ClaimType.Home; //A// Assert.AreEqual(expected, claim1.ClaimType); Assert.AreEqual(20, claim1.ClaimId); Assert.AreEqual("whole house burned down", claim1.Description); Assert.AreEqual(308987.34m, claim1.ClaimAmount); Assert.AreEqual(DateTime.Parse("03/01/2019"), claim1.DateOfIncident); Assert.AreEqual(DateTime.Parse("03/28/2019"), claim1.DateOfClaim); _claimrepo.AddToQueue(claim1); int expected1 = 1; int actual = queue.Count; Assert.AreEqual(expected1, actual); }
private void CreateClaim() { ClaimsContent content = new ClaimsContent(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("ENTER THE CLAIM ID. \n"); content.ClaimID = Int32.Parse(Console.ReadLine()); Console.WriteLine("ENTER THE CLAIM TYPE AS (HOME, CAR, THEFT) \n"); content.ClaimType = Console.ReadLine(); Console.WriteLine($"ENTER THE DESCRIPTION FOR THIS {content.ClaimType} CLAIM. \n"); content.Description = Console.ReadLine(); Console.WriteLine($"ENTER THE CLAIM AMOUNT WITHOUT A $ SIGN. \n"); content.ClaimAmount = double.Parse(Console.ReadLine()); Console.WriteLine($"ENTER THE DATE OF THE ACCIDENT (MM, DD, YY) FORMAT AND PRESS ENTER. \n"); content.DateOfIncident = DateTime.Parse(Console.ReadLine()); Console.WriteLine($"ENTER THE DATE OF THE CLAIM AND PRESS ENTER. \n"); content.DateOfClaim = DateTime.Parse(Console.ReadLine()); Console.WriteLine($"IS THIS CLAIM VALID? ENTER TRUE OR FALSE AND PRESS ENTER. \n"); if (Console.ReadLine().ToLower() == "true") { content.IsValid = true; } else { content.IsValid = false; } _contentRepository.AddContentToDirectory(content); }
// create new claim private void EnterANewClaim() { Console.Clear(); ClaimsContent newClaim = new ClaimsContent(); Console.WriteLine("Enter the ID for the new claim:\n"); string claimIDString = Console.ReadLine(); int claimIdInt = int.Parse(claimIDString); newClaim.ClaimID = claimIdInt; Console.Clear(); Console.WriteLine("\nEnter the claim type number for the new claim:\n" + "1. Car\n" + "2. Home\n" + "3. Theft\n\n"); string claimTypeAsString = Console.ReadLine(); int claimAsInt = int.Parse(claimTypeAsString); newClaim.ClaimType = (ClaimType)claimAsInt; Console.Clear(); Console.WriteLine("\nEnter a description for the new claim:\n"); newClaim.Description = Console.ReadLine(); Console.Clear(); Console.WriteLine("\nEnter the new claim amount:\n"); string claimAmountString = Console.ReadLine(); double amountAsInt = double.Parse(claimAmountString); newClaim.ClaimAmount = amountAsInt; Console.Clear(); Console.WriteLine("\nEnter the date of the accident (mm/dd/yyyy):\n"); DateTime accidentDate = DateTime.Parse(Console.ReadLine()); newClaim.DateOfAccident = accidentDate; Console.Clear(); Console.WriteLine("\nEnter the date of the new claim (mm/dd/yyyy):\n"); DateTime claimDate = DateTime.Parse(Console.ReadLine()); newClaim.DateOfClaim = claimDate; Console.Clear(); Console.WriteLine("\nIs this new claim valid? (y/n)\n"); string claimIsValid = Console.ReadLine().ToLower(); if (claimIsValid == "y") { newClaim.IsVaild = true; } else { newClaim.IsVaild = false; } _claimContentRepo.EnterANewClaim(newClaim); }
public void Arrange() { _repo = new ClaimsContentRepo(); _content = new ClaimsContent(1, ClaimsType.Car, "Car accident on 465.", 400, new DateTime(2018, 04, 25), new DateTime(2018, 04, 27)); Queue <ClaimsContent> _claimsrepo = new Queue <ClaimsContent>(); _claimsrepo.Enqueue(_content); }
public void ClaimDequeue_ShouldDequeue() { ClaimsContent content = new ClaimsContent(); ClaimsContentRepo repo = new ClaimsContentRepo(); bool wasDequeued = repo.ClaimDequeue(content); Assert.IsTrue(wasDequeued); }
public void AddClaimToQueue_ShouldAddToQueue() { ClaimsContent content = new ClaimsContent(); ClaimsContentRepo repo = new ClaimsContentRepo(); bool wasAdded = repo.AddClaimToQueue(content); Assert.IsTrue(wasAdded); }
private void SeedClaimList() { ClaimsContent claimOne = new ClaimsContent(1, ClaimType.Car, "Car accident on 465", 400.00m, new DateTime(2018, 4, 25), new DateTime.Day(2018, 4, 27), true); ClaimsContent claimTwo = new ClaimsContent(2, ClaimType.Home, "House fire in kitchen", 4000.00m, new DateTime(2018, 4, 11), new DateTime(2018, 4, 27), true); ClaimsContent claimThree = new ClaimsContent(3, ClaimType.Theft, "Stolen pancakes", 4.00m, new DateTime(2018, 4, 27), new DateTime(2018, 4, 27), false); claimsTest.AddNewClaim(claimOne); claimsTest.AddNewClaim(claimTwo); claimsTest.AddNewClaim(claimThree); }
//Seed method private void SeedContentList() { ClaimsContent jonesj = new ClaimsContent("JonesJ", "Hit telephone pole", 2300.00, "09/20/20", "09/21/20", true, ClaimType.Car); ClaimsContent smithb = new ClaimsContent("SmithB", "Roof collapsed", 15000.00, "09/10/20", "09/10/20", true, ClaimType.Home); ClaimsContent smythea = new ClaimsContent("SmytheA", "Purse stolen", 500.00, "09/25/20", "09/26/20", true, ClaimType.Theft); _contentRepo.AddContentToList(jonesj); _contentRepo.AddContentToList(smithb); _contentRepo.AddContentToList(smythea); }
private void SeedContentList() // SEED METHOD LIST { ClaimsContent firstClaim = new ClaimsContent(1, ClaimType.Auto, "Car accident on 465.", 400.00m, DateTime.Parse("04/25/2018"), DateTime.Parse("04/27/2018"), true); ClaimsContent secondClaim = new ClaimsContent(2, ClaimType.Home, "House fire in kitchen.", 4000.00m, DateTime.Parse("04/11/2018"), DateTime.Parse("04/12/2018"), true); ClaimsContent thirdClaim = new ClaimsContent(3, ClaimType.Theft, "Stolen pancakes", 4.00m, DateTime.Parse("04/27/2018"), DateTime.Parse("06/01/2018"), false); _testRepo.AddContentToQueue(firstClaim); _testRepo.AddContentToQueue(secondClaim); _testRepo.AddContentToQueue(thirdClaim); }
private void DeleteClaim() { ClaimsContent claim = _claimrepo.SeeNextClaim(); Console.WriteLine("Delete this claim"); claim.ClaimId = int.Parse(Console.ReadLine()); _claimrepo.DeleteCurrentClaim(); }
//Create new Claim Content private void CreateNewContent() { Console.Clear(); ClaimsContent newContent = new ClaimsContent(); //Claim ID Console.WriteLine("Enter the Claim ID (Last Name, First Initial SmithA):"); newContent.ClaimId = Console.ReadLine(); //Claim Type Console.WriteLine("Enter the claim type:\n" + "1. Car\n" + "2. Home\n" + "3. Theft"); string claimTypeAsString = Console.ReadLine(); int claimTypeAsInt = int.Parse(claimTypeAsString); newContent.TypeOfClaim = (ClaimType)claimTypeAsInt; //Desciption Console.WriteLine("Enter the Claim Description:"); newContent.Description = Console.ReadLine(); //Claim Amount Console.WriteLine("Enter the claim amount(555.55:"); string claimAsString = Console.ReadLine(); newContent.ClaimAmount = double.Parse(claimAsString); //Date Of Incident Console.WriteLine("Enter the date of the incident (ie 02/20/2020:"); newContent.DateOfIncident = Console.ReadLine(); //Date Of Claim Console.WriteLine("Enter the date of the claim (ie 02/24/2020:"); newContent.DateOfClaim = Console.ReadLine(); //Is Valid Console.WriteLine("Is the claim valid? (y/n):"); string isValidString = Console.ReadLine().ToLower(); if (isValidString == "y") { newContent.IsValid = true; } else { newContent.IsValid = false; } _contentRepo.AddContentToList(newContent); }
// Add new claim private void AddNewClaim() { Console.Clear(); ClaimsContent newClaimsContent = new ClaimsContent(); Console.WriteLine("Please enter new claim data:\n"); Console.WriteLine("Enter the new claim id: "); string newIdAsString = Console.ReadLine(); newClaimsContent.ClaimID = int.Parse(newIdAsString); Console.WriteLine("Enter the claim type number (1-3):\n" + "1) Auto\n" + "2) Home\n" + "3) Theft"); string claimTypeAsString = Console.ReadLine(); int claimTypeAsInt = int.Parse(claimTypeAsString); newClaimsContent.TypeOfClaim = (ClaimType)claimTypeAsInt; Console.WriteLine("Enter a claim description: "); newClaimsContent.Description = Console.ReadLine(); Console.Write("Amount of damage: $"); string dmgAmountAsString = Console.ReadLine(); newClaimsContent.ClaimAmount = decimal.Parse(dmgAmountAsString); Console.WriteLine("Date of Incident (dd/mm/yyyy): "); string incidentDateAsString = Console.ReadLine(); newClaimsContent.DateOfIncident = DateTime.Parse(incidentDateAsString); Console.WriteLine("Date of Claim (dd/mm/yyyy): "); string claimDateAsString = Console.ReadLine(); newClaimsContent.DateOfClaim = DateTime.Parse(claimDateAsString); DateTime incidentDate = newClaimsContent.DateOfIncident; DateTime claimDate = newClaimsContent.DateOfClaim; TimeSpan timeSpan = claimDate - incidentDate; if (timeSpan.Days <= 30) { Console.WriteLine("\nThis claim is valid"); } else { Console.WriteLine("\nThis claim is not valid due to being placed after 30 days from incident date."); } _contentRepo.AddContentToQueue(newClaimsContent); }
private void DisplaySingleMenu(ClaimsContent content) { Console.WriteLine ($"Claim ID: {content.ClaimID} \n" + $"Type: {content.ClaimType} \n" + $"Description: {content.Description} \n" + $"Amount: ${content.ClaimAmount} \n" + $"DateOfAccident: {content.DateOfIncident:MM/dd/yy} \n" + //format date time to show correclty $"DateOfClaim: {content.DateOfClaim:MM/dd/yy} \n" + //format date time to show correctly $"IsValid: {content.IsValid} \n"); }
private void DisplaySimpleMenu(ClaimsContent content) { Console.WriteLine ($"{content.ClaimID}" + " " + $"{content.ClaimType}" + " " + $"{content.Description}" + " " + $"${content.ClaimAmount}" + " " + $"{content.DateOfIncident:MM/dd/yy}" + " " + //format date time to show correclty $"{content.DateOfClaim:MM/dd/yy}" + " " + //format date time to show correctly $"{content.IsValid} \n"); }
public void GetContentByQueue_ShouldBeCorrectTrue() { ClaimsContent content = new ClaimsContent(); ClaimsContentRepo repo = new ClaimsContentRepo(); repo.AddClaimToQueue(content); Queue <ClaimsContent> testQueue = repo.GetContentFromQueue(); bool queueHasContent = testQueue.Contains(content); Assert.IsTrue(queueHasContent); }
//Seed method private void ClaimsList() { ClaimsContent claimOne = new ClaimsContent(1, ClaimType.Car, "Car accident on 465.", 400, DateTime.Parse("04/25/18"), DateTime.Parse("04/27/18"), true); ClaimsContent claimTwo = new ClaimsContent(2, ClaimType.Home, "House fire in kitchen", 4000, DateTime.Parse("04/11/18"), DateTime.Parse("04/12/18"), true); ClaimsContent claimThree = new ClaimsContent(3, ClaimType.Theft, "Stolen pancakes.", 4.00, DateTime.Parse("04/27/18"), DateTime.Parse("06/01/18"), false); _claimContentRepo.EnterANewClaim(claimOne); _claimContentRepo.EnterANewClaim(claimTwo); _claimContentRepo.EnterANewClaim(claimThree); }
public void InitialContent() //Test Data and Initial database content { DateTime dateOneIncident = new DateTime(2020, 5, 05); DateTime dateOneClaim = new DateTime(2020, 10, 07); DateTime dateTwoIncident = new DateTime(2020, 10, 07); DateTime dateTwoClaim = new DateTime(2020, 10, 07); var claimOne = new ClaimsContent(1, "home", "crazy accident", 1000.60f, dateOneIncident, dateOneClaim, false); var claimTwo = new ClaimsContent(2, "car", "accident with pole", 20000.50f, dateTwoIncident, dateTwoClaim, true); _contentRepository.AddContentToDirectory(claimOne); _contentRepository.AddContentToDirectory(claimTwo); }
private void TakeCareOfClaim() { ClaimsContent upNext = _claimsRepo.NextClaim(); Console.WriteLine("Do you want to deal with this claim now?(y/n)"); string userinput = Console.ReadLine(); if (userinput.ToLower() == "y") { _claimsRepo.ClaimDequeue(); } if (userinput.ToLower() == "n") { } }
public void NextClaim_ShouldBeCorrect() { _repo = new ClaimsContentRepo(); Queue <ClaimsContent> _queueofclaims = new Queue <ClaimsContent>(); _content = new ClaimsContent(); _content.ClaimsID = 1; _repo.AddClaimToQueue(_content); int test = 1; ClaimsContent claim = _repo.NextClaim(); int actual = claim.ClaimsID; Assert.AreEqual(actual, test); }
public void RemoveFromQueue() { ClaimsRepository _claimrepo = new ClaimsRepository(); Queue <ClaimsContent> queue = new Queue <ClaimsContent>(); ClaimsContent claim1 = new ClaimsContent(20, ClaimType.Home, "whole house burned down", 308987.34m, DateTime.Parse("03/01/2019"), DateTime.Parse("03/28/2019")); _claimrepo.AddToQueue(claim1); int expected = 0; _claimrepo.DeleteCurrentClaim(); int actual = queue.Count; Assert.AreEqual(expected, actual); }
public void DisplayAllClaims() { ////AAA//// ClaimsRepository _claimrepo = new ClaimsRepository(); ClaimsContent claim1 = new ClaimsContent(20, ClaimType.Home, "whole house burned down", 308987.34m, DateTime.Parse("03/01/2019"), DateTime.Parse("03/28/2019")); ///AA/// _claimrepo.AddToQueue(claim1); Queue <ClaimsContent> actual = _claimrepo.SeeAllClaims(); ClaimsContent peekQueue = actual.Peek(); //A// Assert.AreEqual(ClaimType.Home, peekQueue.ClaimType); }
private void ViewNextClaim() { ClaimsContent claim = _claimrepo.SeeNextClaim(); Console.WriteLine(claim.ClaimId + "\t", claim.ClaimType + "\t", claim.Description + "\t", claim.ClaimAmount + "\t", claim.DateOfIncident + "\t", claim.DateOfClaim + "\t", claim.IsValid); Console.WriteLine("Would you like to handle this claim?(y/n)"); string input = Console.ReadLine(); if (input != "y") { _claimrepo.DeleteCurrentClaim(); } else { Console.WriteLine("Press Enter to return to the main menu"); } Console.Clear(); RunMenu(); }
// Take care of next claim private void NextClaim() { Console.Clear(); Console.WriteLine("Here are the details for the next claim to be handled: "); Queue <ClaimsContent> newList = _contentRepo.GetClaimsContent(); ClaimsContent claimsQueue = newList.Peek(); Console.WriteLine($"Claim ID: {claimsQueue.ClaimID}\n" + $" Type of Claim: {claimsQueue.TypeOfClaim}\n" + $" Description: {claimsQueue.Description}\n" + $" Claim Amount: ${claimsQueue.ClaimAmount}\n" + $" Date of Incident: {claimsQueue.DateOfIncident.ToString("dd/MM/yyyy")}\n" + $" Date of Claim: {claimsQueue.DateOfClaim.ToString("dd/MM/yyyy")}\n" + $" isValid: {claimsQueue.IsValid}"); Console.WriteLine("\n\nDo you want to deal with this claim now(y/n)?"); string userInput = Console.ReadLine(); if (userInput.StartsWith("y")) { newList.Dequeue(); Console.WriteLine("\nClaim pulled successfully"); } else if (userInput.StartsWith("n")) { Console.WriteLine("Claim returned to queue"); } else { Console.WriteLine("Please enter either y or n"); } }
private void EnterNewClaim() { Console.Clear(); ClaimsContent newClaim = new ClaimsContent(); Console.WriteLine("What is the claim ID?"); string claimID = Console.ReadLine(); newClaim.ClaimID = int.Parse(claimID); Console.WriteLine("What is the Claim Type: Car, Home, Theft?"); string type = Console.ReadLine(); if (type.ToLower() == "car") { ClaimType claimType = ClaimType.Car; } else if (type.ToLower() == "home") { ClaimType claimType = ClaimType.Home; } else if (type.ToLower() == "theft") { ClaimType claimType = ClaimType.Theft; } else { Console.WriteLine("Please enter Car, Home, or Theft \n" + "\n" + "Press any key to continue"); Console.ReadKey(); EnterNewClaim(); } Console.WriteLine("List the description of the claim?"); newClaim.Description = Console.ReadLine(); Console.WriteLine("Amount?"); string claimAmount = Console.ReadLine(); newClaim.ClaimAmount = decimal.Parse(claimAmount); Console.WriteLine("What is Date of the Accident"); string dateOfIncident = Console.ReadLine(); newClaim.DateOfAccident = DateTime.Parse(dateOfIncident); Console.WriteLine("What is Date of the Claim"); string dateOfClaim = Console.ReadLine(); newClaim.DateOfClaim = DateTime.Parse(dateOfClaim); Console.WriteLine("Is it valid (true or false)"); string isValid = Console.ReadLine(); newClaim.IsValid = bool.Parse(isValid); _claimsRepo.AddNewClaim(newClaim); Console.WriteLine("\n" + "Claim Added.\n" + "\n" + "Press any key to return to menu"); Console.ReadKey(); Menu(); }
//Update Existing Content private void UpdateExistingContent() { //Display all content DisplayAllContent(); //Ask for the Claim ID of the title we wish to update Console.WriteLine("Enetr the Claim ID of the claim you would like to update:"); //Get that Claim ID string oldClaimId = Console.ReadLine(); //Build new object ClaimsContent newContent = new ClaimsContent(); //Claim ID Console.WriteLine("Enter the Claim ID (Last Name, First Initial SmithA):"); newContent.ClaimId = Console.ReadLine(); //Claim Type Console.WriteLine("Enter the claim type:\n" + "1. Car\n" + "2. Home\n" + "3. Theft"); string claimTypeAsString = Console.ReadLine(); int claimTypeAsInt = int.Parse(claimTypeAsString); newContent.TypeOfClaim = (ClaimType)claimTypeAsInt; //Desciption Console.WriteLine("Enter the Claim Description:"); newContent.Description = Console.ReadLine(); //Claim Amount Console.WriteLine("Enter the claim amount(555.55:"); string claimAsString = Console.ReadLine(); newContent.ClaimAmount = double.Parse(claimAsString); //Date Of Incident Console.WriteLine("Enter the date of the incident (ie 02/20/2020:"); newContent.DateOfIncident = Console.ReadLine(); //Date Of Claim Console.WriteLine("Enter the date of the claim (ie 02/24/2020:"); newContent.DateOfClaim = Console.ReadLine(); //Is Valid Console.WriteLine("Is the claim valid? (y/n):"); string isValidString = Console.ReadLine().ToLower(); if (isValidString == "y") { newContent.IsValid = true; } else { newContent.IsValid = false; } }