コード例 #1
0
        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();
        }
コード例 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (Regex.IsMatch(textBox1.Text, @"^\d+$"))
            {
                PrincipalFP db          = new PrincipalFP();
                int         idCategoria = int.Parse(textBox1.Text);
                var         emp         = db.Categoria
                                          .SingleOrDefault(x => x.idCategoria == idCategoria);
                // where x.id == id
                //select x;

                if (emp != null)
                {
                    db.Categoria.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();
        }
コード例 #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            PrincipalFP db = new PrincipalFP();

            DBclass.Editores au = new DBclass.Editores();
            au.Editor    = textBox2.Text;
            au.Direccion = textBox3.Text;
            au.Telefono  = textBox4.Text;
            db.Editores.Add(au);
            db.SaveChanges();

            MessageBox.Show("Registro exito.");
            textBox2.Clear();
            textBox1.Clear();
            textBox3.Clear();
            textBox4.Clear();
        }
コード例 #5
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();
        }
コード例 #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();
        }
コード例 #7
0
        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();
        }
コード例 #8
0
        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();
        }
コード例 #9
0
ファイル: Alta.cs プロジェクト: Jhonatan1234/Proyecto-final2
        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();
        }