示例#1
0
        private void btnCrear_Click(object sender, EventArgs e)
        {
            Operacion op = new Operacion();

            if (txtCodCargo.Text == "")
            {
                if (txtNombreCargo.Text != "")
                {
                    op.ConsultasSinResultados("INSERT INTO cargo(nombre_cargo) values('" + txtNombreCargo.Text + "')");
                    MessageBox.Show(txtNombreCargo.Text + " GUARDADO", "DATOS GUARDADOS ", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    MessageBox.Show("FALTA NOMBRE DEL CARGAO", "ENTRE NOMBRE DEL CARGO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtNombreCargo.Focus();
                }
            }
            else if (txtCodCargo.Text != "")
            {
                if (MessageBox.Show("REALMENTE DECEA MODIFICAR ESTE CAMPO ", "UPDATE", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    op.ConsultasSinResultados("UPDATE cargo SET cod_cargo = '" + txtCodCargo.Text + "', nombre_cargo = '" + txtNombreCargo.Text + "' WHERE cod_cargo LIKE '%" + txtCodCargo.Text + "%'");//todo funciona correctamente
                    MessageBox.Show(txtCodCargo.Text + " GUARDADO CORRECTAMENTE", "GUARDADO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            txtCodCargo.Text    = "";
            txtNombreCargo.Text = "";
        }
示例#2
0
 private void btnBorrar_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("REALMENTE DECEA ELIMINAR A " + txtNombreCargo.Text, "ELIMINAR", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Operacion op = new Operacion();
         op.ConsultasSinResultados("DELETE FROM cargo WHERE cod_cargo = '" + txtCodCargo.Text + "'");
         MessageBox.Show("REGISTRO BORRADO");
     }
 }
示例#3
0
 private void btnCrear_Click(object sender, EventArgs e)
 {
     if (validarCampos())
     {
         Operacion op = new Operacion();// INSTANCIA DE LA CLASE OPERACION
         //op.ConsultaConResultado("SELECT cedula INTO EMPLEADOS");
         op.ConsultasSinResultados("INSERT INTO empleados(cedula, nombre, apellido, direccion, sexo, sueldo, fecha_nacimiento, fecha_ingreso, cod_cargo) VALUES('" + txtCedula.Text + "', '" + txtNombre.Text + "', '" + txtApellido.Text + "', '" + txtDireccion.Text + "', '" + cmbSexo.Text + "', '" + txtSalario.Text + "', '" + txtFechaNacimiento.Text + "','" + txtFechaIngreso.Text + "', '" + txtCodigoDelCargo.Text + "')");
         borrar();//para borrar los textbox
         MessageBox.Show("DATOS GUARDADOS");
     }
 }
示例#4
0
 private void btnGuardar_Click(object sender, EventArgs e)// problemas con el update
 {
     if (MessageBox.Show("SEGURO QUE DECEA MODIFICAR ESTE REGISTRO?", "ACTUALIZAR EMPLEADO", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Operacion op = new Operacion();
         // txtCodigo.ReadOnly = false;
         op.ConsultasSinResultados("UPDATE empleados SET cedula = '" + txtCedula.Text + "', nombre = '" + txtNombre.Text + "', apellido = '" + txtApellido.Text + "', direccion = '" + txtDireccion.Text + "' sexo = '" + cmbSexo.Text + "' sueldo = '" + txtSalario.Text + "' fecha_nacimiento = '" + txtFechaNacimiento.Text + "' fecha_ingreso = '" + txtFechaIngreso.Text + "' cod_cargo = '" + txtCodigoDelCargo.Text + "' WHERE cod_empleado LIKE '%" + txtCodigo.ToString() + "%' ");
         // op.ConsultasSinResultados("UPDATE empleados SET (cedula, nombre, apellido, direccion, sexo, sueldo, fecha_nacimiento, fecha_ingreso, cod_cargo) VALUES('" + txtCedula.Text + "', '" + txtNombre.Text + "', '" + txtApellido.Text + "', '" + txtDireccion.Text + "', '" + cmbSexo.Text + "', '" + txtSalario.Text + "', '" + txtFechaNacimiento.Text + "','" + txtFechaIngreso.Text + "', '" + txtCodigoDelCargo.Text + "'WHERE cod_empleado LIKE '%"+ txtCodigo.Text +"%')");
     }
     else
     {
     }
 }
示例#5
0
        private void btnBorrar_Click(object sender, EventArgs e)
        {
            Operacion           op  = new Operacion();
            frmBusquedaEmpleado emp = new frmBusquedaEmpleado();

            if (MessageBox.Show("SEGURO QUE DESEA ELIMINAR ESTE REGISTRO?", "ELIMINAR ", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                op.ConsultasSinResultados("DELETE FROM empleados WHERE cod_empleado = '" + txtCodigo.Text + "'"); //elimina bien
                borrar();                                                                                         // METODO OPARA BORRAR LOS CAMPOS
                MessageBox.Show("REGISTRO BORRADO");
                btnBorrar.Enabled  = false;
                btnGuardar.Enabled = false;
                btnCrear.Enabled   = true;
            }
            else
            {
                //this.Close();
            }
        }
示例#6
0
        private void btnGenerarNomina_Click(object sender, DataGridView e)
        {
            Operacion op = new Operacion();

            DataGridViewRow rellenar     = dgvNomina.Rows[e.NewRowIndex];
            float           sueldo_bruto = 0;

            float Isr               = float.Parse(rellenar.Cells["isr"].Value.ToString());
            float Ss                = float.Parse(rellenar.Cells["ss"].Value.ToString());
            float Otros             = float.Parse(rellenar.Cells["otros"].Value.ToString());
            float Total_deducciones = float.Parse(rellenar.Cells["total_deducciones"].Value.ToString());
            float Sueldo_neto       = float.Parse(rellenar.Cells["sueldo_neto"].Value.ToString());

            sueldo_bruto = float.Parse(rellenar.Cells["sueldo"].Value.ToString());

            float total_nomina = +sueldo_bruto;

            txtTotalNomina.Text = Convert.ToString(total_nomina);


            op.ConsultasSinResultados("insert into detalle_nomina(isr, ss, otros, total_deducciones, sueldo_neto, total_nomina, num_nomina) values('" + Isr + "', '" + Ss + "', '" + Otros + "', '" + Total_deducciones + "', '" + Sueldo_neto + "', '" + txtTotalNomina.Text + "', '" + txtNumeroNomina.Text + "')");
        }