Example #1
0
        private void BChange_Click(object sender, EventArgs e)
        {
            if (LBStudents.SelectedItems.Count != 0)
            {
                var selItem = LBStudents.SelectedItem as Student;
                var wnd     = new AddStudent();
                wnd.NameP      = selItem.Name;
                wnd.Surname    = selItem.Surname;
                wnd.Patronymic = selItem.Patronymic;
                wnd.Birthday   = selItem.Birthday;
                wnd.Teachers   = teachers;
                wnd.Phone      = selItem._Teacher.PhoneNumber;

                wnd.SelectTeacher = selItem._Teacher.Name;
                if (wnd.ShowDialog() == DialogResult.OK)
                {
                    selItem._Teacher = new Teacher {
                        Name = wnd.SelectTeacher
                    };
                    selItem.Name        = wnd.NameP;
                    selItem.Surname     = wnd.Surname;
                    selItem.Patronymic  = wnd.Patronymic;
                    selItem.Birthday    = wnd.Birthday;
                    selItem.PhoneNumber = wnd.Phone;
                }
                wnd.Dispose();
            }
        }
Example #2
0
        private void BAdd_Click(object sender, EventArgs e)
        {
            var wnd = new AddStudent();

            wnd.Teachers = teachers;
            if (wnd.ShowDialog() == DialogResult.OK)
            {
                students.Add(new Student {
                    Name = wnd.NameP, Surname = wnd.Surname, Patronymic = wnd.Patronymic, Birthday = wnd.Birthday
                });
                students.Last()._Teacher = (from i in teachers where i.Name == wnd.SelectTeacher select i).First();
            }
            wnd.Dispose();
            FilterStudents();
            bsStudents.ResetBindings(false);
        }
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            AddStudent frm = new AddStudent();

            frm.Show();
        }