예제 #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!");
        }
예제 #2
0
파일: Form2.cs 프로젝트: DeD-JIexa/BDshool
        public Form2()
        {
            InitializeComponent();

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

            comboBox1.DataSource = entities.Classes.ToList();
        }
예제 #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)");
        }
예제 #4
0
        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!");
        }
예제 #5
0
파일: Form2.cs 프로젝트: DeD-JIexa/BDshool
        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!");
        }