Beispiel #1
0
        private void btnAddWs_Click(object sender, EventArgs e)
        {
            try
            {
                if (comboBoxteacherWsMan.SelectedIndex == -1)
                {
                    MessageBox.Show("Please select a teacher.");
                    return;
                }
                string   title   = tbTitleWsMan.Text;
                string   topic   = tbTopicWsMan.Text;
                int      cap     = Convert.ToInt32(numericUpDownCapacity.Value);
                Teacher  teacher = (Teacher)comboBoxteacherWsMan.SelectedItem;
                DateTime date    = dateTimePicker1.Value;
                string   address = tbAddressWsMan.Text;
                int      room    = Convert.ToInt32(numericUpDownRoomNumber.Value);
                string   link    = tbLinkWsMan.Text;

                if (comboBoxTypeWsMan.SelectedIndex == 0)
                {
                    wscrudlogic.AddWorkshop(new InBuildingWks(title, topic, date, cap, teacher, address, room));
                }
                else
                {
                    wscrudlogic.AddWorkshop(new OnlineWks(title, topic, date, cap, teacher, link));
                }
                ClearTextboxes();
                UpdateWSListbox();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
        public void AddWorkshop()
        {
            personlogic.AddPerson(new Teacher("John", "Teacher", "159357"));
            OnlineWks owks = new OnlineWks("An Online Workshop", "How to give online workshops", DateTime.Now, 5, (Teacher)personlogic.GetPerson("159357"), "somelink");

            wkscrud.AddWorkshop(owks);
            Assert.AreEqual(owks, wkscrud.GetWorkshop(1));
        }
Beispiel #3
0
        public ReceptionistForm()
        {
            InitializeComponent();
            wslogic       = new WorkshopLogic();
            wscrudlogic   = new WorkshopCRUDLogic();
            personlogic   = new PersonLogic();
            enrollmentreq = new EnrollmentRequestLogic();

            PersonalForm pf = new PersonalForm(wslogic, wscrudlogic, personlogic, enrollmentreq);

            pf.Show();
            comboBoxTypeWsMan.SelectedIndex  = 0;
            comboBoxPersonRole.SelectedIndex = 0;

            enrollmentreq.EnrollmentRequestEvent += new IEnrollmentRequest.EnrollmentRequestHandler(enrollmentrequest_notification);

            //Dummy data
            personlogic.AddPerson(new Teacher("John", "Teacher", "159357"));
            personlogic.AddPerson(new Student("Sarah", "Student", "159359"));
            wscrudlogic.AddWorkshop(new OnlineWks("An Online Workshop", "How to give online workshops", DateTime.Now, 5, (Teacher)personlogic.GetPerson("159357"), "somelink"));
            UpdateLBER();
            UpdateWSListbox();
            UpdatePeopleListbox();
        }