Beispiel #1
0
        private void DelLessonBut_Click(object sender, EventArgs e)
        {
            var c = dataGridView1.SelectedCells;

            int indrow;

            if (c.Count == 0)
            {
                return;
            }

            indrow = c[0].RowIndex;

            var s = dataGridView1.Rows[indrow];

            var dels = (int)s.Cells[0].Value;

            BD.SchoolEntities entities = new BD.SchoolEntities();

            BD.Lessons dt = entities.Lessons.Find(dels);

            entities.Lessons.Remove(dt);

            entities.SaveChanges();

            MessageBox.Show("Lesson delited!");
        }
Beispiel #2
0
        public Form2()
        {
            InitializeComponent();

            BD.SchoolEntities entities = new BD.SchoolEntities();

            comboBox1.DataSource = entities.Classes.ToList();
        }
Beispiel #3
0
        private void AddLessonsBut_Click(object sender, EventArgs e)
        {
            BD.SchoolEntities entities = new BD.SchoolEntities();

            BD.Lessons lessons = new BD.Lessons();

            lessons.NameL = textBox1.Text;

            MessageBox.Show("Add lesson(does not work)");
        }
        private void AddTeachearsBut_Click(object sender, EventArgs e)
        {
            BD.SchoolEntities entities = new BD.SchoolEntities();

            BD.Teachers teachers = new BD.Teachers();

            teachers.NameT = NameBox.Text;

            teachers.SurNameT = SurNameBox.Text;

            entities.Teachers.Add(teachers);

            entities.SaveChanges();

            MessageBox.Show("Add Teacher!");
        }
Beispiel #5
0
        private void AddStudsBut_Click(object sender, EventArgs e)
        {
            BD.SchoolEntities entities = new BD.SchoolEntities();

            BD.Studs studs = new BD.Studs();

            studs.NameS = NameBox.Text;

            studs.SurNameS = SurNameBox.Text;

            var cl = comboBox1.SelectedItem as BD.Classes;

            studs.IdCl = cl.IdCl;

            entities.Studs.Add(studs);

            entities.SaveChanges();

            MessageBox.Show("Stud add!");
        }