Example #1
0
        public void TestUniversityAddPaper()
        {
            var massey = new University();
            var paper  = new Paper("158.212", "Application Software Development", "Dr Teo Susnjak");

            bool addSuccess = massey.AddPaper(paper);

            if (addSuccess)
            {
                Console.WriteLine(paper.Code + " added");
            }
            else
            {
                Console.WriteLine(paper.Code + " Existed");
            }

            if (addSuccess = massey.AddPaper(paper))
            {
                Console.WriteLine(paper.Code + " added");
            }
            else
            {
                Console.WriteLine(paper.Code + " Existed");
            }
        }
Example #2
0
        public void TestUniversityRemovePaper()
        {
            var  massey     = new University();
            var  paper      = new Paper("158.212", "Application Software Development", "Dr Teo Susnjak");
            bool addSuccess = massey.AddPaper(paper);
            bool removeSuccess;

            if (removeSuccess = massey.RemovePaper("158.212"))
            {
                Console.WriteLine("158.212 added");
            }
            else
            {
                Console.WriteLine("158.212 not existed");
            }

            if (removeSuccess = massey.RemovePaper("158.212"))
            {
                Console.WriteLine("158.212 removed");
            }
            else
            {
                Console.WriteLine("158.212 not existed");
            }
        }
Example #3
0
        private void buttonConfirm_Click(object sender, EventArgs e)
        {
            if (textBoxName.Text == "" || textBoxCode.Text == "" || textBoxCoordinator.Text == "")
            {
                MessageBox.Show("Error: Please fill all the blanks");
                return;
            }

            _paper = new Paper(textBoxCode.Text, textBoxName.Text, textBoxCoordinator.Text);
            if (_university.AddPaper(_paper))
            {
                MessageBox.Show("Added");
                this.Close();
            }
            else
            {
                MessageBox.Show("Existed, failed");
            }
        }