Exemple #1
0
 private void Lista_empleados_Load(object sender, EventArgs e)
 {    //ver lista de los empleados
     try
     {
         operacion oper = new operacion();
         DataSet   ds   = oper.ConsultaConResultado(" select empleado.id, empleado.nombre, empleado.apellido, empleado.telefono, empleado.cedula, cargo.departamento from empleado,cargo where empleado.id = cargo.id; ");
         dataGridView1.DataSource = ds.Tables[0];
     }
     catch
     {
     }
 }
Exemple #2
0
 private void Nomina_Load(object sender, EventArgs e)
 //vista detalles nomina
 {
     try
     {
         operacion oper = new operacion();
         DataSet   ds   = oper.ConsultaConResultado(" select empleado.id, empleado.nombre, empleado.apellido, empleado.cedula, sueldo, (sueldo * ss) as 'descuento ss', (sueldo * isr) as 'descuento isr', (sueldo * .19) as 'descuento total', sueldo - (sueldo * .19) as 'sueldo neto' from empleado,detalle_nomina where empleado.id = detalle_nomina.id; ");
         dataGridView1.DataSource = ds.Tables[0];
     }
     catch
     {
     }
 }
Exemple #3
0
        private void buscar(string id)
        {
            try
            {
                //connectar a la base de datos para poder encontrar la informacion via el "id"
                operacion oper = new operacion();
                DataSet   ds   = oper.ConsultaConResultado("SELECT * FROM empleado WHERE id='" + txtid.Text + "' ");
                foreach (DataRow fila in ds.Tables[0].Rows)

                {
                    if (fila["id"] != null)
                    {
                        txtid.Text = fila["id"].ToString();
                    }
                    if (fila["nombre"] != null)
                    {
                        txtnombre.Text = fila["nombre"].ToString();
                    }
                    if (fila["apellido"] != null)
                    {
                        txtapellido.Text = fila["apellido"].ToString();
                    }
                    if (fila["telefono"] != null)
                    {
                        txttelefono.Text = fila["telefono"].ToString();
                    }
                    if (fila["cedula"] != null)
                    {
                        txtcedula.Text = fila["cedula"].ToString();
                    }
                }
                operacion dep = new operacion();
                DataSet   dt  = dep.ConsultaConResultado("SELECT departamento FROM cargo WHERE id='" + txtid.Text + "' ");
                foreach (DataRow fila in dt.Tables[0].Rows)
                {
                    if (fila["departamento"] != null)
                    {
                        txtdepartamento.Text = fila["departamento"].ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                MessageBox.Show("Has encontrado la información :D ");
            }
        }
Exemple #4
0
        private void Cargo_Load(object sender, EventArgs e)
        {
            //tabla de cargo

            try
            {
                operacion oper = new operacion();
                DataSet   ds   = oper.ConsultaConResultado(" select empleado.id, empleado.nombre, empleado.apellido, empleado.estatus, cargo.departamento from empleado,cargo where empleado.id = cargo.id; ");
                dataGridView1.DataSource = ds.Tables[0];
                dataGridView1.Refresh();
            }
            catch
            {
            }
        }
Exemple #5
0
 private void btnactualizar_Click(object sender, EventArgs e)
 {
     try
     {
         operacion oper = new operacion();
         oper.ConsultaSinResultado(" UPDATE cargo SET departamento='" + cmbdepartamento.Text.ToString() + "' WHERE id= '" + txtidcargo.Text + "' ");
         operacion display = new operacion();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         MessageBox.Show("Se actualizo correctamente");
     }
 }
Exemple #6
0
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                operacion oper = new operacion();
                oper.ConsultaSinResultado(" DELETE FROM empleado WHERE id='" + txtid.Text + "' ");
            }
            catch (Exception ex)

            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                MessageBox.Show("El contenido a sido eliminado");
            }
        }
Exemple #7
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     //Botón de actualizar
     try
     {
         operacion oper = new operacion();
         oper.ConsultaSinResultado(" UPDATE empleado SET nombre='" + txtnombre.Text.ToString() + "', apellido='" + txtapellido.Text.ToString() + "', cedula= '" + txtcedula.Text.ToString() + "', telefono='" + txttelefono.Text.ToString() + "' WHERE id= '" + txtid.Text + "' ");
         operacion dep = new operacion();
         dep.ConsultaSinResultado(" UPDATE cargo SET departamento='" + txtdepartamento.Text.ToString() + "' WHERE id= '" + txtid.Text + "' ");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         MessageBox.Show("Se ha actualizado correctamente");
     }
 }
Exemple #8
0
 private void btnimprimir_Click(object sender, EventArgs e)
 {
     // Exportando la data a formato XML
     try
     {
         operacion oper = new operacion();
         DataSet   ds   = oper.ConsultaConResultado(" select empleado.id, empleado.nombre, empleado.apellido, empleado.telefono, empleado.cedula, cargo.departamento from empleado,cargo where empleado.id = cargo.id;");
         ds.WriteXml("c:\\Sistemas\\listaempleados.xml");
         reportviewer f = new reportviewer("reportempleado.rpt");
         f.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         MessageBox.Show("Se cargó correctamente ");
     }
 }
Exemple #9
0
        private void btnimprimir_Click(object sender, EventArgs e)
        {
            // Exportando la data a formato XML
            try
            {
                operacion oper = new operacion();
                DataSet   dt   = oper.ConsultaConResultado(" select empleado.id, empleado.nombre, empleado.apellido, empleado.cedula, sueldo, (sueldo * ss) as 'descuento ss', (sueldo * isr) as 'descuento isr', (sueldo * .19) as 'descuento total', sueldo - (sueldo * .19) as 'sueldo neto' from empleado,detalle_nomina where empleado.id = detalle_nomina.id;");
                dt.WriteXml("c:\\Sistemas\\todonomina.xml");
                reportnom f = new reportnom("reportenomina.rpt"); //("C:\\Users\\santo\\Documents\\Visual Studio 2017\\Projects\\GalvinSantosCRUDtarea3\\GalvinSantosCRUDtarea3\\reportenomina.rpt");
                f.Show();
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                MessageBox.Show("Se cargó correctamente :D");
            }
        }
Exemple #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Botón de crear
            try
            {
                operacion oper = new operacion();
                oper.ConsultaSinResultado(" INSERT INTO empleado (nombre, apellido, telefono, cedula) VALUES ('" + txtnombre.Text.ToString() + "','" + txtapellido.Text.ToString() + "','" + txttelefono.Text.ToString() + "','" + txtcedula.Text.ToString() + "')");
                operacion dep = new operacion();
                dep.ConsultaSinResultado(" INSERT INTO cargo (departamento) VALUES ('" + txtdepartamento.Text.ToString() + "')");
            }
            catch (Exception ex)

            {
                MessageBox.Show(ex.Message);
            }

            finally
            {
                MessageBox.Show(" La información fue insertada correctamente ");
            }
        }
Exemple #11
0
 private void buscar(string id)
 {
     //busqueda de cargo
     try
     {
         operacion oper = new operacion();
         DataSet   ds   = oper.ConsultaConResultado("SELECT * FROM cargo WHERE id='" + txtidcargo.Text + "' ");
         foreach (DataRow fila in ds.Tables[0].Rows)
         {
             if (fila["id"] != null)
             {
                 txtidcargo.Text = fila["id"].ToString();
             }
             if (fila["departamento"] != null)
             {
                 cmbdepartamento.Text = fila["departamento"].ToString();
             }
         }
     }
     catch
     {
     }
 }
Exemple #12
0
        private void btnimprimir_Click(object sender, EventArgs e)
        {
            try
            {
                operacion oper      = new operacion();
                string    seleccion = txtid.Text.ToString();
                {
                    DataSet ds = oper.ConsultaConResultado(" SELECT * FROM empleado WHERE id='" + txtid.Text + "' ");
                    foreach (DataRow fila in ds.Tables[0].Rows)
                    {
                        if (fila["id"] != null)
                        {
                            txtid.Text = fila["id"].ToString();
                        }
                        if (fila["nombre"] != null)
                        {
                            txtnombre.Text = fila["nombre"].ToString();
                        }
                        if (fila["apellido"] != null)
                        {
                            txtapellido.Text = fila["apellido"].ToString();
                        }
                        if (fila["telefono"] != null)
                        {
                            txttelefono.Text = fila["telefono"].ToString();
                        }
                        if (fila["cedula"] != null)
                        {
                            txtcedula.Text = fila["cedula"].ToString();
                        }
                    }
                    operacion dep = new operacion();
                    DataSet   dt  = dep.ConsultaConResultado("SELECT departamento FROM cargo WHERE id='" + txtid.Text + "' ");
                    foreach (DataRow fila in dt.Tables[0].Rows)
                    {
                        if (fila["departamento"] != null)
                        {
                            txtdepartamento.Text = fila["departamento"].ToString();
                        }
                    }

                    ds.WriteXml("c:\\Sistemas\\empleado.xml");
                    fotoempleado f = new fotoempleado("empleadofoto.rpt");
                    f.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Debe buscar un empleado!");
            }


            /* try
             * {
             *   string seleccion = cbTipoBusqueda.SelectedItem.ToString();
             *   operacion oper = new operacion();
             *   SQLiteConnection cnx = new SQLiteConnection("Data Source=C:\\BDSistema\\BD_Cia.del_Caribe.db;Version=3;");
             *   cnx.Open();
             *   if (seleccion == "Nmero Empleado")
             *
             *       //connectar a la base de datos para poder encontrar la informacion via el "id"
             *
             *   operacion oper = new operacion();
             *   DataSet ds = oper.ConsultaConResultado("SELECT * FROM empleado WHERE id='" + txtid.Text + "' ");
             *   foreach (DataRow fila in ds.Tables[0].Rows)
             *
             *   {
             *
             *       if (fila["id"] != null) txtid.Text = fila["id"].ToString();
             *       if (fila["nombre"] != null) txtnombre.Text = fila["nombre"].ToString();
             *       if (fila["apellido"] != null) txtapellido.Text = fila["apellido"].ToString();
             *       if (fila["telefono"] != null) txttelefono.Text = fila["telefono"].ToString();
             *       if (fila["cedula"] != null) txtcedula.Text = fila["cedula"].ToString();
             *   }
             *   operacion dep = new operacion();
             *   DataSet dt = dep.ConsultaConResultado("SELECT departamento FROM cargo WHERE id='" + txtid.Text + "' ");
             *   foreach (DataRow fila in dt.Tables[0].Rows)
             *   {
             *       if (fila["departamento"] != null) txtdepartamento.Text = fila["departamento"].ToString();
             *   }
             *   ds.WriteXml("c:\\Sistemas\\tarea5.xml");
             *   fotoempleado f = new fotoempleado("empleadofoto.rpt");
             *   f.Show();
             *
             * }
             * catch (Exception ex)
             * {
             *   MessageBox.Show(ex.Message);
             * }
             * finally
             * {
             *
             *   MessageBox.Show("Se cargó correctamente ");
             * }*/
        }