예제 #1
0
        private void actualizarTabla()
        {
            using (ColegioEntities col = new ColegioEntities())
            {
                IQueryable <Administradores> admin = from d in col.Administradores
                                                     select d;

                List <Administradores> listado = admin.ToList();

                dataGridView1.DataSource = listado;
            }
        }
예제 #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            //Actualizar

            var indice = dataGridView1.CurrentRow.Index;

            using (ColegioEntities col = new ColegioEntities())
            {
                Actualizar ventanaActualizar = new Actualizar(indice, dataGridView1);
                ventanaActualizar.Show();
            }
        }
예제 #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            using (ColegioEntities col = new ColegioEntities())
            {
                IQueryable <Administradores> admin = from d in col.Administradores
                                                     select d;

                List <Administradores> listado = admin.ToList();

                dataGridView1.DataSource = listado;
            }
        }
예제 #4
0
        private void button4_Click(object sender, EventArgs e)
        {
            var indice = dataGridView1.CurrentRow.Index;
            var id     = int.Parse(dataGridView1.Rows[indice].Cells[0].Value.ToString());

            using (ColegioEntities col = new ColegioEntities())
            {
                Administradores admins = col.Administradores.FirstOrDefault(admins1 => admins1.id.Equals(id));
                MessageBox.Show(admins.ToString());

                col.Administradores.Remove(admins);
                col.SaveChanges();
                actualizarTabla();
            }
        }
예제 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            using (ColegioEntities col = new ColegioEntities())
            {
                Administradores admin = new Administradores
                {
                    nombre     = textBox1.Text,
                    apellido   = textBox2.Text,
                    contrasena = textBox3.Text,
                };

                col.Administradores.Add(admin);
                col.SaveChanges();
                this.Hide();
                MessageBox.Show("Se ha guardado con exito");
                actualizarTabla();
            }
        }
예제 #6
0
        private void button2_Click(object sender, EventArgs e)//Boton iniciar sesion
        {
            using (ColegioEntities col = new ColegioEntities())
            {
                var admin = from d in col.Administradores
                            where d.nombre == textBox1.Text &&
                            d.contrasena == textBox2.Text
                            select d;

                if (admin.Count() > 0)
                {
                    this.Hide();
                    Form2 menu = new Form2();
                    menu.Show();
                }
                else
                {
                    MessageBox.Show("Credenciales incorrectas");
                }
            }
        }
예제 #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            using (ColegioEntities col = new ColegioEntities())
            {
                var             id    = int.Parse(datagridview1.Rows[indice].Cells[0].Value.ToString());
                Administradores admin = col.Administradores.FirstOrDefault(admin1 => admin1.id.Equals(id));

                admin.nombre     = textBox1.Text;
                admin.apellido   = textBox2.Text;
                admin.contrasena = textBox3.Text;

                col.SaveChanges();

                IQueryable <Administradores> admin2 = from d in col.Administradores
                                                      select d;

                List <Administradores> listado = admin2.ToList();

                datagridview1.DataSource = listado;
                this.Hide();
                MessageBox.Show("Se guardaron los cambios");
            }
        }