Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Conexion conexion = new Conexion(txtUsuario.Text, txtClave.Text, cmbDB.Text, true);

            if (string.IsNullOrEmpty(cmbDB.Text))
            {
                MessageBox.Show("Error.\nNo puede dejar campos vacios.");
                return;
            }
            Formularios.frmPrincipal frmPrincipal = null;
            this.BDConnection = conexion.ObtenerConexion();
            BDOperaciones BDO = new BDOperaciones(cmbDB.Text, BDConnection);

            Existe = BDO.VerificarExistencia(txtUsuario.Text, txtClave.Text);
            if (!Existe)
            {
                MessageBox.Show("Error.\nUsuario o Clave incorrectos.");
                return;
            }
            else
            {
                MessageBox.Show($"Acceso autorizado.\nBienvenido(a), {txtUsuario.Text}.");
            }
            frmPrincipal = new Formularios.frmPrincipal(cmbDB.Text, BDConnection);
            frmPrincipal.Show();
        }
Exemplo n.º 2
0
        private void btnCrear_Click(object sender, EventArgs e)
        {
            BDOperaciones BDO     = new BDOperaciones(BaseDatos, BDConnection);
            var           mensaje = BDO.InsertarCliente(txtNombre.Text, txtPaterno.Text, txtMaterno.Text, txtFecha.Text, txtCuyrp.Text, txtTelefono.Text, txtCalle.Text, txtColonia.Text) ?
                                    "Cliente creado." : "Error no se creo.";

            MessageBox.Show(mensaje);
        }
Exemplo n.º 3
0
        private void btnInsertar_Click(object sender, EventArgs e)
        {
            BDOperaciones BDO     = new BDOperaciones(BaseDatos, BDConnection);
            var           mensaje = BDO.InsertarCine(txtNombre.Text, txtDescripcion.Text, txtUbicacion.Text, dateTimePicker1.Text) ?
                                    "Cine creado." : "Error no se creo.";

            MessageBox.Show(mensaje);
            MostrarRegistros();
        }
Exemplo n.º 4
0
        private void frmEliminaRegistro_Load(object sender, EventArgs e)
        {
            listView1.Clear();
            BDOperaciones operaciones = new BDOperaciones(BaseDatos, BDConnection);

            if (BaseDatos == "PostgreSQL")
            {
                operaciones.CargarEnListView(listView1, @"SELECT * FROM public.""" + Tabla + "");
                return;
            }
            operaciones.CargarEnListView(listView1, $"SELECT * FROM {Tabla}");
        }
Exemplo n.º 5
0
        private void frmActualizaMembresia_Load(object sender, EventArgs e)
        {
            lvMembresia.Clear();
            BDOperaciones operaciones = new BDOperaciones(BaseDatos, BDConnection);

            if (BaseDatos == "PostgreSQL")
            {
                operaciones.CargarEnListView(lvMembresia, @"SELECT * FROM public.""Suscripcion""");
                return;
            }
            operaciones.CargarEnListView(lvMembresia, "SELECT * FROM Suscripcion");
        }
Exemplo n.º 6
0
        private void MostrarRegistros()
        {
            lvCine.Clear();
            BDOperaciones BDO = new BDOperaciones(BaseDatos, BDConnection);

            if (BaseDatos == "PostgreSQL")
            {
                BDO.CargarEnListView(lvCine, @"SELECT * FROM public.""Cine""");
                return;
            }
            BDO.CargarEnListView(lvCine, "SELECT * FROM Cine");
        }
Exemplo n.º 7
0
        private void verClientesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            listView1.Clear();
            BDOperaciones BDO = new BDOperaciones(BaseDatos, BDConnection);

            if (BaseDatos == "PostgreSQL")
            {
                BDO.CargarEnListView(listView1, @"SELECT * FROM public.""Cliente");
                return;
            }
            BDO.CargarEnListView(listView1, "SELECT * FROM Cliente");
        }
Exemplo n.º 8
0
        private void frmActualizaCliente_Load(object sender, EventArgs e)
        {
            lvClientes.Clear();
            BDOperaciones operaciones = new BDOperaciones(BaseDatos, BDConnection);

            if (BaseDatos == "PostgreSQL")
            {
                operaciones.CargarEnListView(lvClientes, @"SELECT * FROM public.""Cliente""");
                return;
            }
            operaciones.CargarEnListView(lvClientes, "SELECT * FROM Cliente");
        }
Exemplo n.º 9
0
        private void btnCrear_Click(object sender, EventArgs e)
        {
            if (txtClave.Text != txtRepiteClave.Text)
            {
                MessageBox.Show("Las claves no coinciden");
                return;
            }
            BDOperaciones operaciones = new BDOperaciones(BaseDatos, BDConnection);
            bool          result      = operaciones.CrearUsuario(txtUsuario.Text, txtClave.Text);
            string        mensaje     = result ? "Usuario creado" : "Error no se creo";

            MessageBox.Show(mensaje);
        }
Exemplo n.º 10
0
        private void btnInsertarMembresia_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtDescripcion.Text) || string.IsNullOrEmpty(txtPrecio.Text))
            {
                MessageBox.Show("No puede dejar campos vacios");
                return;
            }
            BDOperaciones operaciones = new BDOperaciones(BaseDatos, BDConnection);
            bool          result      = operaciones.InsertarSuscripcion(txtDescripcion.Text, txtFechaInicial.Text, txtFechaFinal.Text, txtPrecio.Text, txtIDMembresia.Text);
            string        mensaje     = result ? "Nueva Suscripcion creada" : "Error no se creo";

            MessageBox.Show(mensaje);
        }
Exemplo n.º 11
0
        private void btnAsignar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtCliente.Text) || string.IsNullOrEmpty(txtCine.Text))
            {
                MessageBox.Show("No puede dejar campos vacios.");
                return;
            }

            BDOperaciones BDO     = new BDOperaciones(BaseDatos, BDConnection);
            var           mensaje = BDO.InsertarCineCliente(txtCliente.Text, txtCine.Text, dateTimePicker1.Text) ?
                                    "Cliente asignado." : "Error no se creo.";

            MessageBox.Show(mensaje);
        }
Exemplo n.º 12
0
        private void btnInsertar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtCliente.Text) || string.IsNullOrEmpty(txtUsuario.Text))
            {
                MessageBox.Show("No puede dejar campos vacios.");
                return;
            }

            BDOperaciones BDO     = new BDOperaciones(BaseDatos, BDConnection);
            var           mensaje = BDO.InsertarClienteUsuario(txtCliente.Text, txtUsuario.Text, txtFechaAlta.Text, txtFechaBaja.Text) ?
                                    "Cliente creado." : "Error no se creo.";

            MessageBox.Show(mensaje);
        }
Exemplo n.º 13
0
        private void btnAsignar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtCliente.Text) || string.IsNullOrEmpty(txtMembresia.Text))
            {
                MessageBox.Show("No puede dejar espacio vacios");
                return;
            }

            BDOperaciones operaciones = new BDOperaciones(BaseDatos, BDConnection);
            bool          result      = operaciones.InsertarClienteSuscripcion(txtCliente.Text, txtMembresia.Text);
            string        mensaje     = result ? "Nueva Suscripcion asignada" : "Error no se pudo asignar";

            MessageBox.Show(mensaje);
        }
Exemplo n.º 14
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(ID))
            {
                MessageBox.Show("Debe seleccionar un registro para continuar");
                return;
            }

            BDOperaciones BDO     = new BDOperaciones(BaseDatos, BDConnection);
            var           mensaje = BDO.ActualizaCine(txtNombre.Text, txtDescripcion.Text, txtUbicacion.Text, dateTimePicker1.Text, ID) ?
                                    "Datos del Cine actualizado." : "Error no se actualizo.";

            MessageBox.Show(mensaje);
            MostrarRegistros();
        }
Exemplo n.º 15
0
        private void frmInsertarClienteUsuario_Load(object sender, EventArgs e)
        {
            lvClientes.Clear();
            lvUsuario.Clear();
            BDOperaciones BDO = new BDOperaciones(BaseDatos, BDConnection);

            if (BaseDatos == "PostgreSQL")
            {
                BDO.CargarEnListView(lvClientes, @"SELECT ""Cliente"".""idCliente"",""Cliente"".""Nombre"",""Cliente"".""ApellidoPaterno"", ""Cliente"".""ApellidoMaterno"" FROM public.""Cliente""");
                BDO.CargarEnListView(lvUsuario, @"SELECT ""Usuario"".""idUsuario"",""Usuario"".""Usuario"" FROM public.""Usuario""");
                return;
            }
            BDO.CargarEnListView(lvClientes, "SELECT idCliente AS ID, Nombre + ' ' + ApellidoPaterno + ' ' + ApellidoMaterno AS Cliente FROM Cliente");
            BDO.CargarEnListView(lvUsuario, "SELECT idUsuario AS ID, Usuario FROM Usuario");
        }
Exemplo n.º 16
0
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            listView1.Clear();
            BDOperaciones BDO = new BDOperaciones(BaseDatos, BDConnection);

            if (BaseDatos == "Access")
            {
                BDO.CargarEnListView(listView1, Consultas.accessClienteSuscripcion);
                return;
            }
            if (BaseDatos == "PostgreSQL")
            {
                BDO.CargarEnListView(listView1, Consultas.postqClienteSuscripcion);
                return;
            }
            BDO.CargarEnListView(listView1, Consultas.sqlClienteSuscripcion);
        }
Exemplo n.º 17
0
        private void verClientesConCineToolStripMenuItem_Click(object sender, EventArgs e)
        {
            listView1.Clear();
            BDOperaciones BDO = new BDOperaciones(BaseDatos, BDConnection);

            if (BaseDatos == "Access")
            {
                BDO.CargarEnListView(listView1, Consultas.accessClienteCine);
                return;
            }
            if (BaseDatos == "PostgreSQL")
            {
                BDO.CargarEnListView(listView1, Consultas.postqClienteCine);
                return;
            }
            BDO.CargarEnListView(listView1, Consultas.sqlClienteCine);
        }
Exemplo n.º 18
0
        private void btnInsertar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtMembresia.Text))
            {
                MessageBox.Show("No puede dejar campos vacios");
                return;
            }
            BDOperaciones operaciones = new BDOperaciones(BaseDatos, BDConnection);
            bool          result      = operaciones.InsertarNuevaSuscripcion(txtMembresia.Text);
            string        mensaje     = result ? "Nuevo tipo de Suscripcion creada" : "Error no se creo";

            MessageBox.Show(mensaje);

            listView1.Clear();
            if (BaseDatos == "PostgreSQL")
            {
                operaciones.CargarEnListView(listView1, @"SELECT * FROM public.""TipoSuscripcion""");
                return;
            }
            operaciones.CargarEnListView(listView1, "SELECT * FROM TipoSuscripcion");
        }
Exemplo n.º 19
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBox1.Text))
            {
                MessageBox.Show("No puede dejar espacio vacios");
                return;
            }

            BDOperaciones operaciones = new BDOperaciones(BaseDatos, BDConnection);
            bool          result      = operaciones.EliminaRegistro(textBox1.Text, Tabla);
            string        mensaje     = result ? $"El registro con ID: {textBox1.Text}, se ha eliminado" : "Error no se pudo eliminar.\nEl ID que desea eliminar ya se encuentra asignado a otro registro";

            MessageBox.Show(mensaje);

            listView1.Clear();
            if (BaseDatos == "PostgreSQL")
            {
                operaciones.CargarEnListView(listView1, @"SELECT * FROM public.""" + Tabla + "");
                return;
            }
            operaciones.CargarEnListView(listView1, $"SELECT * FROM {Tabla}");
        }
Exemplo n.º 20
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtID.Text))
            {
                MessageBox.Show("No puede dejar espacio vacios");
                return;
            }

            BDOperaciones operaciones = new BDOperaciones(BaseDatos, BDConnection);
            bool          result      = operaciones.ActualizaSuscripcion(txtDescripcion.Text, txtFechaInicial.Text, txtFechaFinal.Text, txtPrecio.Text, txtID.Text);
            string        mensaje     = result ? $"La Suscripcion con ID: {txtID.Text}, se ha actualizado" : "Error no se pudo asignar";

            MessageBox.Show(mensaje);

            lvMembresia.Clear();
            if (BaseDatos == "PostgreSQL")
            {
                operaciones.CargarEnListView(lvMembresia, @"SELECT * FROM public.""Suscripcion""");
                return;
            }
            operaciones.CargarEnListView(lvMembresia, "SELECT * FROM Suscripcion");
        }
Exemplo n.º 21
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBox1.Text))
            {
                MessageBox.Show("No puede dejar espacio vacios");
                return;
            }

            BDOperaciones operaciones = new BDOperaciones(BaseDatos, BDConnection);
            bool          result      = operaciones.ActualizaCliente(txtNombre.Text, txtPaterno.Text, txtMaterno.Text, txtFecha.Text, txtCuyrp.Text, txtTelefono.Text, txtCalle.Text, txtColonia.Text, textBox1.Text);
            string        mensaje     = result ? $"El cliente con ID: {textBox1.Text}, se ha actualizado" : "Error no se pudo asignar";

            MessageBox.Show(mensaje);

            lvClientes.Clear();
            if (BaseDatos == "PostgreSQL")
            {
                operaciones.CargarEnListView(lvClientes, @"SELECT * FROM public.""Cliente""");
                return;
            }
            operaciones.CargarEnListView(lvClientes, "SELECT * FROM Cliente");
        }