private void button3_Click(object sender, EventArgs e)
        {
            PrincipalFP db = new PrincipalFP();
            int id = int.Parse(textBox12.Text);
            var agent = db.Registro
                      .SingleOrDefault(x => x.id == id);
            // where x.id == id
            //select x;

            if (agent != null)
            {
                agent.Password = int.Parse(textBox11.Text);
                agent.Nombre = textBox10.Text;
                agent.Edad = int.Parse(textBox9.Text);
                agent.Telefono = textBox8.Text;
                agent.Direccion = textBox7.Text;
                db.SaveChanges();
            }
            MessageBox.Show("Modificar exito.");
            textBox12.Clear();
            textBox11.Clear();
            textBox10.Clear();
            textBox9.Clear();
            textBox8.Clear();
            textBox7.Clear();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            if (Regex.IsMatch(textBox1.Text, @"^\d+$"))
            {
                PrincipalFP db = new PrincipalFP();
                int idEditores = int.Parse(textBox1.Text);
                var emp = db.Editores
                          .SingleOrDefault(x => x.idEditores == idEditores);
                // where x.id == id
                //select x;

                if (emp != null)
                {
                    db.Editores.Remove(emp);
                    MessageBox.Show("Eliminar exito.");
                    db.SaveChanges();
                    textBox1.Clear();
                }
            }

            else
            {
                MessageBox.Show("Solo numeros #id");

            }
        }
示例#3
0
        private void button2_Click(object sender, EventArgs e)
        {
            PrincipalFP db = new PrincipalFP();
            DBclass.Categoria ca = new DBclass.Categoria();
            ca.Nombre = textBox2.Text;

            db.Categoria.Add(ca);
            db.SaveChanges();

            MessageBox.Show("Registro exito.");
            textBox1.Clear();
            textBox2.Clear();
        }
 private void button2_Click(object sender, EventArgs e)
 {
     PrincipalFP db = new PrincipalFP();
     int idCategoria = int.Parse(textBox1.Text);
     var registros = from s in db.Categoria
                     where s.idCategoria == idCategoria
                     select new
                     {
                         s.idCategoria,
                         s.Nombre
                     };
     dataGridView1.DataSource = registros.ToList();
 }
 private void button2_Click(object sender, EventArgs e)
 {
     PrincipalFP db = new PrincipalFP();
     int idLibro = int.Parse(textBox1.Text);
     var registros = from s in db.Libro
                     where s.idLibro == idLibro
                     select new
                     {
                         s.idLibro,
                         s.Titulo,
                         s.Fecha
                     };
     dataGridView1.DataSource = registros.ToList();
 }
示例#6
0
        private void button2_Click(object sender, EventArgs e)
        {
            PrincipalFP db = new PrincipalFP();
            DBclass.Libro li = new DBclass.Libro();
            li.Fecha = textBox3.Text;
            li.Titulo = textBox4.Text;
            li.Editores = textBox1.Text;
            db.Libro.Add(li);
            db.SaveChanges();

            MessageBox.Show("Registro exito.");
            textBox1.Clear();
            textBox2.Clear();
            textBox3.Clear();
            textBox4.Clear();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            PrincipalFP db = new PrincipalFP();
            int idEditores = int.Parse(textBox1.Text);
            var registros = from s in db.Editores
                            where s.idEditores == idEditores
                            select new
                            {
                                s.idEditores,
                                s.Editor,
                                s.Telefono,
                                s.Direccion

                            };
            dataGridView1.DataSource = registros.ToList();
        }
示例#8
0
        private void button2_Click(object sender, EventArgs e)
        {
            PrincipalFP db = new PrincipalFP();
            DBclass.Autor au = new DBclass.Autor();
            au.Nombre = textBox2.Text;
            au.Pais = textBox3.Text;
            au.Telefono = textBox4.Text;
            db.Autor.Add(au);
            db.SaveChanges();

            MessageBox.Show("Registro exito.");
            textBox2.Clear();
            textBox1.Clear();
            textBox3.Clear();
            textBox4.Clear();
        }
 private void button2_Click(object sender, EventArgs e)
 {
     PrincipalFP db = new PrincipalFP();
     int id = int.Parse(textBox1.Text);
     var registros = from s in db.Registro
                     where s.id == id
                     select new
                     {
                         s.id,
                         s.Password,
                         s.Nombre,
                         s.Edad,
                         s.Telefono,
                         s.Direccion
                     };
     dataGridView1.DataSource = registros.ToList();
 }
        private void button3_Click(object sender, EventArgs e)
        {
            PrincipalFP db = new PrincipalFP();
            int idCategoria = int.Parse(textBox3.Text);
            var agent = db.Categoria
                      .SingleOrDefault(x => x.idCategoria == idCategoria);
            // where x.id == id
            //select x;

            if (agent != null)
            {
                agent.Nombre = textBox2.Text;

                db.SaveChanges();
            }
            MessageBox.Show("Modificar exito.");
            textBox2.Clear();
            textBox3.Clear();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            PrincipalFP db = new PrincipalFP();
            int idEditores = int.Parse(textBox1.Text);
            var agent = db.Editores
                      .SingleOrDefault(x => x.idEditores == idEditores);
            // where x.id == id
            //select x;

            if (agent != null)
            {
                agent.Editor = textBox2.Text;
                agent.Direccion = textBox3.Text;
                agent.Telefono = textBox4.Text;
                db.SaveChanges();
            }
            MessageBox.Show("Modificar exito.");
            textBox1.Clear();
            textBox2.Clear();
            textBox3.Clear();
            textBox4.Clear();
        }
示例#12
0
        private void button2_Click(object sender, EventArgs e)
        {
            PrincipalFP db = new PrincipalFP();
            Registro log1 = new Registro();

            log1.Password = int.Parse(textBox11.Text);
            log1.Nombre = textBox10.Text;
            log1.Edad = int.Parse(textBox9.Text);
            log1.Telefono = textBox8.Text;
            log1.Direccion = textBox7.Text;

            db.Registro.Add(log1);
            db.SaveChanges();

            MessageBox.Show("Registro exito.");
            textBox12.Clear();
            textBox11.Clear();
            textBox10.Clear();
            textBox9.Clear();
            textBox8.Clear();
            textBox7.Clear();
        }