private void CreateNewClaim() { Console.Clear(); ClaimItems claim = new ClaimItems(); Console.WriteLine("Enter an ID number for the Claim"); claim.ClaimID = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Select a claim type:\n" + "1. Car\n" + "2. Home\n" + "3. Theft\n"); double claimItem = Convert.ToInt32(Console.ReadLine()); claim.ClaimType = (ClaimType)claimItem; Console.WriteLine("Enter a claim description:\n"); claim.Description = Console.ReadLine(); Console.WriteLine("Enter the amount of the claim:\n" + "$ "); claim.ClaimAmount = Convert.ToDecimal(Console.ReadLine()); Console.WriteLine("Enter the date of the incident:" + "please use the format 'YYYY, MM, DD'\n"); claim.DateOfIncident = Convert.ToDateTime(Console.ReadLine()); Console.WriteLine("Enter the date the claim was filed:" + "please use the format 'YYYY, MM, DD'\n"); claim.DateOfClaim = Convert.ToDateTime(Console.ReadLine()); _claimRepo.AddClaimToDirectory(claim); }
public void AddNewClaim() { Console.WriteLine("Enter the claim ID: "); string claimIDAsString = Console.ReadLine(); int claimID = int.Parse(claimIDAsString); Console.WriteLine("What type of claim is this?\n" + "1. Car\n" + "2. Home\n" + "3. Theft\n"); string typeOfClaimAsString = Console.ReadLine(); int typeOfClaimAsInt = int.Parse(typeOfClaimAsString); ClaimType typeOfClaim = (ClaimType)typeOfClaimAsInt; Console.WriteLine("Enter a description of the claim: "); string description = Console.ReadLine(); Console.WriteLine("Amount of damage: "); string claimAmountAsString = Console.ReadLine(); float claimAmount = float.Parse(claimAmountAsString); Console.WriteLine("Enter date of incident as DD/MM/YYYY: "); string dateOfIncidentAsString = Console.ReadLine(); DateTime dateOfIncident = DateTime.Parse(dateOfIncidentAsString); Console.WriteLine("Enter date of claim as DD/MM/YYYY: "); string dateOfClaimAsString = Console.ReadLine(); DateTime dateOfClaim = DateTime.Parse(dateOfClaimAsString); ClaimItems newClaim = new ClaimItems(claimID, typeOfClaim, description, claimAmount, dateOfIncident, dateOfClaim); _repo.AddNewClaim(newClaim); }
public async Task <IActionResult> Edit(int id, [Bind("Claimitemid,Reportid,Itemid")] ClaimItems claimItems) { if (id != claimItems.Claimitemid) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(claimItems); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClaimItemsExists(claimItems.Claimitemid)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Itemid"] = new SelectList(_context.PolicyItems, "Itemid", "Itemname", claimItems.Itemid); ViewData["Reportid"] = new SelectList(_context.ClaimReport, "Reportid", "Reportid", claimItems.Reportid); return(View(claimItems)); }
public void AddNewClaim() { ClaimItems claim = new ClaimItems(); ClaimRepository repo = new ClaimRepository(); repo.SeedList(); }
public void RemoveClaimFromQueue() { Queue <ClaimItems> claimItems = _repo.SeeAllClaims(); ClaimItems claim = claimItems.Dequeue(); Console.WriteLine("Claim removed from queue, hit any key to continue...\n"); Console.ReadKey(); }
public void GetNextClaim_ShouldReturnCorrectItem() { //ACT ClaimItems nextClaim = _repo.GetItemsById(4); //ASSERT Assert.AreEqual(_content, nextClaim); }
public void GetById_ShouldReturnCorrectItem() { //ACT ClaimItems searchResult = _repo.GetItemsById(4); //ASSERT Assert.AreEqual(_content, searchResult); }
public void DeleteMenuItems_ShouldReturnTrue() { //ARRANGE ClaimItems deleteContent = _repo.GetItemsById(4); //ACT bool removeResult = _repo.RemoveClaim(deleteContent); //ASSERT Assert.IsTrue(removeResult); }
public void AddClaim_ShouldGetCorrectBoolean() { //ARRANGE ClaimItems newClaim = new ClaimItems(); ClaimItemsRepository repo = new ClaimItemsRepository(); //ACT bool addResult = repo.AddNewClaim(newClaim); //ASSERT Assert.IsTrue(addResult); }
public void AddClaims_ShouldAddNewClaimsToDirectory() { ClaimItems claimExample = new ClaimItems(7, ClaimType.Home, "Claim example", 123.45m, new DateTime(2020, 01, 01), new DateTime(2020, 02, 01)); bool addedClaim = _claimRepo.AddClaimToDirectory(claimExample); Console.WriteLine(_claimRepo.Count); Console.WriteLine(addedClaim); Console.WriteLine(claimExample.Description); Assert.IsTrue(addedClaim); }
private void DisplayNext(ClaimItems nextClaim) { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine($"ClaimID: {nextClaim.ClaimId}\n" + $"Type: {nextClaim.Type}\n" + $"Description: {nextClaim.Description}\n" + $"Amount: ${nextClaim.Amount}\n" + $"Date Of Accident: {nextClaim.DateOfAccident:M/dd/yy}\n" + $"Date Of Claim: {nextClaim.DateOfClaim:M/dd/yy}\n" + $"Is Valid: {nextClaim.IsValid}\n" + ""); }
public async Task <IActionResult> Create([Bind("Claimitemid,Reportid,Itemid")] ClaimItems claimItems) { if (ModelState.IsValid) { _context.Add(claimItems); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["Itemid"] = new SelectList(_context.PolicyItems, "Itemid", "Itemname", claimItems.Itemid); ViewData["Reportid"] = new SelectList(_context.ClaimReport, "Reportid", "Reportid", claimItems.Reportid); return(View(claimItems)); }
private void SeedClaimList() { ClaimItems carWreck = new ClaimItems(1, ClaimType.Car, "Backed car into garage door.", 1214.53m, new DateTime(2020, 04, 12), new DateTime(2020, 05, 01)); ClaimItems theft = new ClaimItems(2, ClaimType.Theft, "Stole tools from garage", 2236.71m, new DateTime(2021, 01, 01), new DateTime(2021, 02, 08)); ClaimItems hailDamage = new ClaimItems(3, ClaimType.Home, "Hail storm", 13503.53m, new DateTime(2020, 07, 12), new DateTime(2020, 08, 01)); ClaimItems truckHailDamage = new ClaimItems(4, ClaimType.Car, "Hail damage to body of truck", 3017.25m, new DateTime(2020, 07, 12), new DateTime(2020, 08, 01)); ClaimItems floodDamage = new ClaimItems(5, ClaimType.Home, "Flood damage to first two floors", 20500.53m, new DateTime(2020, 06, 12), new DateTime(2020, 08, 01)); _claimRepo.AddClaimToDirectory(carWreck); _claimRepo.AddClaimToDirectory(theft); _claimRepo.AddClaimToDirectory(hailDamage); _claimRepo.AddClaimToDirectory(truckHailDamage); _claimRepo.AddClaimToDirectory(floodDamage); }
public void GetAllClaims_ShouldReturnCorrectListOfClaims() { //ARRANGE ClaimItems newObject = new ClaimItems(); ClaimItemsRepository repository = new ClaimItemsRepository(); repository.AddNewClaim(newObject); //ACT List <ClaimItems> listOfClaimItems = repository.GetAllClaims(); //ASSERT bool claimHasItems = listOfClaimItems.Contains(newObject); Assert.IsTrue(claimHasItems); }
private void SeedContent() { var dateOne = new DateTime(18, 04, 25); var dateTwo = new DateTime(18, 04, 27); var dateThree = new DateTime(18, 04, 11); var dateFour = new DateTime(18, 04, 12); var dateFive = new DateTime(18, 04, 27); var dateSix = new DateTime(18, 06, 01); var claimOne = new ClaimItems(1, ClaimType.Car, "Car accident on 465.", 400.00f, dateOne, dateTwo, true); var claimTwo = new ClaimItems(2, ClaimType.Home, "House fire in kitchen.", 4000.00f, dateThree, dateFour, true); var claimThree = new ClaimItems(3, ClaimType.Theft, "Stolen pancakes.", 4.00f, dateFive, dateSix, false); _claimItemsRepo.AddNewClaim(claimOne); _claimItemsRepo.AddNewClaim(claimTwo); _claimItemsRepo.AddNewClaim(claimThree); }
public void SetClaims(List <ClaimDto> claims) { _dialogService.ShowLoadingIndicator("Loading..."); DispatcherHelper.RunAsync(() => { // save payment settings ClaimItemViewModel [] old = new ClaimItemViewModel[ClaimItems.Count]; ClaimItems.CopyTo(old, 0); ClaimItems.Clear(); foreach (var c in claims) { var oldClaim = old.FirstOrDefault(m => m.Id == c.Id); var numberOfPayments = oldClaim?.NumberOfPayments ?? c.NumberOfPayments; var firstMonthlyPaymentDate = oldClaim?.FirstMonthlyPaymentDate ?? c.FirstMonthlyPaymentDate; var downPayment = oldClaim?.DownPayment ?? c.DownPayment; ClaimItems.Add(new ClaimItemViewModel(this, _paymentsCalculationViewModel) { Id = c.Id, ProviderId = c.ProviderId, Date = c.Date, PatientName = c.PatientName, ChewsiId = c.ChewsiId, State = c.State, StatusText = c.StatusText, PatientId = c.PatientId, SubscriberFirstName = c.SubscriberFirstName, IsClaimStatus = c.IsClaimStatus, IsCptError = c.IsCptError, ClaimNumber = c.ClaimNumber, FirstMonthlyPaymentDate = firstMonthlyPaymentDate, DownPayment = downPayment, NumberOfPayments = numberOfPayments, Locked = false, PmsModifiedDate = c.PmsModifiedDate, EligibleForPayments = c.EligibleForPayments }); } _dialogService.HideLoadingIndicator(); }); }
public void TakeCareOfClaim() { Queue <ClaimItems> claimItems = _repo.SeeAllClaims(); Console.WriteLine("Claim ID \t" + "Claim Type \t" + "Description \t" + "Claim Amount \t" + "Date of Incident \t" + "Date of Claim \t" + "IsValid \n"); ClaimItems claim = claimItems.Peek(); Console.WriteLine($"{claim.ClaimID}\t" + $"{claim.TypeOfClaim}\t" + $"{claim.Description}\t" + $"{claim.ClaimAmount}\t" + $"{claim.DateOfIncident}\t" + $"{claim.DateOfClaim}\t" + $"{claim.IsValid}\n"); Console.WriteLine("Would you like to take care of this claim now?\n" + "y or n?"); string userInput = Console.ReadLine(); switch (userInput) { case "y": RemoveClaimFromQueue(); break; case "n": break; } Console.Clear(); }
private void GetNextClaimItem() { int currentClaimID = SetIDOfCurrentClaim(); int nextClaimID = currentClaimID + 1; ClaimItems nextClaim = _claimRepo.GetClaimByID(nextClaimID); if (nextClaim.ClaimID < (nextClaimID + 1)) { DisplayClaimsHeader(); DisplayClaims(nextClaim); Console.WriteLine("Do you want to deal with this claim now('y'/'n')"); if (Console.ReadLine() == "y") { Console.Clear(); DisplayClaimsHeader(); DisplayClaims(nextClaim); } else if (Console.ReadLine() == "n") { Console.Clear(); RunMenu(); } else { Console.WriteLine("Please enter a valid response."); } } else { Console.WriteLine("There are no more claims"); Console.ReadKey(); RunMenu(); } Console.ReadKey(); }
public void Arrange() { _repo = new ClaimItemsRepository(); _content = new ClaimItems(4, ClaimType.Car, "Wreck on I-70.", 2000f, new DateTime(18, 04, 27), new DateTime(18, 04, 28), true); _repo.AddNewClaim(_content); }
public void GetClaimByID_ShouldGetCorrectClaim() { ClaimItems searchResult = _claimRepo.GetClaimByID(6); Assert.AreEqual(searchResult, _claimItems); }
private void DisplayClaims(ClaimItems claim) { Console.WriteLine($"{" ",-5}{(" ").PadRight(90, '-')}"); Console.WriteLine($"{" ",-5}{claim.ClaimID} {claim.ClaimType,-8} {claim.Description} {claim.ClaimAmount,10:c} {claim.DateOfIncident.ToShortDateString()} {claim.DateOfClaim.ToShortDateString()} {claim.IsValidClaim()}"); Console.WriteLine($"{" ",-5}{(" ").PadRight(90, '-')}"); }
private void EnterNewClaim() { Console.Clear(); ClaimItems content = new ClaimItems(); //Claim ID Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("Enter the claim id:"); Console.ForegroundColor = ConsoleColor.Cyan; content.ClaimId = int.Parse(Console.ReadLine()); Console.WriteLine(); //Claim Type Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("Enter the claim type:"); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("1) Car\n" + "2) Home\n" + "3) Theft"); string type = Console.ReadLine(); switch (type) { case "1": content.Type = ClaimType.Car; break; case "2": content.Type = ClaimType.Home; break; case "3": content.Type = ClaimType.Theft; break; } Console.WriteLine(); //Description Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("Enter a claim description:"); Console.ForegroundColor = ConsoleColor.Cyan; string description = Console.ReadLine(); content.Description = description; Console.WriteLine(); //Amount Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("Amount of Damage:"); Console.ForegroundColor = ConsoleColor.Cyan; content.Amount = float.Parse(Console.ReadLine()); Console.WriteLine(); //Date Of Accident Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("Date of Accident (eg. mm/dd/yy):"); Console.ForegroundColor = ConsoleColor.Cyan; string accidentInput = Console.ReadLine(); var accidentDate = DateTime.Parse(accidentInput); content.DateOfAccident = accidentDate; Console.WriteLine(); //Date Of Claim Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("Date of Claim (eg. mm/dd/yy):"); Console.ForegroundColor = ConsoleColor.Cyan; string claimInput = Console.ReadLine(); var claimDate = DateTime.Parse(claimInput); content.DateOfClaim = claimDate; _claimItemsRepo.AddNewClaim(content); }
private void DeleteClaim(ClaimItems content) { _claimItemsRepo.RemoveClaim(content); }
private void DisplaySimple(ClaimItems content) { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine($"{content.ClaimId,-9} {content.Type,-9} {content.Description,-26} ${content.Amount,-9} {content.DateOfAccident,-18:M/dd/yy} {content.DateOfClaim,-14:M/dd/yy} {content.IsValid}"); }
public void UnlockClaim(string id) { var claim = ClaimItems.FirstOrDefault(m => id == m.Id); claim?.Unlock(); }