예제 #1
0
        private void btnaddclass_Click(object sender, EventArgs e)
        {
            if (listclassc.Count() != 0)
            {
                foreach (ClassC classroomC in listclassc)
                {
                    if (classroomC.Malop == txtclassid.Text)
                    {
                        MessageBox.Show("This id is already exist!!");
                        return;
                    }
                }
            }


            ClassC classC = new ClassC();

            classC.Malop    = txtclassid.Text;
            classC.Khoa     = txtsyear.Text;
            classC.HeDaoTao = txtcertificate.Text;
            listclassc.AddLast(classC);
            lvwclassroom.Items.Add(classC.Malop);
            int i = lvwclassroom.Items.Count - 1;

            lvwclassroom.Items[i].SubItems.Add(classC.Khoa);
            lvwclassroom.Items[i].SubItems.Add(classC.HeDaoTao);
            studenthashtable.Add(classC.Malop, new LinkedList <Student>());
        }
예제 #2
0
        private void btndeleteclass_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Do you want to delete? Yes/No", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                for (int i = listclassc.Count - 1; i >= 0; i--)
                {
                    ClassC classroomC = listclassc.ElementAt(i);

                    var classidselected = lvwclassroom.SelectedItems[0].Text;
                    if (classroomC.Malop == classidselected)
                    {
                        lvwclassroom.Items.Remove(lvwclassroom.SelectedItems[0]);
                        listclassc.Remove(classroomC);
                        lvwaddstudent.Items.Clear();
                        break;
                    }
                }
            }
        }
예제 #3
0
        private void btneditclass_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Do you want to edit? Yes/No", "Edit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                for (int i = listclassc.Count - 1; i >= 0; i--)
                {
                    ClassC classroomC = listclassc.ElementAt(i);

                    var temp = lvwclassroom.SelectedItems[0].Text;
                    if (classroomC.Malop == temp)
                    {
                        ClassC classC = new ClassC();
                        classC.Malop    = txtclassid.Text;
                        classC.Khoa     = txtsyear.Text;
                        classC.HeDaoTao = txtcertificate.Text;
                        int j = i;
                        lvwclassroom.Items[j].Text             = txtclassid.Text;
                        lvwclassroom.Items[j].SubItems[1].Text = txtsyear.Text;
                        lvwclassroom.Items[j].SubItems[2].Text = txtcertificate.Text;
                    }
                }
            }
        }