Пример #1
0
        public void StartApplication()
        {
            mDAL = new MemberDAL();
                c = new View.Console();
                try
                {
                    mDAL.LoadMembersFromBin();
                }
                catch (Exception e)
                {

                    c.ErrorMessage(e);
                }
                while (true)
                {
                    try
                    {
                        c.DisplayInstructions();
                        int userInput = int.Parse(c.GetUserInput());
                        IReadOnlyCollection<Member> list = mDAL.getMemberList();
                        switch (userInput)
                        {
                            case 1: // save and quit
                                mDAL.SaveMembersToBin();
                                Environment.Exit(0);
                                break;
                            case 2: // add member
                                Console.Clear();
                                while (true)
                                {
                                    c.addMemberInstructionPrompt();
                                    try
                                    {
                                        //fname, lname, ssn
                                        m = new Member(c.GetUserInput(), c.GetUserInput(), c.GetUserInput());
                                        mDAL.addMemberToList(m);
                                    }
                                    catch
                                    {
                                        throw new ArgumentException();
                                    }
                                    break;
                                }

                                break;
                            case 3: // show compact list
                                Console.Clear();
                                c.showMembersCompact(list);
                                selectMember(list);
                                break;
                            case 4: // show verbose list
                                Console.Clear();
                                c.showMembersVerbose(list);
                                selectMember(list);
                                break;
                            default:
                                break;
                        }
                    }
                    catch (Exception e)
                    {
                        c.ErrorMessage(e);
                    }
                }
        }