Ejemplo n.º 1
0
        private void InsertarEmpleado_Click(object sender, EventArgs e)
        {
            try
            {
                string Nombre      = this.nombretxt.Text;
                string Apellido    = this.apellidotxt.Text;
                int    idEmpresa   = (int)this.empresaCombo.SelectedValue;
                int    idCategoria = (int)this.categoriaCombo.SelectedValue;
                long   Cuil;
                if (!long.TryParse(this.cuilTxt.Text, out Cuil))
                {
                    throw new ArgumentException("El cuil debe ser numerico");
                }
                DateTime FechaNacimiento = this.fechanacPicker.Value;

                _empleadoServicio.InsertarEmpleado(idEmpresa, idCategoria, Cuil, FechaNacimiento, Nombre, Apellido);
                MessageBox.Show("El empleado fue ingresado exitosamente");
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex2)
            {
                MessageBox.Show("Error del servidor");
            }
        }