Exemplo n.º 1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            using ( var context = new EntidadesLibreria() )
            {
                try
                {
                    if (txtCedulaUsuario.Text != string.Empty && txtNombreUsuario.Text != string.Empty && txtApellidoUsuario.Text != string.Empty && txtDireccionUsuario.Text != string.Empty && txtCelularUsuario.Text != string.Empty && cbLibroSeleccionado.Text != string.Empty)
                    {
                        context.INSERTAR_USUARIO(txtCedulaUsuario.Text, txtNombreUsuario.Text, txtApellidoUsuario.Text, txtDireccionUsuario.Text, Convert.ToDecimal(txtCelularUsuario.Text), Convert.ToDecimal(cbLibroSeleccionado.SelectedValue));
                        context.SaveChanges();
                        txtCedulaUsuario.Text = string.Empty;
                        txtNombreUsuario.Text = string.Empty;
                        txtApellidoUsuario.Text = string.Empty;
                        txtDireccionUsuario.Text = string.Empty;
                        txtCelularUsuario.Text = string.Empty;
                        cbLibroSeleccionado.SelectedIndex = 0;

                        MessageBox.Show(this, "Usuario registrado correctamente");
                    }
                    else
                    {
                        MessageBox.Show(this, "No pueden existir campos vacios");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, "Error: " + ex.Message);
                }
            }
        }
Exemplo n.º 2
0
 private void btnGuardarLibro_Click(object sender, EventArgs e)
 {
     using (var context = new EntidadesLibreria())
     {
         var libro = context.INSERTAR_LIBRO(txtNombreLibro.Text, txtNombreAutor.Text);
         try
         {
             if (txtNombreAutor.Text != string.Empty && txtNombreLibro.Text != string.Empty)
             {
                 context.SaveChanges();
                 txtNombreAutor.Text = string.Empty;
                 txtNombreLibro.Text = string.Empty;
                 MessageBox.Show(this, "El libro ha sido guardado correctamente");
             }
             else
             {
                 MessageBox.Show(this, "No puede dejar los campos vacios");
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(this, "Error: " + ex.Message);
         }
     }
 }
Exemplo n.º 3
0
 private void btnGuardarLibro_Click(object sender, EventArgs e)
 {
     using ( var context = new EntidadesLibreria() )
     {
         var libro = context.INSERTAR_LIBRO(txtNombreLibro.Text, txtNombreAutor.Text);
         try
         {
             if (txtNombreAutor.Text != string.Empty && txtNombreLibro.Text != string.Empty)
             {
                 context.SaveChanges();
                 txtNombreAutor.Text = string.Empty;
                 txtNombreLibro.Text = string.Empty;
                 MessageBox.Show(this, "El libro ha sido guardado correctamente");
             }
             else
             {
                 MessageBox.Show(this, "No puede dejar los campos vacios");
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(this, "Error: " + ex.Message);
         }
     }
 }
Exemplo n.º 4
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            using (var context = new EntidadesLibreria())
            {
                try
                {
                    if (txtCedulaUsuario.Text != string.Empty && txtNombreUsuario.Text != string.Empty && txtApellidoUsuario.Text != string.Empty && txtDireccionUsuario.Text != string.Empty && txtCelularUsuario.Text != string.Empty && cbLibroSeleccionado.Text != string.Empty)
                    {
                        context.INSERTAR_USUARIO(txtCedulaUsuario.Text, txtNombreUsuario.Text, txtApellidoUsuario.Text, txtDireccionUsuario.Text, Convert.ToDecimal(txtCelularUsuario.Text), Convert.ToDecimal(cbLibroSeleccionado.SelectedValue));
                        context.SaveChanges();
                        txtCedulaUsuario.Text             = string.Empty;
                        txtNombreUsuario.Text             = string.Empty;
                        txtApellidoUsuario.Text           = string.Empty;
                        txtDireccionUsuario.Text          = string.Empty;
                        txtCelularUsuario.Text            = string.Empty;
                        cbLibroSeleccionado.SelectedIndex = 0;

                        MessageBox.Show(this, "Usuario registrado correctamente");
                    }
                    else
                    {
                        MessageBox.Show(this, "No pueden existir campos vacios");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, "Error: " + ex.Message);
                }
            }
        }
Exemplo n.º 5
0
        public Form5()
        {
            InitializeComponent();
            dgUsuarios.AutoGenerateColumns = false;

            using (var context = new EntidadesLibreria())
            {
                dgUsuarios.DataSource = null;
                dgUsuarios.DataSource = (from q in context.TBL_USUARIO.OrderBy(x => x.ID_USUARIO) select q).ToList();
                dgUsuarios.Refresh();
            }
        }
Exemplo n.º 6
0
        public Form4()
        {
            InitializeComponent();
            dgLibros.AutoGenerateColumns = false;

            using (var context = new EntidadesLibreria())
            {
                dgLibros.DataSource = null;
                dgLibros.DataSource = (from q in context.TBL_LIBRO.OrderBy(x => x.ID_LIBRO) select q).ToList();
                dgLibros.Refresh();
            }
        }
Exemplo n.º 7
0
        public Form2()
        {
            InitializeComponent();
            CenterToScreen();

            using ( var context = new EntidadesLibreria() )
            {
                var libros = (from q in context.TBL_LIBRO select q).ToList();
                cbLibroSeleccionado.DataSource = libros;
                cbLibroSeleccionado.DisplayMember = "NOMBRE_LIBRO";
                cbLibroSeleccionado.ValueMember = "ID_LIBRO";
            }
        }
Exemplo n.º 8
0
        public Form2()
        {
            InitializeComponent();
            CenterToScreen();

            using (var context = new EntidadesLibreria())
            {
                var libros = (from q in context.TBL_LIBRO select q).ToList();
                cbLibroSeleccionado.DataSource    = libros;
                cbLibroSeleccionado.DisplayMember = "NOMBRE_LIBRO";
                cbLibroSeleccionado.ValueMember   = "ID_LIBRO";
            }
        }
Exemplo n.º 9
0
        public Form3()
        {
            InitializeComponent();
            CenterToParent();
            CenterToScreen();
            dgLogs.AutoGenerateColumns = false;

            using (var context = new EntidadesLibreria())
            {
                dgLogs.DataSource = null;
                dgLogs.DataSource = (from q in context.TBL_LOG.OrderBy(x => x.ID_LOG) select q).ToList();
                dgLogs.Refresh();
            }
        }
Exemplo n.º 10
0
        public Form3()
        {
            InitializeComponent();
            CenterToParent();
            CenterToScreen();
            dgLogs.AutoGenerateColumns = false;

            using ( var context = new EntidadesLibreria() )
            {
                dgLogs.DataSource = null;
                dgLogs.DataSource = (from q in context.TBL_LOG.OrderBy(x => x.ID_LOG) select q).ToList();
                dgLogs.Refresh();
            }
        }