Exemplo n.º 1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = "";
                if (this.txtEmpresa.Text == string.Empty)
                {
                    MensajeError("Faltan ingresar algunos datos, seran remarcados");
                    erroricono.SetError(txtEmpresa, "Ingrese un nombre");
                }
                else
                {
                    rpta = NExperencia.Insertar(this.txtEmpresa.Text.Trim().ToUpper(), this.txtPuesto.Text.Trim().ToUpper(), this.dtpFechaInicio.Value.Date, this.dtpFechaFin.Value.Date, Convert.ToDecimal(this.txtSalario.Text));
                }

                if (rpta.Equals("OK"))
                {
                    this.MensajeOk("Se inserto de forma correcta el registro");
                }
                else
                {
                    this.MensajeError(rpta);
                }

                this.Limpiar();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }

            Close();
        }
Exemplo n.º 2
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult Opcion;
                Opcion = MessageBox.Show("Realmente quieres eliminar los registros", "Sistema RRHH", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (Opcion == DialogResult.OK)
                {
                    string Codigo;
                    string Rpta = "";

                    foreach (DataGridViewRow row in dataListado.Rows)
                    {
                        if (Convert.ToBoolean(row.Cells[0].Value))
                        {
                            Codigo = Convert.ToString(row.Cells[1].Value);
                            Rpta   = NExperencia.Eliminar(Convert.ToInt32(Codigo));

                            if (Rpta.Equals("OK"))
                            {
                                this.MensajeOk("Se elimino correctamente el registro");
                            }
                            else
                            {
                                this.MensajeError(Rpta);
                            }
                        }
                    }
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Exemplo n.º 3
0
 //Metodo mostrar
 private void Mostrar()
 {
     this.dataListado.DataSource = NExperencia.Mostrar();
     this.OcultarColumnas();
     lblTotal.Text = "Total de registro: " + Convert.ToString(dataListado.Rows.Count);
 }
Exemplo n.º 4
0
 //Metodo BuscarNombre
 private void BuscarNombre()
 {
     this.dataListado.DataSource = NExperencia.BuscarNombre(this.txtBuscar.Text);
     this.OcultarColumnas();
     lblTotal.Text = "Total de registro: " + Convert.ToString(dataListado.Rows.Count);
 }