/**
         * Creates a new ProviderInterface.
         */
        public ProviderInterface()
        {
            ui = new UserInterface();

            //Start use case Manage Session
            logon();

            string menuText = "\t1. Verify Member/Submit Claim\n"
                              + "\t2. Request Provider Directory\n"
                              + "\t3. Quit\n";

            int choice;

            do
            {
                //display menu and read choice
                ui.message("\n\t\t\tProvider Subsystem\n");
                choice = ui.menu(menuText);
                switch (choice)
                {
                //Use case Verify Member followed optionally by Submit claim
                case 1: verifyMember(); break;

                //Use case Receive Provider Directory
                case 2: receiveDirectory(); break;

                case 3: break;

                default: ui.errorMessage("Invalid choice.  Please re-enter."); break;
                }
            } while (choice != 3);
        }// default Constructor
Example #2
0
        /**
         * Creates a new ServiceMaintainer control object
         */
        public ServiceMaintainer()
        {
            try
            {
                //Create and open the service collection
                services = new Services();
                services.open();

                //Create a user interface and set up menu
                ui = new UserInterface();
                string menuText = "1.\tAdd a New Service\n" +
                                  "2.\tEdit a Service\n" +
                                  "3.\tDelete a Service\n" +
                                  "4.\tQuit\n";

                int choice;
                do
                {
                    ui.message("\t\t\tMaintain Services\n\n");
                    choice = ui.menu(menuText);  //display menu and get choice
                    switch (choice)
                    {
                    case 1: addService(); break;

                    case 2: editService(); break;

                    case 3: deleteService(); break;

                    case 4: break;

                    default: ui.errorMessage("Invalid choice.  Please re-enter."); break;
                    }
                } while (choice != 4);

                //close the service collection
                services.close();
            }
            catch (FormatException ex)  //Error in file format
            {
                ui.errorMessage(ex.Message);
                return;
            }
            catch (FileNotFoundException ex)
            {
                //occurs if the file cannot be created
                ui.errorMessage(ex.Message);
            }
        }//default constructor
        /**
         * Creates a new ProviderMaintainer control object
         */
        public ProviderMaintainer()
        {
            try
            {
                //create and open the provider collection
                providers = new Providers();
                providers.open();

                //set up menu for user interface
                ui = new UserInterface();
                string menuText = "1.\tAdd a New Provider\n" +
                                  "2.\tEdit a Provider\n" +
                                  "3.\tDelete a Provider\n" +
                                  "4.\tQuit\n";

                int choice;
                do
                {
                    ui.message("\t\t\tMaintain Providers\n\n");
                    //display menu and read choice
                    choice = ui.menu(menuText);
                    switch (choice)
                    {
                    case 1: addProvider(); break;

                    case 2: editProvider(); break;

                    case 3: deleteProvider(); break;

                    case 4: break;

                    default: ui.errorMessage("Invalid choice.  Please re-enter."); break;
                    }
                } while (choice != 4);

                //close provider collection
                providers.close();
            }
            catch (FileNotFoundException ex)
            {
                //occurs if the file cannot be created
                ui.errorMessage(ex.Message);
            }
        }//default constructor