public void Run()
        {
            _claimsQueue = _claimRepo.GetClaims();
            SeedData();

            Console.WriteLine("Main Menu");
            while (_response != 4)
            {
                PrintMenu();
                switch (_response)
                {
                case 1:
                    _claimRepo.GetClaims();

                    Console.WriteLine($"Claim ID# \t Type of claim \t Amount \t Date of Incident \t Date of Claim \t Is Valid \t Description");
                    foreach (Claim c in _claimsQueue)
                    {
                        Console.WriteLine($"{c.ClaimID} \t\t {typeof(TypeOfClaim).GetEnumName(c.Category)}\t\t ${c.ClaimAmount} \t {c.IncidentDate} \t\t {c.ClaimDate} \t {c.IsValid} \t\t {c.Description}");
                    }

                    Console.WriteLine($"\nPress 'Enter' to return to menu.");

                    Console.ReadLine();
                    break;

                case 2:
                    Console.WriteLine($"{_claimsQueue.Peek()}\n" +
                                      $"Do you want to address this now? y/n");
                    string handleClaim = Console.ReadLine().ToLower();

                    if (handleClaim == "y")
                    {
                        _claimRepo.RemoveQueueItem();
                    }

                    break;

                case 3:
                    CreateANewClaim();

                    break;

                default:
                    break;
                }
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            ClaimRepository claimRepository = new ClaimRepository();

            claimRepository.AddClaim(new Claim(1, "Fire in kitchen", 400.00m, DateTime.Now, DateTime.Now));
            while (true)
            {
                Console.Clear();
                Console.WriteLine("Choose a Menu Item:\n1. See all claims.\n2. Take care of next claim.\n3. Enter a new Claim\n4. Close");
                string Command = Console.ReadLine();
                if (Command == "1")
                {
                    DisplayDataSetup();
                    int row = 1;
                    foreach (Claim claim in claimRepository.GetClaims())
                    {
                        DisplayClaimInRow(claim, row);
                        row++;
                    }
                    Console.Read();
                    //-- See all claims
                }
                else if (Command == "2")
                {
                    Claim peekingClaim = claimRepository.GetNextClaim();
                    Console.Clear();
                    Console.WriteLine("Here are the details for the next claim to be handled: \n" +
                                      $"ClaimID: {peekingClaim.ClaimID} \n" +
                                      $"Type: {peekingClaim.ClaimType} \n" +
                                      $"Description: {peekingClaim.Description} \n" +
                                      $"Amount: ${peekingClaim.ClaimAmount} \n" +
                                      $"DateOfClaim: {peekingClaim.DateOfClaim} \n" +
                                      $"DateOfAccident: {peekingClaim.DateOfAccident} \n" +
                                      $"IsValid: {peekingClaim.IsValid}"
                                      );

                    Console.WriteLine("Do you want to handle this claim now? Y/N");
                    string yn = Console.ReadLine().ToLower();
                    if (yn == "y")
                    {
                        claimRepository.Dequeue();
                        claimRepository.AddClaim(newClaim());
                    }
                    else if (yn == "n")
                    {
                    }
                    //-- Take care of next claim
                }
                else if (Command == "3")
                {
                    claimRepository.AddClaim(newClaim());
                    //-- Enter a new Claim
                }
                else if (Command == "4")
                {
                    break;
                }
            }
        }
Exemple #3
0
        static void Main(string[] args)
        {
            ClaimRepository claimRepo  = new ClaimRepository();
            Queue <Claim>   claimQueue = claimRepo.GetClaims();

            string response = null;

            while (response != "4")
            {
                Console.Clear();
                Console.Write($"Which action would you like to take?" +
                              $"\n1. View all claims." +
                              $"\n2. Process next claim." +
                              $"\n3. Enter new claim." +
                              $"\n4. Exit." +
                              $"\n   ");
                response   = Console.ReadLine();
                claimQueue = claimRepo.GetClaims();

                if (response == "1")
                {
                    Console.Clear();

                    Console.WriteLine($"ClaimID\t " +
                                      $"Type\t" +
                                      $"Description\t" +
                                      $"Amount\t" +
                                      $"DateOfAccident\t" +
                                      $"DateOfClaim\t" +
                                      $"IsValid");

                    foreach (Claim claim in claimQueue)
                    {
                        Console.WriteLine($" {claim.ClaimID}\t " +
                                          $"{claim.ClaimType}\t" +
                                          $"{claim.Description}\t\t" +
                                          $"${claim.ClaimAmount}\t" +
                                          $"{claim.DateOfIncident.ToShortDateString()}\t" +
                                          $"{claim.DateOfClaim.ToShortDateString()}\t" +
                                          $"{claim.IsValid}");
                    }
                }
            }
        }
Exemple #4
0
        public void Run()
        {
            Claim firstClaim  = new Claim(33, "Auto", "Accident", 2000, "04/25/18", "04/27/18", "yes");
            Claim secondClaim = new Claim(33, "House", "Toilet exploded", 2000, "04/25/18", "04/27/18", "yes");
            Claim thirdClaim  = new Claim(33, "Theft", "Pancakes stolen", 400, "04/25/18", "04/27/18", "no");

            _claims = _claimRepo.GetClaims();
            _claims.Enqueue(firstClaim);
            _claims.Enqueue(secondClaim);
            _claims.Enqueue(thirdClaim);

            bool isRunning = true;

            while (isRunning)
            {
                Console.WriteLine("Choose an action:" +
                                  "\n1. See All Claims" +
                                  "\n2. Take Care Of Next Claim" +
                                  "\n3. Enter New Claim" +
                                  "\n4. Exit");

                int input = int.Parse(Console.ReadLine());
                switch (input)
                {
                case 1:
                    SeeAllClaims();
                    break;

                case 2:
                    SeeNextClaim();
                    break;

                case 3:
                    NewClaim();
                    break;

                case 4:
                    isRunning = false;
                    Console.WriteLine("Goodbye!");
                    Console.ReadLine();
                    break;

                default:
                    Console.WriteLine("Invalid response.");
                    Console.ReadLine();
                    break;
                }
            }
        }
        private void ListToDataTable()
        {
            Queue <ClaimContent> contentList = _claimRepo.GetClaims();
            var ID             = "ClaimID";
            var Type           = "Type";
            var Description    = "Description";
            var Amount         = "Amount";
            var DateOfAccident = "DateOfAccident";
            var DateOfClaim    = "DateOfClaim";
            var IsValid        = "IsValid";

            Console.WriteLine($"{ID,-15} {Type,-15} {Description,-15} " +
                              $"{Amount,-15} {DateOfAccident,-25} {DateOfClaim,-25} {IsValid,-15}");
            foreach (var content in contentList)
            {
                Console.WriteLine($"{content.ClaimID,-15} {content.Type,-15} {content.Description,-15} {content.Amount,-15} " +
                                  $"{content.DateOfAccident,-25} {content.DateOfClaim,-25} {content.IsValid,-15}");
            }
        }
        public void Run()
        {
            var initClaims = new List <Claim>()
            {
                new Claim(1, ClaimTypes.Car, "Crash on 1st", 300.00m, _claimRepo.StringToDateTime("7/15/2018"), _claimRepo.StringToDateTime("7/24/2018"), true),
                new Claim(2, ClaimTypes.Home, "Broken window", 120.00m, _claimRepo.StringToDateTime("7/03/2018"), _claimRepo.StringToDateTime("7/14/2018"), true),
                new Claim(3, ClaimTypes.Theft, "Cheese stolen", 1.00m, _claimRepo.StringToDateTime("6/5/2018"), _claimRepo.StringToDateTime("6/24/2018"), false),
            };

            _claimRepo.AddToClaims(initClaims);

            while (loop)
            {
                string        menuInput = ConsoleMenu();
                Queue <Claim> claims    = _claimRepo.GetClaims();
                switch (menuInput)
                {
                case "1":
                    Console.WriteLine($"\r\nClaimID\tType\tDescription\t\tAmount\t\tDateOfAccident\t\tDateOfClaim\t\tIsValid");
                    foreach (Claim claim in claims)
                    {
                        Console.WriteLine(claim);
                    }
                    Console.WriteLine($"\r\n" +
                                      $"Press any key to continue");
                    Console.ReadKey();
                    Console.Clear();
                    break;

                case "2":
                    Console.WriteLine("\r\nHere are the details for the next claim to be handled:\r\n" +
                                      "\r\n" +
                                      "Claim ID: " + claims.Peek().ClaimID + "\r\n" +
                                      "Type: " + claims.Peek().ClaimType + "\r\n" +
                                      "Description: " + claims.Peek().Description + "\r\n" +
                                      "Ammount: " + claims.Peek().ClaimAmmount + "\r\n" +
                                      "Date of Incident: " + claims.Peek().DateOfIncident + "\r\n" +
                                      "Date of Claim: " + claims.Peek().DateOfClaim + "\r\n" +
                                      "Is this case Valid: " + claims.Peek().IsValid + "\r\n" +
                                      "\r\n" +
                                      "Do you want to deal with this claim now? (y/n)");
                    System.ConsoleKeyInfo response = Console.ReadKey();
                    Console.Clear();
                    string input = response.KeyChar.ToString();
                    switch (input)
                    {
                    case "y":
                        _claimRepo.RemoveClaim();
                        break;

                    case "n":
                        break;

                    default:
                        Console.WriteLine("Unknown input\r\n" +
                                          "Press any key to return to main menu");
                        Console.ReadKey();
                        Console.Clear();
                        break;
                    }
                    break;

                case "3":
                    Claim newClaim = NewClaim();
                    _claimRepo.AddToClaims(newClaim);
                    Console.WriteLine($"\r\n" +
                                      $"Press any key to continue");
                    Console.ReadKey();
                    Console.Clear();
                    break;

                case "X":
                    loop = false;
                    break;

                default:
                    break;
                }
            }
        }
        static void Main(string[] args)
        {
            ClaimRepository claimRepo  = new ClaimRepository();
            Queue <Claim>   claimQueue = claimRepo.GetClaims();

            string response = null;

            while (response != "4")
            {
                Console.Clear();
                Console.Write($"Which action would you like to take?" +
                              $"\n1. View all claims." +
                              $"\n2. Process next claim." +
                              $"\n3. Enter new claim." +
                              $"\n4. Exit." +
                              $"\n   ");
                response   = Console.ReadLine();
                claimQueue = claimRepo.GetClaims();

                if (response == "1")
                {
                    Console.Clear();

                    Console.WriteLine($"ClaimID\t " +
                                      $"Type\t" +
                                      $"Description\t" +
                                      $"Amount\t" +
                                      $"DateOfAccident\t" +
                                      $"DateOfClaim\t" +
                                      $"IsValid");

                    foreach (Claim claim in claimQueue)
                    {
                        Console.WriteLine($" {claim.ClaimID}\t " +
                                          $"{claim.ClaimType}\t" +
                                          $"{claim.Description}\t\t" +
                                          $"${claim.ClaimAmount}\t" +
                                          $"{claim.DateOfIncident.ToShortDateString()}\t" +
                                          $"{claim.DateOfClaim.ToShortDateString()}\t" +
                                          $"{claim.IsValid}");
                    }

                    Console.Read();
                }
                else if (response == "2")
                {
                    Console.Clear();
                    if (claimQueue.Count != 0)
                    {
                        Claim topItem = claimQueue.Peek();
                        Console.WriteLine($"Here are the details for the next claim to be handled:\n" +
                                          $"  ClaimID: {topItem.ClaimID}\n" +
                                          $"  Type: {topItem.ClaimType}\n" +
                                          $"  Description: {topItem.Description}\n" +
                                          $"  Amount: {topItem.ClaimAmount}\n" +
                                          $"  DateOfIncident: {topItem.DateOfIncident.ToShortDateString()}\n" +
                                          $"  DateOfClaim: {topItem.DateOfClaim.ToShortDateString()}\n" +
                                          $"  IsValid: {topItem.IsValid}");

                        Console.Write("Do you want to deal with this claim now? (y/n): ");
                        string delClaim = Console.ReadLine();

                        if (delClaim == "y")
                        {
                            claimQueue.Dequeue();
                            foreach (Claim claim in claimQueue)
                            {
                                claim.ClaimID--;
                            }
                            claimRepo.CountDown();
                        }
                    }
                }
                else if (response == "3")
                {
                    ClaimType type   = ClaimType.Car;
                    string    outPut = null;
                    while (true)
                    {
                        Console.Clear();
                        Console.Write($"{outPut}" +
                                      $"Enter the type of claim being made." +
                                      $"\n1. Car \n2. Home \n3. Theft \n   ");

                        string inType = Console.ReadLine();
                        if (inType == "1")
                        {
                            type = ClaimType.Car;
                            break;
                        }
                        else if (inType == "2")
                        {
                            type = ClaimType.Home;
                            break;
                        }
                        else if (inType == "3")
                        {
                            type = ClaimType.Theft;
                            break;
                        }
                        else
                        {
                            outPut = "Invalid Input, please try again.\n";
                        }
                    }

                    Console.Clear();
                    Console.Write("Enter the claim amount: $");
                    string  claimAmountAsString = Console.ReadLine();
                    decimal amount = Decimal.Parse(claimAmountAsString);

                    Console.Write("\nEnter a brief description for the claim: ");
                    string desc = Console.ReadLine();

                    DateTime claimDate    = CreateDate("\nEnter the Month, Day, and Year of the claim.");
                    DateTime incidentDate = CreateDate("\nEnter the Month, Day, and Year of the incident.");

                    claimRepo.AddClaim(type, desc, amount, incidentDate, claimDate);
                }
                else if (response == "4")
                {
                    break;
                }
            }
        }
        public void Run()
        {
            claims = claimRepo.GetClaims();
            Claim claimOne = new Claim()
            {
                ClaimID        = 1,
                ClaimType      = "auto",
                Description    = "Car accident on 465",
                ClaimAmount    = 400.00m,
                DateOfIncident = "4/25/2018",
                DateOfClaim    = "4/27/2018",
                IsValid        = true
            };
            Claim claimTwo = new Claim()
            {
                ClaimID        = 2,
                ClaimType      = "home",
                Description    = "House fire in kitchen",
                ClaimAmount    = 4000.00m,
                DateOfIncident = "4/26/2018",
                DateOfClaim    = "4/28/2018",
                IsValid        = true
            };
            Claim claimThree = new Claim()
            {
                ClaimID        = 3,
                ClaimType      = "theft",
                Description    = "Theft of pancakes",
                ClaimAmount    = 4.00m,
                DateOfIncident = "4/27/2018",
                DateOfClaim    = "6/1/2018",
                IsValid        = false
            };

            claimRepo.AddClaimToQueue(claimOne);
            claimRepo.AddClaimToQueue(claimTwo);
            claimRepo.AddClaimToQueue(claimThree);

            bool isRunning = true;

            while (isRunning)
            {
                Console.WriteLine("Choose a menu item:\n" +
                                  "1. See all claims\n" +
                                  "2. Process next claim\n" +
                                  "3. Enter a new claim\n" +
                                  "4. Exit");

                int input = int.Parse(Console.ReadLine());
                switch (input)
                {
                case 1:
                    PrintClaimList();
                    break;

                case 2:
                    ProcessNextClaim();
                    break;

                case 3:
                    EnterNewClaim();
                    break;

                case 4:
                    Console.WriteLine("Thank you");
                    isRunning = false;
                    break;

                default:
                    Console.WriteLine("Incorrect response type");
                    break;
                }
            }
        }