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

            int idrow;

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

            idrow = c[0].RowIndex;


            var s = dataGridView1.Rows[idrow];


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

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

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

            entities.Studs.Remove(dt);

            entities.SaveChanges();

            MessageBox.Show("Ученик удалён!");
        }
예제 #2
0
        private void StartBut_Click(object sender, EventArgs e)
        {
            #region Test
            BD.Silantev_StudBDEntities entities = new BD.Silantev_StudBDEntities();
            //var s = entities.Studs.ToList();
            //MessageBox.Show(s[16].UserName);
            #endregion

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

            studs.UserName = LogText.Text;

            studs.UserSurName = PasText.Text;

            var GR = comboBox1.SelectedItem as BD.Groups;


            studs.IdGr = GR.IdGr;

            entities.Studs.Add(studs);

            entities.SaveChanges();

            MessageBox.Show("Ученик добавлен!");
        }
예제 #3
0
파일: Form3.cs 프로젝트: DeD-JIexa/BDstuds
        private void button1_Click(object sender, EventArgs e)
        {
            BD.Silantev_StudBDEntities entities = new BD.Silantev_StudBDEntities();

            BD.Groups groups = new BD.Groups();

            groups.GroupName = textBox1.Text;

            entities.Groups.Add(groups);

            entities.SaveChanges();

            MessageBox.Show("Группа добавлена!");
        }