private void btnGuardar_Click(object sender, EventArgs e) { try { string rpta = ""; if (this.txtCedula.Text == string.Empty) { MensajeError("Faltan ingresar algunos datos, seran remarcados"); erroricono.SetError(txtCedula, "Ingrese un valor"); erroricono.SetError(txtNombre, "Ingrese un valor"); erroricono.SetError(txtApellido, "Ingrese un valor"); erroricono.SetError(txtSalario, "Ingrese un valor"); } else if (validarCampos() == 0 && validarCedula(txtCedula.Text) == 0) { System.IO.MemoryStream ms = new System.IO.MemoryStream(); this.pbImagen.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png); byte[] image = ms.GetBuffer(); if (this.IsNuevo) { rpta = NCandidatos.Insertar(this.txtCedula.Text.Trim(), this.txtNombre.Text.Trim().ToUpper(), this.txtApellido.Text.Trim().ToUpper(), Convert.ToDecimal(this.txtSalario.Text), image, this.txtRecomendado.Text.Trim().ToUpper(), Convert.ToInt32(this.txtIdIdioma.Text), Convert.ToInt32(this.txtIdCompetencias.Text), Convert.ToInt32(this.txtIdExperiencia.Text), Convert.ToInt32(this.cmbPuestos.SelectedValue), Convert.ToInt32(this.txtIdCapacitaciones.Text)); } else { rpta = NCandidatos.Editar(Convert.ToInt32(this.txtIdCandidatos.Text), this.txtCedula.Text.Trim(), this.txtNombre.Text.Trim().ToUpper(), this.txtApellido.Text.Trim().ToUpper(), Convert.ToDecimal(this.txtSalario.Text), image, this.txtRecomendado.Text.Trim().ToUpper(), Convert.ToInt32(this.txtIdIdioma.Text), Convert.ToInt32(this.txtIdCompetencias.Text), Convert.ToInt32(this.txtIdExperiencia.Text), Convert.ToInt32(this.cmbPuestos.SelectedValue), Convert.ToInt32(this.txtIdCapacitaciones.Text)); } if (rpta.Equals("OK")) { if (this.IsNuevo) { this.MensajeOk("Se inserto de forma correcta el registro"); } else { this.MensajeOk("Se actualizo de forma correcta el registro"); } } else { this.MensajeError(rpta); } this.IsNuevo = false; this.IsEditar = false; this.Botones(); this.Limpiar(); this.Mostrar(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }