Ejemplo n.º 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("Ученик удалён!");
        }
Ejemplo n.º 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("Ученик добавлен!");
        }
Ejemplo n.º 3
0
        public Form1()
        {
            InitializeComponent();

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

            comboBox1.DataSource = entities.Groups.ToList();
        }
Ejemplo n.º 4
0
        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("Группа добавлена!");
        }