Beispiel #1
0
        public Client(string name, int accountID, string address)
        {
            this.clientID  = ID++;
            this.name      = name;
            this.accountID = accountID;
            this.address   = address;

            this.ipCollection = new IPCollection();
        }
Beispiel #2
0
        static void customerViewPolicies(Client client)
        {
            while (true)
            {
                Console.WriteLine("Your Policies");

                IPCollection ipCollection = client.getIPCollection();

                // Iterate through the policies.
                Iterator ipIterator = ipCollection.getIterator();
                int      no         = 1;
                while (ipIterator.hasNext())
                {
                    InsurancePolicy policy = (InsurancePolicy)ipIterator.next();

                    // Print out policy details inline.
                    Console.WriteLine("#" + no++);
                    Console.WriteLine("ID: " + policy.getPolicyID());
                    Console.WriteLine();
                }

                // Get user option.
                Console.WriteLine("\n\n[1] View a policy\n[0] Return home");

                Console.Write("Enter option: ");
                int option = Convert.ToInt32(Console.ReadLine());
                if (option == 1) // View policy
                {
                    // Get policy no. from user
                    int policyNo = 0;
                    while (true)
                    {
                        Console.Write("Enter policy no: ");
                        policyNo = Convert.ToInt32(Console.ReadLine());

                        if (policyNo >= 0 && policyNo <= ipCollection.getCount())
                        {
                            break;
                        }
                        else
                        {
                            Console.WriteLine("\nInvalid Input!");
                        }
                    }

                    customerViewAPolicy(ipCollection.getPolicy(policyNo - 1));
                }
                else if (option == 0) // Return home
                {
                    break;
                }
            }
        }
Beispiel #3
0
 static void staffViewPolicy(List <InsurancePolicy> pList, string user, InsurancePolicy insurancePolicy, Client client, Employee employee, IPCollection ipCollection)
 {
     for (int i = 0; i < pList.Count; i++)
     {
         Console.WriteLine(pList[i].getPolicyID());
     }
     //check if user is admin
     if (employee.getIsAdmin() == true)
     {
         //if admin
         if (employee.getIsAdmin() == true)
         {
             Console.WriteLine("\n\n[1] Customer\n[2] Agent\n[3] Matured");
             Console.Write("Enter option: ");
             //display policies
             int option = Convert.ToInt32(Console.ReadLine());
             if (option == 1)
             {
                 Console.WriteLine(ipCollection);
                 //DisplayPolicyMenu();
             }
             if (option == 2)
             {
                 Console.WriteLine(pList);
                 //DisplayPolicyMenu();
             }
             if (option == 3)
             {
                 Console.WriteLine(insurancePolicy.getMaturedDate());
                 //DisplayPolicyMenu();
             }
         }
     }
     //if not admin
     if (!employee.getIsAdmin())
     {
         //display polcies that belongs to him
         Console.WriteLine(pList);
         //DisplayPolicyMenu();
     }
 }