Пример #1
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;
                }
            }
        }