示例#1
0
        private void button2_Click(object sender, EventArgs e)
        {
            AddStudentPage addstudent = new AddStudentPage(server, eventId, false);

            addstudent.ShowDialog();
            if (addstudent.isConfirm)
            {
                inChargeTextBox.Text = addstudent.name;
                inChargeName         = addstudent.name;
                matric = addstudent.matric;
            }
        }
示例#2
0
        private void addStudentButton_Click(object sender, EventArgs e)
        {
            ListView currentListView = organiserListView;
            int      role            = 1;

            if (tabControl.SelectedIndex == 1)
            {
                currentListView = facilitatorListView;
                role            = 2;
            }
            else if (tabControl.SelectedIndex == 2)
            {
                currentListView = participantListView;
                role            = 3;
            }

            AddStudentPage addstudent = new AddStudentPage(server, eventID, true);

            addstudent.ShowDialog();
            if (addstudent.isConfirm)
            {
                string matric          = addstudent.matric;
                string name            = addstudent.name;
                bool   alreadyExists   = false;
                string alreadyExistsAs = "";

                // check if name already exists in the events

                //check organiser list
                foreach (ListViewItem student in organiserListView.Items)
                {
                    if (student.SubItems[1].Text == matric)
                    {
                        alreadyExists   = true;
                        alreadyExistsAs = "Organiser";
                    }
                }

                //check facilitator list
                foreach (ListViewItem student in facilitatorListView.Items)
                {
                    if (student.SubItems[1].Text == matric)
                    {
                        alreadyExists   = true;
                        alreadyExistsAs = "Facilitator";
                    }
                }

                //check participants list
                foreach (ListViewItem student in participantListView.Items)
                {
                    if (student.SubItems[1].Text == matric)
                    {
                        alreadyExists   = true;
                        alreadyExistsAs = "Participant";
                    }
                }

                if (alreadyExists)
                {
                    MessageBox.Show("Student already exists in the event as <" + alreadyExistsAs + ">",
                                    "Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }


                eventManpowerManager.StudentJoinEvent(matric, eventID, role);
                ListViewItem newStudent = new ListViewItem(new[] { name, matric, "No" });
                currentListView.Items.Add(newStudent);

                string roleInWords = "";
                if (role == 1)
                {
                    roleInWords = "Organiser";
                }
                else if (role == 2)
                {
                    roleInWords = "Facilitator";
                }
                else
                {
                    roleInWords = "Participant";
                }
                toolStripStatusLabel1.Text = "Student <" + name + "> has been added to the " + roleInWords + "'s list.";
            }
            addstudent.Close();
        }
示例#3
0
        private void addStudentButton_Click(object sender, EventArgs e)
        {
            ListView currentListView = organiserListView;
            int role = 1;
            if (tabControl.SelectedIndex == 1) {
                currentListView = facilitatorListView;
                role = 2;
            } else if (tabControl.SelectedIndex == 2) {
                currentListView = participantListView;
                role = 3;
            }

            AddStudentPage addstudent = new AddStudentPage(server, eventID, true);
            addstudent.ShowDialog();
            if (addstudent.isConfirm) {
                string matric = addstudent.matric;
                string name = addstudent.name;
                bool alreadyExists = false;
                string alreadyExistsAs = "";

                // check if name already exists in the events

                //check organiser list
                foreach (ListViewItem student in organiserListView.Items) {
                    if (student.SubItems[1].Text == matric) {
                        alreadyExists = true;
                        alreadyExistsAs = "Organiser";
                    }
                }

                //check facilitator list
                foreach (ListViewItem student in facilitatorListView.Items) {
                    if (student.SubItems[1].Text == matric) {
                        alreadyExists = true;
                        alreadyExistsAs = "Facilitator";
                    }
                }

                //check participants list
                foreach (ListViewItem student in participantListView.Items) {
                    if (student.SubItems[1].Text == matric) {
                        alreadyExists = true;
                        alreadyExistsAs = "Participant";
                    }
                }

                if (alreadyExists) {
                     MessageBox.Show("Student already exists in the event as <" + alreadyExistsAs + ">",
                            "Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                eventManpowerManager.StudentJoinEvent(matric, eventID, role);
                ListViewItem newStudent = new ListViewItem(new[] { name, matric, "No" });
                currentListView.Items.Add(newStudent);

                string roleInWords = "";
                if (role == 1) roleInWords = "Organiser";
                else if (role == 2) roleInWords = "Facilitator";
                else roleInWords = "Participant";
                toolStripStatusLabel1.Text = "Student <" + name + "> has been added to the " + roleInWords + "'s list.";
            }
            addstudent.Close();
        }
示例#4
0
        private void button2_Click(object sender, EventArgs e)
        {
            AddStudentPage addstudent = new AddStudentPage(server, eventId, false);
            addstudent.ShowDialog();
            if (addstudent.isConfirm) {
                inChargeTextBox.Text = addstudent.name;
                inChargeName = addstudent.name;
                matric = addstudent.matric;

            }
        }