public bool AddClaimToDirectory(ClaimContent newClaim)
        {
            int startingCount = _claimDirectory.Count;

            _claimDirectory.Enqueue(newClaim);

            bool wasAdded = (_claimDirectory.Count > startingCount);

            return(wasAdded);
        }
示例#2
0
        private void AddNewClaim()
        {
            Console.Clear();
            Console.WriteLine("Enter the claim ID:");
            string claimIDInput = Console.ReadLine();
            int    claimID      = Convert.ToInt32(claimIDInput);

            Console.WriteLine("Select claim type\n" +
                              "1. Car\n" +
                              "2. House\n" +
                              "3. Theft");
            string claimChoice = Console.ReadLine();

            ClaimType typeOfClaim = ClaimType.Car;

            switch (claimChoice)
            {
            case "1":
                typeOfClaim = ClaimType.Car;
                break;

            case "2":
                typeOfClaim = ClaimType.House;
                break;

            case "3":
                typeOfClaim = ClaimType.Theft;
                break;

            default:
                Console.WriteLine("Please pick a valid claim type");
                break;
            }

            Console.WriteLine("Enter a description of the claim:");
            string description = Console.ReadLine();

            Console.WriteLine("Enter a dollar value for the damage:");
            string  dollarAmount   = Console.ReadLine();
            decimal amountOfDamage = Convert.ToDecimal(dollarAmount);

            Console.WriteLine("Enter the date of the incident (mm/dd/yyyy):");
            string   dateOfIncidentString = Console.ReadLine();
            DateTime dateOfIncident       = DateTime.Parse(dateOfIncidentString);

            Console.WriteLine("Enter the date of the claim (mm/dd/yyyy)");
            string   dateOfClaimString = Console.ReadLine();
            DateTime dateOfClaim       = DateTime.Parse(dateOfClaimString);

            if (dateOfClaim > dateOfIncident.AddDays(30))
            {
                bool isValid = true;
            }
            else
            {
                bool isValid = false;
            }

            ClaimContent newClaim = new ClaimContent(claimID, typeOfClaim, description, amountOfDamage, dateOfIncident, dateOfClaim);

            _claimDirectory.Enqueue(newClaim);
        }