Esempio n. 1
0
        public bool DeleteClaim(int item)
        {
            ClaimProp claim  = GetClaimById(item);
            bool      result = _claimDirectory.Remove(claim);

            return(result);
        }
Esempio n. 2
0
        public void AddNewClaim()
        {
            ClaimProp claim = new ClaimProp();

            Console.WriteLine("What is the Claim ID number");

            claim.ClaimId = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("What Type is the Claim?\n" +
                              "1)Home\n" +
                              "2)Theft\n" +
                              "3)Car\n");

            string type   = Console.ReadLine();
            int    typeID = int.Parse(type);

            claim.ClaimType = (ClaimType)typeID;

            Console.WriteLine("Write a short Description of incident");
            claim.ClaimDescription = Console.ReadLine();

            Console.WriteLine("What is the estimated amount of damage");
            claim.ClaimAmount = Console.ReadLine();

            Console.WriteLine("Date incident happened. plese use mm/dd/yy format");
            claim.DateOfIncident = Convert.ToDateTime(Console.ReadLine());

            Console.WriteLine("Date claim was submitted. plese use mm/dd/yy format");
            claim.DateOfClaim = Convert.ToDateTime(Console.ReadLine());

            _claimDirectory.AddClaim(claim);
            Console.WriteLine("Claim as been added");
            Console.ReadKey();
        }
Esempio n. 3
0
 public bool AddClaimToDirectory(ClaimProp claim)
 {
     foreach (ClaimProp existingClaim in _claimDirectory)
     {
         if (existingClaim.ClaimId == claim.ClaimId)
         {
             return(false);
         }
     }
     _claimDirectory.Add(claim);
     return(true);
 }
Esempio n. 4
0
        public void WriteQueue()
        {
            Queue <ClaimProp> claimQueue = _claimQueue;
            ClaimProp         queueOne   = _claimQueue.Peek();

            Console.WriteLine("{0,0}{1,10}{2,16}{3,21 }{4,20 }{5,20 }{6,15 }", "Claim ID", "Type", "Description", "Amount", "DateOfIncident", "DateOfClaim", "Is Valid");
            foreach (ClaimProp queue in claimQueue)
            {
                Console.WriteLine("{0,-14}{1,-9}{2,-25}{3,-13 }{4,-23 }{5,-18}{6,0 }", queue.ClaimId, queue.ClaimType, queue.ClaimDescription, queue.ClaimAmount, queue.DateOfIncident.ToString("MM/dd/yy"), queue.DateOfClaim.ToString("MM/dd/yy"), queue.IsValid);
            }
            Console.WriteLine("Current Claims.");
            Console.ReadKey();
        }
Esempio n. 5
0
        public void Seed()
        {
            ClaimProp claimOne = new ClaimProp(1, ClaimType.Car, "Car accident on 465", "$400.00", Convert.ToDateTime("04/25/2018"), Convert.ToDateTime("04/27/2018"));

            _claimDirectory.AddClaimToDirectory(claimOne);

            ClaimProp claimTwo = new ClaimProp(2, ClaimType.Home, "House fire in kitchen", "$4000.00", Convert.ToDateTime("04/11/2018"), Convert.ToDateTime("04/12/2018"));

            _claimDirectory.AddClaimToDirectory(claimTwo);

            ClaimProp claimThree = new ClaimProp(3, ClaimType.Theft, "Stolen pancakes", "$4.00", Convert.ToDateTime("04/27/2018"), Convert.ToDateTime("06/01/2018"));

            _claimDirectory.AddClaimToDirectory(claimThree);
        }
Esempio n. 6
0
        public bool UpdateClaim(int claimId, ClaimProp newContent)
        {
            ClaimProp oldContent = GetClaimById(claimId);

            if (oldContent != null)
            {
                oldContent.ClaimId          = newContent.ClaimId;
                oldContent.ClaimDescription = newContent.ClaimDescription;
                oldContent.ClaimType        = newContent.ClaimType;
                oldContent.ClaimAmount      = newContent.ClaimAmount;
                oldContent.DateOfClaim      = newContent.DateOfClaim;
                oldContent.DateOfIncident   = newContent.DateOfIncident;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 7
0
        public void NextClaim()
        {
            Queue <ClaimProp> claimQueue = _claimDirectory.GetClaimQueue();
            bool      isViewingQueue     = true;
            ClaimProp myclaim            = claimQueue.Peek();

            while (isViewingQueue)
            {
                Console.WriteLine($"Claim ID: {myclaim.ClaimId}\n" +
                                  $"Type: {myclaim.ClaimType}\n" +
                                  $"Description: {myclaim.ClaimDescription}\n" +
                                  $"Amount: {myclaim.ClaimAmount}\n" +
                                  $"Date Of Incident: {myclaim.DateOfIncident.ToString("MM/dd/yy")}\n" +
                                  $"Date Of Claim: {myclaim.DateOfClaim.ToString("MM/dd/yy")}\n" +
                                  $"Is a Vaild Claim: {myclaim.IsValid}\n");

                Console.WriteLine("Do you want to deal with this claim now? Y/N");

                string userInput = Console.ReadLine();

                switch (userInput.ToLower())
                {
                case "yes":
                case "y":
                    claimQueue.Dequeue();
                    break;

                case "no":
                case "n":
                    isViewingQueue = false;
                    break;

                default:
                    Console.WriteLine("Please enter Yes or No.");
                    break;
                }
            }
        }
Esempio n. 8
0
 public void AddClaim(ClaimProp claim)
 {
     _claimDirectory.Add(claim);
     _claimQueue.Enqueue(claim);
 }