コード例 #1
0
        private void btBusqueda_Click(object sender, EventArgs e)
        {
            try
            {
                MySqlCommand sql = new MySqlCommand(String.Format("pd_BuscarEmpleadoCodigo"), ConectarServidor.conexion());
                sql.CommandType = CommandType.StoredProcedure;

                sql.Parameters.AddWithValue("@id_emp", txtCodigo.Text);
                MySqlDataReader reader = sql.ExecuteReader();

                if (reader.Read() == true)
                {
                    txtCodigo.Enabled      = false;
                    txtNombre.Enabled      = true;
                    txtNombre.BackColor    = Color.White;
                    txtApellido.Enabled    = true;
                    txtApellido.BackColor  = Color.White;
                    txtDireccion.Enabled   = true;
                    txtDireccion.BackColor = Color.White;
                    txtTelefono.Enabled    = true;
                    txtTelefono.BackColor  = Color.White;
                    txtCorreo.Enabled      = true;
                    txtCorreo.BackColor    = Color.White;
                    comboBox9.Enabled      = true;
                    comboBox9.BackColor    = Color.White;

                    txtNombre.Text    = reader.GetString(1);
                    txtApellido.Text  = reader.GetString(2);
                    txtDireccion.Text = reader.GetString(3);
                    txtTelefono.Text  = reader.GetString(4);
                    txtCorreo.Text    = reader.GetString(6);

                    string puesto      = reader.GetString(5);
                    string instruccion = "SELECT idPuestos, Nombre_Puesto FROM Puestos WHERE idPuestos = " + puesto;
                    sql = new MySqlCommand(String.Format(instruccion), ConectarServidor.conexion());
                    MySqlDataReader dr2 = sql.ExecuteReader();
                    if (dr2.Read() == true)
                    {
                        comboBox9.Text = dr2.GetString(1);
                    }
                }
                else
                {
                    txtCodigo.Clear();
                    txtNombre.Clear();
                    txtApellido.Clear();
                    txtDireccion.Clear();
                    txtTelefono.Clear();
                    txtCorreo.Clear();
                    MessageBox.Show("El Codigo que busca no se encontro.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                MySqlCommand sql = new MySqlCommand(String.Format("pd_BuscarEmpleadoNombre"), ConectarServidor.conexion());
                sql.CommandType = CommandType.StoredProcedure;

                sql.Parameters.AddWithValue("@nombre", tbNombre.Text);
                MySqlDataReader reader = sql.ExecuteReader();

                if (reader.Read() == true)
                {
                    tbCodigo.Clear();
                    lblCodigo.Text    = reader.GetString(0);
                    lblNombre.Text    = reader.GetString(1);
                    lblApellido.Text  = reader.GetString(2);
                    lblDireccion.Text = reader.GetString(3);
                    lblTelefono.Text  = reader.GetString(4);
                    lblCorreo.Text    = reader.GetString(6);

                    string puesto      = reader.GetString(5);
                    string instruccion = "SELECT idPuestos, Nombre_Puesto FROM Puestos WHERE idPuestos = " + puesto;
                    sql = new MySqlCommand(String.Format(instruccion), ConectarServidor.conexion());
                    MySqlDataReader dr2 = sql.ExecuteReader();
                    if (dr2.Read() == true)
                    {
                        lblPuesto.Text = dr2.GetString(1);
                    }
                }
                else
                {
                    tbCodigo.Clear();
                    lblCodigo.Text    = "";
                    lblNombre.Text    = "";
                    lblApellido.Text  = "";
                    lblDireccion.Text = "";
                    lblTelefono.Text  = "";
                    lblCorreo.Text    = "";
                    tbNombre.Clear();
                    lblPuesto.Text = "";
                    MessageBox.Show("El Nombre que busca no se encontro.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #3
0
ファイル: Video.cs プロジェクト: Abner17/RentaVideos
        public static int Agregar(Video pVideo)
        {
            int retorno = 0;


            MySqlCommand registroCliente = new MySqlCommand(string.Format("Insert into Videos (" +
                                                                          "idVideo, Titulo, Descripcion, Duracion, Copias, " +
                                                                          "Categoria, Año, ActorPrincipal, Director, Precio, Formato) " +
                                                                          "values ('{0}','{1}','{2}', '{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')",
                                                                          pVideo.Codigo, pVideo.Titulo, pVideo.Descripcion, pVideo.Duracion, pVideo.Copias,
                                                                          pVideo.Categoria, pVideo.Anio, pVideo.ActorPrincipal, pVideo.Director, pVideo.Precio, pVideo.Formato),
                                                            ConectarServidor.conexion());



            retorno = registroCliente.ExecuteNonQuery();

            return(retorno);
        }
コード例 #4
0
ファイル: registrarVideo.cs プロジェクト: Abner17/RentaVideos
        private void categoriaVideo_SelectedIndexChanged(object sender, EventArgs e)
        {
            int indCategoria = categoriaVideo.SelectedIndex;
            int indActor     = actorPrincipalVideo.SelectedIndex;

            if (indCategoria == 0)

            {
                string nombre;
                nombre = Microsoft.VisualBasic.Interaction.InputBox("Ingrese nueva Categoría:", "Registro de Categoría", "Ingrese aqui..");
                if (nombre != "")
                {
                    MySqlCommand formato = new MySqlCommand(string.Format("Insert into Categoria_Video (Categoria) values ('{0}')",
                                                                          nombre), ConectarServidor.conexion());
                    int resultado = formato.ExecuteNonQuery();
                    if (resultado > 0)
                    {
                        MessageBox.Show("Categoría guarada con exito!!", "Guardado", MessageBoxButtons.OK, MessageBoxIcon.Information);


                        categoriaVideo.Text = "Seleccione Categoria";
                        categoriaVideo.Items.Clear();
                        MySqlCommand    cmc       = new MySqlCommand("Select Categoria from Categoria_Video", ConectarServidor.conexion());
                        MySqlDataReader almacenac = cmc.ExecuteReader();
                        categoriaVideo.Items.Add("AGREGAR NUEVO");
                        while (almacenac.Read())
                        {
                            categoriaVideo.Refresh();
                            categoriaVideo.Items.Add(almacenac.GetValue(0).ToString());
                        }
                    }
                    else
                    {
                        MessageBox.Show("No se pudo guardar la categoria", "Fallo!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    MessageBox.Show("Saliendo del registro", "Salida con exito!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
コード例 #5
0
ファイル: registrarVideo.cs プロジェクト: Abner17/RentaVideos
        private void directorVideo_SelectedIndexChanged(object sender, EventArgs e)
        {
            int indDirector = directorVideo.SelectedIndex;


            if (indDirector == 0)
            {
                string nombre;
                nombre = Microsoft.VisualBasic.Interaction.InputBox("Ingrese nuevo nombre:", "Registro de Director", "Ingrese aqui..");
                if (nombre != "")
                {
                    MySqlCommand director = new MySqlCommand(string.Format("Insert into Director_Video (Nombre) values ('{0}')",
                                                                           nombre), ConectarServidor.conexion());
                    int resultado = director.ExecuteNonQuery();
                    if (resultado > 0)
                    {
                        MessageBox.Show("Director guarado con exito!!", "Guardado", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        directorVideo.Text = "Seleccione Director";
                        directorVideo.Items.Clear();
                        MySqlCommand    cm       = new MySqlCommand("Select Nombre from Director_Video", ConectarServidor.conexion());
                        MySqlDataReader almacena = cm.ExecuteReader();
                        directorVideo.Items.Add("AGREGAR NUEVO");
                        while (almacena.Read())
                        {
                            directorVideo.Refresh();
                            directorVideo.Items.Add(almacena.GetValue(0).ToString());
                        }
                    }
                    else
                    {
                        MessageBox.Show("No se pudo guardar el director", "Fallo!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    MessageBox.Show("Saliendo del registro", "Salida con exito!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
コード例 #6
0
        private void btIngresar_Click(object sender, EventArgs e)
        {
            try
            {
                MySqlCommand sql = new MySqlCommand(String.Format("	pd_ModificarProveedor"), ConectarServidor.conexion());
                sql.CommandType = CommandType.StoredProcedure;

                sql.Parameters.AddWithValue("@codigo", txtCodigo.Text);
                sql.Parameters.AddWithValue("@nombre", txtNombre.Text);
                sql.Parameters.AddWithValue("@direccion", txtDireccion.Text);
                sql.Parameters.AddWithValue("@telefono", int.Parse(txtTelefono.Text));
                sql.Parameters.AddWithValue("@correo", txtCorreo.Text);

                sql.ExecuteNonQuery();

                MessageBox.Show("CONFIGURACION REALIZADA CON EXITO!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("NO SE PUDO REALIZAR LA CONFIGURACION!");
            }

            this.limpiarDesactivarCasillas();
        }
コード例 #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                MySqlCommand sql = new MySqlCommand(String.Format("pd_BuscarProveedorNombre"), ConectarServidor.conexion());
                sql.CommandType = CommandType.StoredProcedure;

                sql.Parameters.AddWithValue("@nombre", tbNombre.Text);
                MySqlDataReader reader = sql.ExecuteReader();

                if (reader.Read() == true)
                {
                    lblCodigo.Text    = reader.GetString(0);
                    lblNombre.Text    = reader.GetString(1);
                    lblDireccion.Text = reader.GetString(2);
                    lblTelefono.Text  = reader.GetString(3);
                    lblCorreo.Text    = reader.GetString(4);
                }
                else
                {
                    MessageBox.Show("El Nombre que busca no se encontro.");
                    lblNombre.Text    = "";
                    lblDireccion.Text = "";
                    lblTelefono.Text  = "";
                    lblCorreo.Text    = "";
                    tbCodigo.Clear();
                    tbNombre.Clear();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #8
0
ファイル: buscarCliente.cs プロジェクト: Abner17/RentaVideos
        private void btBusqueda_Click(object sender, EventArgs e)
        {
            try
            {
                MySqlCommand sql = new MySqlCommand(String.Format("pd_BuscarClienteCodigo"), ConectarServidor.conexion());
                sql.CommandType = CommandType.StoredProcedure;

                sql.Parameters.AddWithValue("@codigo", tbNIT.Text);
                MySqlDataReader reader = sql.ExecuteReader();

                if (reader.Read() == true)
                {
                    tbNIT.Clear();
                    lblNit.Text       = tbNIT.Text;
                    lblNombre.Text    = reader.GetString(1);
                    lblApellido.Text  = reader.GetString(2);
                    lblDpi.Text       = reader.GetString(3);
                    lblDireccion.Text = reader.GetString(4);
                    lblSexo.Text      = reader.GetString(5);
                    lblFecha.Text     = reader.GetString(6);
                    lblTelefono.Text  = reader.GetString(7);
                }
                else
                {
                    tbNIT.Clear();
                    lblNit.Text       = "";
                    lblNombre.Text    = "";
                    lblApellido.Text  = "";
                    lblDpi.Text       = "";
                    lblDireccion.Text = "";
                    lblSexo.Text      = "";
                    lblFecha.Text     = "";
                    lblTelefono.Text  = "";
                    tbNombre.Clear();
                    MessageBox.Show("El NIT que busca no se encontro.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #9
0
        private void configurarEmpleado_Load(object sender, EventArgs e)
        {
            this.autoCompletarCodigo();

            try
            {
                MySqlCommand     sql = new MySqlCommand(String.Format("Select * from Puestos"), ConectarServidor.conexion());
                MySqlDataAdapter da  = new MySqlDataAdapter(sql);
                DataSet          ds  = new DataSet();

                da.Fill(ds);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    comboBox9.Items.Add(ds.Tables[0].Rows[i][0] + " | " + ds.Tables[0].Rows[i][1]);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #10
0
        private void btIngresar_Click(object sender, EventArgs e)
        {
            string cod = comboBox9.SelectedItem.ToString();

            cod = cod.Substring(0, cod.IndexOf(" "));
            try
            {
                MySqlCommand sql = new MySqlCommand(String.Format("pd_ModificarEmpleado"), ConectarServidor.conexion());
                sql.CommandType = CommandType.StoredProcedure;

                sql.Parameters.AddWithValue("@codigo", txtCodigo.Text);
                sql.Parameters.AddWithValue("@nombre", txtNombre.Text);
                sql.Parameters.AddWithValue("@apellido", txtApellido.Text);
                sql.Parameters.AddWithValue("@direccion", txtDireccion.Text);
                sql.Parameters.AddWithValue("@telefono", int.Parse(txtTelefono.Text));
                sql.Parameters.AddWithValue("@puesto", int.Parse(cod));
                sql.Parameters.AddWithValue("@correo", txtCorreo.Text);

                sql.ExecuteNonQuery();

                MessageBox.Show("CONFIGURACION REALIZADA CON EXITO!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("NO SE PUDO REALIZAR LA CONFIGURACION!");
            }
            txtCodigo.Clear();

            txtNombre.Clear();
            txtApellido.Clear();
            txtDireccion.Clear();
            txtTelefono.Clear();
            txtCorreo.Clear();

            txtCodigo.Enabled      = true;
            txtNombre.Enabled      = false;
            txtNombre.BackColor    = Color.FromArgb(22, 56, 59);
            txtApellido.Enabled    = false;
            txtApellido.BackColor  = Color.FromArgb(22, 56, 59);
            txtDireccion.Enabled   = false;
            txtDireccion.BackColor = Color.FromArgb(22, 56, 59);
            txtTelefono.Enabled    = false;
            txtTelefono.BackColor  = Color.FromArgb(22, 56, 59);
            txtCorreo.Enabled      = false;
            txtCorreo.BackColor    = Color.FromArgb(22, 56, 59);
            comboBox9.Enabled      = false;
            comboBox9.BackColor    = Color.FromArgb(22, 56, 59);
        }
コード例 #11
0
ファイル: busquedaVideo.cs プロジェクト: Abner17/RentaVideos
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                MySqlCommand sql = new MySqlCommand(String.Format("pd_BuscarVideoNombre"), ConectarServidor.conexion());
                sql.CommandType = CommandType.StoredProcedure;

                sql.Parameters.AddWithValue("@nombre", tbNombre.Text);
                MySqlDataReader reader = sql.ExecuteReader();

                if (reader.Read() == true)
                {
                    tbCodigo.Clear();
                    lblidVideo.Text     = reader.GetString(0);
                    lblTitulo.Text      = reader.GetString(1);
                    lblDescripcion.Text = reader.GetString(2);
                    lblDuracion.Text    = reader.GetString(10);
                    lblCopias.Text      = reader.GetString(3);
                    lblCategoria.Text   = reader.GetString(4);
                    lblFecha.Text       = reader.GetString(5);
                    lblActor.Text       = reader.GetString(9);
                    lblDirector.Text    = reader.GetString(6);
                    lblPrecio.Text      = reader.GetString(7);
                    lblFormato.Text     = reader.GetString(8);
                }
                else
                {
                    tbCodigo.Clear();
                    lblidVideo.Text     = "";
                    lblTitulo.Text      = "";
                    lblDescripcion.Text = "";
                    lblDuracion.Text    = "";
                    lblCopias.Text      = "";
                    lblCategoria.Text   = "";
                    lblFecha.Text       = "";
                    lblActor.Text       = "";
                    lblDirector.Text    = "";
                    lblPrecio.Text      = "";
                    lblFormato.Text     = "";
                    tbNombre.Clear();
                    MessageBox.Show("El Titulo que busca no se encontro.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #12
0
        public void llenarComboBox()
        {
            try
            {
                MySqlCommand     sql = new MySqlCommand(String.Format("Select * from Director_Video"), ConectarServidor.conexion());
                MySqlDataAdapter da  = new MySqlDataAdapter(sql);
                DataSet          ds  = new DataSet();

                da.Fill(ds);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    cboDirector.Items.Add(ds.Tables[0].Rows[i][0] + " | " + ds.Tables[0].Rows[i][1]);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            try
            {
                MySqlCommand     sql = new MySqlCommand(String.Format("Select * from Formato_Video"), ConectarServidor.conexion());
                MySqlDataAdapter da  = new MySqlDataAdapter(sql);
                DataSet          ds  = new DataSet();

                da.Fill(ds);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    cboFormato.Items.Add(ds.Tables[0].Rows[i][0] + " | " + ds.Tables[0].Rows[i][1]);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            try
            {
                MySqlCommand     sql = new MySqlCommand(String.Format("Select * from Categoria_Video"), ConectarServidor.conexion());
                MySqlDataAdapter da  = new MySqlDataAdapter(sql);
                DataSet          ds  = new DataSet();

                da.Fill(ds);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    cboCategoria.Items.Add(ds.Tables[0].Rows[i][0] + " | " + ds.Tables[0].Rows[i][1]);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            try
            {
                MySqlCommand     sql = new MySqlCommand(String.Format("Select * from ActorPrincipal_Video"), ConectarServidor.conexion());
                MySqlDataAdapter da  = new MySqlDataAdapter(sql);
                DataSet          ds  = new DataSet();

                da.Fill(ds);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    cboActor.Items.Add(ds.Tables[0].Rows[i][0] + " | " + ds.Tables[0].Rows[i][1]);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #13
0
        public static int Agregar(Clientes pCliente)
        {
            int retorno = 0;


            MySqlCommand registroCliente = new MySqlCommand(string.Format("Insert into Cliente (NIT, Nombre_Cliente, Apellido_Cliente, DPI, Direccion,Sexo, Fecha_Nacimiento) values ('{0}','{1}','{2}', '{3}','{4}','{5}','{6}')",
                                                                          pCliente.Nit, pCliente.Nombre, pCliente.Apellido, pCliente.Dpi, pCliente.Direccion, pCliente.Sexo, pCliente.Fecha_Nac), ConectarServidor.conexion());

            MySqlCommand registroTelefonoCliente = new MySqlCommand(string.Format("INSERT INTO `Telefono_Cliente` (`Telefono`, `Descripcion`, `Cliente_NIT`) VALUES  ('{0}','{1}','{2}')",
                                                                                  pCliente.Telefono, pCliente.descripcionTelefono, pCliente.Nit), ConectarServidor.conexion());

            MySqlCommand registroMembresia = new MySqlCommand(string.Format("INSERT INTO `Membresia` (`Fecha_Registro`,`Cliente_NIT`) VALUES  ('{0}','{1}')",
                                                                            pCliente.FechaRegistro, pCliente.Nit), ConectarServidor.conexion());



            retorno = registroCliente.ExecuteNonQuery();
            retorno = registroTelefonoCliente.ExecuteNonQuery();
            retorno = registroMembresia.ExecuteNonQuery();
            return(retorno);
        }
コード例 #14
0
        private void btIngresar_Click(object sender, EventArgs e)
        {
            string codDirector = cboDirector.SelectedItem.ToString();

            codDirector = codDirector.Substring(0, codDirector.IndexOf(" "));
            string codFormato = cboFormato.SelectedItem.ToString();

            codFormato = codFormato.Substring(0, codFormato.IndexOf(" "));
            string codCategoria = cboCategoria.SelectedItem.ToString();

            codCategoria = codCategoria.Substring(0, codCategoria.IndexOf(" "));
            string codActor = cboActor.SelectedItem.ToString();

            codActor = codActor.Substring(0, codActor.IndexOf(" "));
            try
            {
                MySqlCommand sql = new MySqlCommand(String.Format("pd_ModificarVideo"), ConectarServidor.conexion());
                sql.CommandType = CommandType.StoredProcedure;

                sql.Parameters.AddWithValue("@codigo", txtCodigo.Text);
                sql.Parameters.AddWithValue("@tit", txtTitulo.Text);
                sql.Parameters.AddWithValue("@descrip", txtDescripcion.Text);
                sql.Parameters.AddWithValue("@dur", txtDuracion.Text);
                sql.Parameters.AddWithValue("@cop", txtCopias.Text);
                sql.Parameters.AddWithValue("@cat", int.Parse(codCategoria));
                sql.Parameters.AddWithValue("@fecha", txtFecha.Text);
                sql.Parameters.AddWithValue("@actor", int.Parse(codActor));
                sql.Parameters.AddWithValue("@direc", int.Parse(codDirector));
                sql.Parameters.AddWithValue("@costo", txtPrecio);
                sql.Parameters.AddWithValue("@formt", int.Parse(codFormato));

                sql.ExecuteNonQuery();

                MessageBox.Show("CONFIGURACION REALIZADA CON EXITO!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("NO SE PUDO REALIZAR LA CONFIGURACION!");
            }
            this.limpiarDesactivarCasillas();
        }
コード例 #15
0
        private void btBusqueda_Click(object sender, EventArgs e)
        {
            try
            {
                MySqlCommand sql = new MySqlCommand(String.Format("pd_BuscarVideoCodigo"), ConectarServidor.conexion());
                sql.CommandType = CommandType.StoredProcedure;

                sql.Parameters.AddWithValue("@codigo", txtCodigo.Text);
                MySqlDataReader reader = sql.ExecuteReader();

                if (reader.Read() == true)
                {
                    this.activarCasillas();

                    txtTitulo.Text      = reader.GetString(1);
                    txtDuracion.Text    = reader.GetString(10);
                    txtCopias.Text      = reader.GetString(3);
                    txtPrecio.Text      = reader.GetString(7);
                    txtFecha.Text       = reader.GetString(5);
                    cboDirector.Text    = reader.GetString(6);
                    cboFormato.Text     = reader.GetString(8);
                    cboCategoria.Text   = reader.GetString(4);
                    cboActor.Text       = reader.GetString(9);
                    txtDescripcion.Text = reader.GetString(2);
                }
                else
                {
                    txtCodigo.Clear();
                    MessageBox.Show("El Codigo que busca no se encontro.");
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #16
0
        private void button47_Click(object sender, EventArgs e)
        {
            string cod = comboBox9.SelectedItem.ToString();

            cod = cod.Substring(0, cod.IndexOf(" "));
            try
            {
                //nombre del procedimiento
                MySqlCommand sql = new MySqlCommand(String.Format("pd_InsertarEmpleado"), ConectarServidor.conexion());
                sql.CommandType = CommandType.StoredProcedure;

                //nombre de los parametros que recibe el procedimiento
                sql.Parameters.AddWithValue("@nombre", txtNombre.Text);
                sql.Parameters.AddWithValue("@apellido", txtApellido.Text);
                sql.Parameters.AddWithValue("@direccion", txtDireccion.Text);
                sql.Parameters.AddWithValue("@telefono", int.Parse(txtTelefono.Text));
                sql.Parameters.AddWithValue("@puesto", int.Parse(cod));
                sql.Parameters.AddWithValue("@correo", txtEmail.Text);

                sql.ExecuteNonQuery();

                MessageBox.Show("EMPLEADO REGISTRADO CORRECTAMENTE!");
            }catch (Exception ex)
            {
                MessageBox.Show("El EMPLEADO NO SE PUDO REGISTRAR!");
            }
            txtNombre.Clear();
            txtApellido.Clear();
            txtDireccion.Clear();
            txtTelefono.Clear();
            txtEmail.Clear();
        }
コード例 #17
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                MySqlCommand sql = new MySqlCommand(String.Format("pd_EliminarProveedor"), ConectarServidor.conexion());
                sql.CommandType = CommandType.StoredProcedure;

                sql.Parameters.AddWithValue("@codigo", txtCodigo.Text);
                sql.ExecuteNonQuery();

                MessageBox.Show("ELIMINACION REALIZADA CON EXITO!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("NO SE PUDO REALIZAR LA ELIMINACION!");
            }
        }
コード例 #18
0
ファイル: menuPrincipal.cs プロジェクト: Abner17/RentaVideos
        private void button2_Click_1(object sender, EventArgs e)
        {
            DateTime fechaFin = DateTime.Now;
            string   codigo   = "";

            try
            {
                MySqlCommand    sql = new MySqlCommand(String.Format("SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='bitacora'"), ConectarServidor.conexion());
                MySqlDataReader dr  = sql.ExecuteReader();
                if (dr.Read() == true)
                {
                    codigo = dr.GetString(0);
                }
                dr.Close();
                int cod = int.Parse(codigo) - 1;
                Console.WriteLine(fechaFin.ToString());
                Console.WriteLine(cod);
                MySqlCommand sql2 = new MySqlCommand(String.Format("pd_ModificarBitacora"), ConectarServidor.conexion());
                sql2.CommandType = CommandType.StoredProcedure;

                sql2.Parameters.AddWithValue("@cod", cod.ToString());
                sql2.Parameters.AddWithValue("@fechHoraFinSe", fechaFin);

                sql2.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            ConectarServidor.cerrarConexion();
            this.Hide();
            VentanaLogin log = new VentanaLogin();

            log.Show();
        }
コード例 #19
0
        private void btBusqueda_Click(object sender, EventArgs e)
        {
            try
            {
                MySqlCommand sql = new MySqlCommand(String.Format("pd_BuscarProveedorCodigo"), ConectarServidor.conexion());
                sql.CommandType = CommandType.StoredProcedure;

                sql.Parameters.AddWithValue("@id_pro", txtCodigo.Text);
                MySqlDataReader reader = sql.ExecuteReader();

                if (reader.Read() == true)
                {
                    this.activarCasillas();

                    txtNombre.Text    = reader.GetString(1);
                    txtDireccion.Text = reader.GetString(2);
                    txtTelefono.Text  = reader.GetString(3);
                    txtCorreo.Text    = reader.GetString(4);
                }
                else
                {
                    txtCodigo.Clear();
                    MessageBox.Show("El Codigo que busca no se encontro.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #20
0
ファイル: menuPrincipal.cs プロジェクト: Abner17/RentaVideos
        public menuPrincipal(string user)
        {
            InitializeComponent();
            MySqlCommand    sql2   = new MySqlCommand(String.Format("Select * from Usuarios where Nick_Name='" + user + "'"), ConectarServidor.conexion());
            MySqlDataReader reader = sql2.ExecuteReader();

            if (reader.Read() == true)
            {
                btRentar.Enabled          = reader.GetBoolean(4);
                btCotizacion.Enabled      = reader.GetBoolean(5);
                btRegistro.Enabled        = reader.GetBoolean(6);
                btBusqueda.Enabled        = reader.GetBoolean(7);
                btDevoluciones.Enabled    = reader.GetBoolean(8);
                btRegistroUsuario.Enabled = reader.GetBoolean(9);
                btConfiguracion.Enabled   = reader.GetBoolean(10);
                this.user = user;
            }
            reader.Close();
        }
コード例 #21
0
ファイル: busquedaVideo.cs プロジェクト: Abner17/RentaVideos
        public void autoCompletarCodigo()
        {
            try
            {
                MySqlCommand    sql = new MySqlCommand(String.Format("Select idVideo from Videos"), ConectarServidor.conexion());
                MySqlDataReader dr  = sql.ExecuteReader();
                AutoCompleteStringCollection mycollection = new AutoCompleteStringCollection();

                while (dr.Read() == true)
                {
                    Console.WriteLine(dr.GetString(0));
                    mycollection.Add(dr.GetString(0));
                }
                tbCodigo.AutoCompleteCustomSource = mycollection;
                dr.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #22
0
        public void llenarComboBox()
        {
            try
            {
                MySqlCommand     sql = new MySqlCommand(String.Format("Select * from Usuarios"), ConectarServidor.conexion());
                MySqlDataAdapter da  = new MySqlDataAdapter(sql);
                DataSet          ds  = new DataSet();

                da.Fill(ds);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    cboUsuario.Items.Add(ds.Tables[0].Rows[i][0] + " | " + ds.Tables[0].Rows[i][1]);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #23
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                MySqlCommand sql = new MySqlCommand(String.Format("pd_EliminarEmpleado"), ConectarServidor.conexion());
                sql.CommandType = CommandType.StoredProcedure;

                sql.Parameters.AddWithValue("@codigo", txtCodigo.Text);
                sql.ExecuteNonQuery();

                MessageBox.Show("ELIMINACION REALIZADA CON EXITO!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("NO SE PUDO REALIZAR LA ELIMINACION!");
            }

            txtCodigo.Clear();
            txtNombre.Clear();
            txtApellido.Clear();
            txtDireccion.Clear();
            txtTelefono.Clear();
            txtCorreo.Clear();

            txtCodigo.Enabled      = true;
            txtNombre.Enabled      = false;
            txtNombre.BackColor    = Color.FromArgb(22, 56, 59);
            txtApellido.Enabled    = false;
            txtApellido.BackColor  = Color.FromArgb(22, 56, 59);
            txtDireccion.Enabled   = false;
            txtDireccion.BackColor = Color.FromArgb(22, 56, 59);
            txtTelefono.Enabled    = false;
            txtTelefono.BackColor  = Color.FromArgb(22, 56, 59);
            txtCorreo.Enabled      = false;
            txtCorreo.BackColor    = Color.FromArgb(22, 56, 59);
            comboBox9.Enabled      = false;
            comboBox9.BackColor    = Color.FromArgb(22, 56, 59);
        }
コード例 #24
0
        private void registroUsuario_Load(object sender, EventArgs e)
        {
            MySqlCommand     sql = new MySqlCommand(String.Format("Select * from Empleados"), ConectarServidor.conexion());
            MySqlDataAdapter da  = new MySqlDataAdapter(sql);
            DataSet          ds  = new DataSet();

            da.Fill(ds);
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                comboBox1.Items.Add(ds.Tables[0].Rows[i][0] + " | " + ds.Tables[0].Rows[i][1] + " " + ds.Tables[0].Rows[i][2]);
            }
        }
コード例 #25
0
        private void btIngresar_Click(object sender, EventArgs e)
        {
            string fecha = txtFecha.Value.Year + "/" + txtFecha.Value.Month + "/" + txtFecha.Value.Day;

            try
            {
                MySqlCommand sql = new MySqlCommand(String.Format("pd_ModificarCliente"), ConectarServidor.conexion());
                sql.CommandType = CommandType.StoredProcedure;

                sql.Parameters.AddWithValue("@codigo", txtNit.Text);
                sql.Parameters.AddWithValue("@nombre", txtNombre.Text);
                sql.Parameters.AddWithValue("@apellido", txtApellido.Text);
                sql.Parameters.AddWithValue("@dpi", txtDpi.Text);
                sql.Parameters.AddWithValue("@direccion", txtDireccion.Text);
                sql.Parameters.AddWithValue("@sexo", cboSexo.Text);
                sql.Parameters.AddWithValue("@fecha", fecha);
                sql.Parameters.AddWithValue("@telefono", int.Parse(txtTelefono.Text));

                sql.ExecuteNonQuery();

                MessageBox.Show("CONFIGURACION REALIZADA CON EXITO!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("NO SE PUDO REALIZAR LA CONFIGURACION!" + ex.ToString());
            }
            this.limpiarDesactivarCasillas();
        }
コード例 #26
0
ファイル: VentanaLogin.cs プロジェクト: Abner17/RentaVideos
        private void btIngresar_Click(object sender, EventArgs e)
        {
            string user = this.txtUser.Text;
            string pass = this.txtPass.Text;

            try
            {
                MySqlCommand    sql2   = new MySqlCommand(String.Format("Select * from Usuarios where Nick_Name='" + user + "'"), ConectarServidor.conexion());
                MySqlDataReader reader = sql2.ExecuteReader();
                if (reader.Read() == true)
                {
                    if (reader.GetString(2) == GMD5(pass))
                    {
                        this.Hide();
                        menuPrincipal menu = new menuPrincipal(user);
                        menu.Show();
                    }
                    else
                    {
                        MessageBox.Show("La contraseña es incorrecta! Vuelva a intentarlo.");
                    }
                }
                else
                {
                    MessageBox.Show("El Usuario es incorrecto! Vuelva a intentarlo.");
                }
                txtUser.Text = "";
                txtPass.Text = "";
            }catch (Exception ex) {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #27
0
        private void button47_Click(object sender, EventArgs e)
        {
            string cod = comboBox1.SelectedItem.ToString();

            cod = cod.Substring(0, cod.IndexOf(" "));

            MySqlCommand sql = new MySqlCommand(String.Format("pd_InsertarUsuario"), ConectarServidor.conexion());

            sql.CommandType = CommandType.StoredProcedure;

            //nombre de los parametros que recibe el procedimiento
            MySqlCommand    sql2    = new MySqlCommand(String.Format("Select * from Usuarios where Nick_Name='" + txtUser.Text + "'"), ConectarServidor.conexion());
            MySqlDataReader reader  = sql2.ExecuteReader();
            MySqlCommand    sql3    = new MySqlCommand(String.Format("Select * from Usuarios where idUsuarios='" + int.Parse(cod) + "'"), ConectarServidor.conexion());
            MySqlDataReader reader2 = sql3.ExecuteReader();

            if ((reader.Read() == true) || (reader2.Read() == true))
            {
                MessageBox.Show("El Usuario o Empleado ya existe! vuelva a intentarlo.");
                txtUser.Clear();
                txtPassword.Clear();
                cbRenta.Checked           = false;
                cbCotizacion.Checked      = false;
                cbRegistro.Checked        = false;
                cbBusqueda.Checked        = false;
                cbDevoluciones.Checked    = false;
                cbRegUsuario.Checked      = false;
                cbConfiguraciones.Checked = false;
            }
            else
            {
                sql.Parameters.AddWithValue("@usuario", txtUser.Text);
                sql.Parameters.AddWithValue("@pass", GMD5(txtPassword.Text));
                sql.Parameters.AddWithValue("@idEmpleado", int.Parse(cod));

                if (cbRenta.Checked)
                {
                    sql.Parameters.AddWithValue("@rentaVideo", true);
                }
                else
                {
                    sql.Parameters.AddWithValue("@rentaVideo", false);
                }

                if (cbCotizacion.Checked)
                {
                    sql.Parameters.AddWithValue("@cotizacion", true);
                }
                else
                {
                    sql.Parameters.AddWithValue("@cotizacion", false);
                }

                if (cbRegistro.Checked)
                {
                    sql.Parameters.AddWithValue("@registro", true);
                }
                else
                {
                    sql.Parameters.AddWithValue("@registro", false);
                }

                if (cbBusqueda.Checked)
                {
                    sql.Parameters.AddWithValue("@busqueda", true);
                }
                else
                {
                    sql.Parameters.AddWithValue("@busqueda", false);
                }

                if (cbDevoluciones.Checked)
                {
                    sql.Parameters.AddWithValue("@devoluciones", true);
                }
                else
                {
                    sql.Parameters.AddWithValue("@devoluciones", false);
                }

                if (cbRegUsuario.Checked)
                {
                    sql.Parameters.AddWithValue("@registroUsuario", true);
                }
                else
                {
                    sql.Parameters.AddWithValue("@registroUsuario", false);
                }

                if (cbConfiguraciones.Checked)
                {
                    sql.Parameters.AddWithValue("@configuraciones", true);
                }
                else
                {
                    sql.Parameters.AddWithValue("@configuraciones", false);
                }

                sql.ExecuteNonQuery();

                MessageBox.Show("USUARIO CREADO CORRECTAMENTE!");
                txtUser.Clear();
                txtPassword.Clear();
                cbRenta.Checked           = false;
                cbCotizacion.Checked      = false;
                cbRegistro.Checked        = false;
                cbBusqueda.Checked        = false;
                cbDevoluciones.Checked    = false;
                cbRegUsuario.Checked      = false;
                cbConfiguraciones.Checked = false;
            }
        }
コード例 #28
0
ファイル: VentanaLogin.cs プロジェクト: Abner17/RentaVideos
 private void VentanaLogin_Load(object sender, EventArgs e)
 {
     ConectarServidor.conexion();
 }
コード例 #29
0
        public void autoCompletarNombre()
        {
            try
            {
                MySqlCommand    sql = new MySqlCommand(String.Format("Select Nombre_empleado from Empleados"), ConectarServidor.conexion());
                MySqlDataReader dr  = sql.ExecuteReader();
                AutoCompleteStringCollection mycollection = new AutoCompleteStringCollection();

                while (dr.Read() == true)
                {
                    mycollection.Add(dr.GetString(0));
                }
                tbNombre.AutoCompleteCustomSource = mycollection;
                dr.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #30
0
ファイル: VentanaLogin.cs プロジェクト: Abner17/RentaVideos
        private void btIngresar_Click(object sender, EventArgs e)
        {
            string user = this.txtUser.Text;
            string pass = this.txtPass.Text;

            try
            {
                MySqlCommand    sql2   = new MySqlCommand(String.Format("Select * from Usuarios where Nick_Name='" + user + "'"), ConectarServidor.conexion());
                MySqlDataReader reader = sql2.ExecuteReader();
                if (reader.Read() == true)
                {
                    if (reader.GetString(2) == GMD5(pass))
                    {
                        DateTime fechaInicio = DateTime.Now;

                        IPHostEntry host;
                        string      localIP = "";
                        host = Dns.GetHostEntry(Dns.GetHostName());
                        foreach (IPAddress ip in host.AddressList)
                        {
                            if (ip.AddressFamily.ToString() == "InterNetwork")
                            {
                                localIP = ip.ToString();
                                Console.WriteLine(fechaInicio);
                                Console.WriteLine(localIP);
                            }
                        }

                        try
                        {
                            MySqlCommand sql = new MySqlCommand(String.Format("pd_InsertarBitacora"), ConectarServidor.conexion());
                            sql.CommandType = CommandType.StoredProcedure;

                            sql.Parameters.AddWithValue("@userr", user);
                            sql.Parameters.AddWithValue("@fechHoraInicioSe", fechaInicio);
                            sql.Parameters.AddWithValue("@ipp", localIP);

                            sql.ExecuteNonQuery();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                        }

                        this.Hide();
                        menuPrincipal menu = new menuPrincipal(user);
                        menu.Show();
                    }
                    else
                    {
                        MessageBox.Show("La contraseña es incorrecta! Vuelva a intentarlo.");
                    }
                }
                else
                {
                    MessageBox.Show("El Usuario es incorrecto! Vuelva a intentarlo.");
                }
                txtUser.Text = "";
                txtPass.Text = "";
            }catch (Exception ex) {
                MessageBox.Show(ex.ToString());
            }
        }