public int AgregarCertificaciones(CertificacionesE pCertificaciones, int id, ref string oerro) { int resultado = 0; using (SqlConnection _conn = CommonDb.ObtenerConnSql()) { if (!(_conn == null)) { SqlCommand comando = new SqlCommand(); comando.Connection = _conn; comando.CommandType = System.Data.CommandType.StoredProcedure; comando.CommandText = "SP_insertar_CertificacionesConId"; comando.Parameters.AddWithValue("@id",id); comando.Parameters.AddWithValue("@id_certificaciones", pCertificaciones.id_candidato); comando.Parameters.AddWithValue("@nombre", pCertificaciones.nombre); comando.Parameters.AddWithValue("@insititucion", pCertificaciones.institucion); comando.Parameters.AddWithValue("@anio", pCertificaciones.anio); resultado = (int)comando.ExecuteScalar(); } else resultado = 0; oerro = ""; } return resultado; }
public int ActualizarCertificacionesLAB(CertificacionesE certifi, int id, ref string oerro) { try { return _certificacionesDAL.ActualizarCertificaciones(certifi, id, ref oerro); } catch (Exception) { oerro = "ocurrio un error al ingresar sus datos"; throw; } }
public int GuardarCertificacionesLAB(CertificacionesE pCertificaciones, ref string oerro) { try { return _certificacionesDAL.GuardarCertificaciones(pCertificaciones, ref oerro); } catch (Exception) { oerro = "ocurrio un error al ingresar sus datos"; throw; } }
//***************************************************************************************** public void agregarCertificacion() { string nombre, institutucion; int anio; nombre = txt_TitutloCertificacion.Text; institutucion = txt_InstCertiicacion.Text; anio = Convert.ToInt32(cb_añoFinCertificacion.Text); //Procedimiento para agregar Certificacion a la base CertificacionesE certifi = new CertificacionesE(); int returnCertificaciones = 0; certifi.nombre = nombre; certifi.institucion = institutucion; certifi.anio = anio; bool agregar = true; foreach (DataRowView dr in DataGrid_Certificaciones.Items) { if ((dr.Row.ItemArray[1].ToString().ToLower()) == nombre.ToLower() && dr.Row.ItemArray[2].ToString().ToLower() == institutucion.ToLower() && dr.Row.ItemArray[3].ToString().ToLower() == anio.ToString().ToLower()) { agregar = false; } } if (agregar) { returnCertificaciones = _certificanesBL.AgregarCertificacionesLAB(certifi, int.Parse(idCandidato), ref oerro); tablaCerti.Rows.Add(returnCertificaciones, nombre, institutucion, anio); } else { MessageBox.Show("Esa informacion ya ha sido ingresada, por favor revisar los datos."); agregar = true; } //***************************************************** cb_añofinalizacionedu.SelectedIndex = -1; txt_InstCertiicacion.Text = string.Empty; txt_TitutloCertificacion.Text = string.Empty; }
private void btn_agragarcertificaciones_Click(object sender, RoutedEventArgs e) { if (!(string.IsNullOrEmpty(txt_TitutloCertificacion.Text) | string.IsNullOrEmpty(txt_InstCertiicacion.Text) | cb_añoFinCertificacion.SelectedIndex == -1)) { if (nuevoCerti == false) { tablaCerti.Rows.Remove(RowPivotInfoAca); RowPivotInfoAca = null; string nombre, institutucion; int anio; nombre = txt_TitutloCertificacion.Text; institutucion = txt_InstCertiicacion.Text; anio = Convert.ToInt32(cb_añoFinCertificacion.Text); CertificacionesE certiObj = new CertificacionesE(); certiObj.id_candidato = (int.Parse(idCandidato)); certiObj.id_certificaciones = int.Parse(idUpdateCertifi); certiObj.institucion = institutucion; certiObj.nombre = nombre; certiObj.anio = anio; bool agregar = true; foreach (DataRowView dr in DataGrid_Certificaciones.Items) { if ((dr.Row.ItemArray[1].ToString().ToLower()) == nombre.ToLower() && dr.Row.ItemArray[2].ToString().ToLower() == institutucion.ToLower() && dr.Row.ItemArray[3].ToString().ToLower() == anio.ToString().ToLower()) { agregar = false; } } if (agregar) { tablaCerti.Rows.Remove(RowPivotInfoAca); RowPivotInfoAca = null; CertificacionesBLL certiBll = new CertificacionesBLL(); certiBll.ActualizarCertificacionesLAB(certiObj, certiObj.id_candidato, ref oerro); tablaCerti.Rows.Add(certiObj.id_certificaciones, nombre, institutucion, anio); } else { MessageBox.Show("Esa informacion ya ha sido ingresada, por favor revisar los datos."); agregar = true; } txt_TitutloCertificacion.Text = string.Empty; txt_InstCertiicacion.Text = string.Empty; cb_añoFinCertificacion.SelectedIndex = 0; nuevoCerti = true; } else { //falta metodo agregar certificacion agregarCertificacion(); } } else { MessageBox.Show("Inserte todos los datos solicitados"); } }
private void btn_Certificaciones_Click(object sender, RoutedEventArgs e) { // VARAIABLE DE MESAJE PARA GUARDAR CERTIFCACIONES int returVariable = 0; //BOTON PARA GUARDAR CERTIFICACIONES EN LA BASE (METODOS) string oerror = ""; CertificacionesE certifi = new CertificacionesE(); foreach (DataRowView row in DataGrid_Certificaciones.Items) { certifi.nombre = Convert.ToString(row[0]); certifi.institucion = Convert.ToString(row[1]); certifi.anio = Convert.ToInt16(row[2]); returVariable = _certificanesBL.GuardarCertificacionesLAB(certifi, ref oerror); } if (returVariable > 0) { MessageBox.Show("Registro fue guardado con exito..", "Informacion", MessageBoxButton.OK, MessageBoxImage.Information); tcPrincipal.SelectedIndex = 5; tab5.IsEnabled = false; } }
//***BOTON PARA GUARDAR TODA LA INFORMACION DE UN NUEVO PERFIL***/// private void GuardarTodo_Click(object sender, RoutedEventArgs e) { //VARIABLE DE MENSAJE AL GUARDAR INFORMACION ACADEMICA int returVariable3 = 0; int variable1 = 2; int variable2 = 0; if (variable1 != returVariable3 && variable2 != returVariable3) { } else if (variable1 != returVariable3 || variable2 != returVariable3) { } string cadenaFaltanDatos = ""; ///////////////////////////////***FIN DEL IF*** ////////////////////////////// //VALIDA LOS CAMPOS OBLIGATORIOS DEL TAB 1 if (string.IsNullOrEmpty(txtNombreInfBasica.Text) || string.IsNullOrEmpty(DateFechNacInfoBasica.Text) || string.IsNullOrEmpty(txtNombreInfBasica.Text) || (string.IsNullOrEmpty(cbDeptos.Text)) || (string.IsNullOrEmpty(cbMunic.Text)) || (string.IsNullOrEmpty(cb_profesionesIB.Text)) || (string.IsNullOrEmpty(cbSitLab.Text)) || (string.IsNullOrEmpty(txtTeNocelularInfBasica.Text)) || (string.IsNullOrEmpty(txtCorreoInfBasica.Text)) || (string.IsNullOrEmpty(txtNoduiInfBasica.Text)) || (string.IsNullOrEmpty(txtNnitInfBasica.Text)) ) { MessageBox.Show("Este fomulario tiene campos obligatorios '*' ", "Informacion", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (DateTime.Compare(DateTime.Now.Date, DateFechNacInfoBasica.SelectedDate.Value.Date) > 0) { //SE VALIDAN QUE LOS DEMAS GRID CONTENGAN DATOS, SE RECOMIENDA AGREGAR AQUELLOS GRID QUE CONSIDEREN SEAN NECESARIOS. if (DataG_Habilidades.Items.Count == 0 || DataGrid_InfAcademica.Items.Count == 0) { cadenaFaltanDatos = ", YA QUE NO A INGRESADO TODA LA INFORMACION NECESARIA."; MessageBox.Show("Ingrese informacion acdemica y habilidades ya que son formularios requeridos", "Infomacion", MessageBoxButton.OK, MessageBoxImage.Information); } else { //PARAMETROS QUE INGRESARAN A LA BASE TAB INFOMACION BASICA InfoBasicaE _InfoBasicaE = new InfoBasicaE(); DateTime edad = DateFechNacInfoBasica.SelectedDate.Value; _InfoBasicaE.nombre = txtNombreInfBasica.Text.ToUpper(); _InfoBasicaE.nacionalidad = txtNacionalidadInfBasica.Text.ToUpper(); _InfoBasicaE.telefono_celular = txtTeNocelularInfBasica.Text.ToUpper(); _InfoBasicaE.telefono_fijo = txtTelefonoCasaInfBasica.Text.ToUpper(); //_InfoBasicaE.profesiones = cb_profesionesIB.Text.ToUpper(); _InfoBasicaE.id_profesiones = Convert.ToInt32(cb_profesionesIB.SelectedValue); _InfoBasicaE.correo = txtCorreoInfBasica.Text; _InfoBasicaE.fecha_nacimiento = DateFechNacInfoBasica.SelectedDate.Value; _InfoBasicaE.direccion = txtLugarResidenciaInfBasica.Text.ToUpper(); //_Imagen = ControlImagen.ObtenerImagenEnObjecto(_Imagen.RutaImagen); _InfoBasicaE.FotoCandidato = _Imagen.OnlyName; if (rbsexoM.IsChecked == true) { _InfoBasicaE.id_genero = 1; } else if (rbsexoF.IsChecked == true) { _InfoBasicaE.id_genero = 2; } _InfoBasicaE.DUI = txtNoduiInfBasica.Text; _InfoBasicaE.NIT = txtNnitInfBasica.Text; _InfoBasicaE.AFP = txtNafpInfBasica.Text; _InfoBasicaE.ISSS = txtNiss.Text; _InfoBasicaE.id_municipio = Convert.ToInt32(cbMunic.SelectedValue); _InfoBasicaE.id_situacionProfesional = Convert.ToInt32(cbSitLab.SelectedValue); string oerro = ""; int returinfobasica = 0; returinfobasica = _InfobasicaBL.GudarInfBasica(_InfoBasicaE, ref oerro); // BOTON PARA GUARDAR INFORMACION ACADEMICA (EVENTO) InformacionAcademicaE refinfoAcademica = new InformacionAcademicaE(); int returinfoacademica = 0; foreach (DataRowView row in DataGrid_InfAcademica.Items) { refinfoAcademica.id_tipoEducacion = Convert.ToInt32(row[0]); refinfoAcademica.titulo = Convert.ToString(row[2]); refinfoAcademica.institucion = Convert.ToString(row[3]); refinfoAcademica.anio_de_finalizacion = Convert.ToInt32(row[4]); refinfoAcademica.id_statusAcademico = Convert.ToInt32(row[6]); returinfoacademica = _informacionAcademicaBL.GuardarInfomacionAcademica(refinfoAcademica, ref oerro); } //BOTON PARA GUARDAR INFORMACION LABORAL ExpLaboralE refExpL = new ExpLaboralE(); int returinfoLaboral = 0; foreach (DataRowView row1 in DataGrid_Inf_Laboral.Items) { refExpL.nombreEmpresa = Convert.ToString(row1[0]); refExpL.cargoDesp = Convert.ToString(row1[1]); refExpL.descripPuesto = Convert.ToString(row1[2]); refExpL.fechaInicio = Convert.ToString(row1[3]); refExpL.fechaFin = Convert.ToString(row1[4]); returinfoLaboral = _experienciaLabBL.GuardarexperienciaLab(refExpL, ref oerro); } // BOTON PARA GUARDARRR LOS DATOS HABILIDADES (METODOS) HabCandidatoE refHabCandidato = new HabCandidatoE(); int returnHabilidades = 0; foreach (DataRowView row3 in DataG_Habilidades.Items) { refHabCandidato.idhabilidadTecnica = Convert.ToInt32(row3[0]); refHabCandidato.id_nivel = Convert.ToInt32(row3[2]); refHabCandidato.id_habilidadAplicacion = Convert.ToInt32(row3[4]); returnHabilidades = _habilidadCandidatoBL.GuardarHabilidadCandidato(refHabCandidato, ref oerro); } //BOTON PARA GUARDAR CERTIFICACIONES EN LA BASE (METODOS) CertificacionesE certifi = new CertificacionesE(); int returnCertificaciones = 0; foreach (DataRowView row2 in DataGrid_Certificaciones.Items) { certifi.nombre = Convert.ToString(row2[0]); certifi.institucion = Convert.ToString(row2[1]); certifi.anio = Convert.ToInt16(row2[2]); returnCertificaciones = _certificanesBL.GuardarCertificacionesLAB(certifi, ref oerro); } //BOTON PARA INGRESAR REFERENCIAS A RefecenciasE refE = new RefecenciasE(); int returReferencias = 0; foreach (DataRowView row5 in DataGrid_Referencias.Items) { refE.id_tipoReferencias = Convert.ToInt32(row5[0]); refE.nombre = Convert.ToString(row5[2]); refE.telefono = Convert.ToString(row5[3]); refE.descripcion = Convert.ToString(row5[4]); returReferencias = _referenciasBL.GuardarReferencias(refE, ref oerro); } if (oerro == "") { #region Capturar imgen por genero string pMensaje = "", pURL = ""; switch (_InfoBasicaE.id_genero) { case 1: pMensaje = "candidato"; pURL = string.IsNullOrEmpty(_Imagen.RutaImagen) ? @"C:\Imagenes\Fotos\User_default\Userman.png" : _Imagen.RutaImagen; break; case 2: pMensaje = "candidata"; pURL = string.IsNullOrEmpty(_Imagen.RutaImagen) ? @"C:\Imagenes\Fotos\User_default\userwoman.png" : _Imagen.RutaImagen; break; } #endregion if (Elijiomagen) ControlImagen.GuardarImagenEnRuta(_Imagen); #region Mostrar mensaje personalizado SimpleAlert simpleAlert = new SimpleAlert(); simpleAlert.Title = "Nuevo Registro"; simpleAlert.NamePeople = txtNombreInfBasica.Text; simpleAlert.Url = pURL; simpleAlert.Message = "Se ha creado el nuevo " + pMensaje; simpleAlert.ShowDialog(); #region Redireccionamiento Busqueda _menusBusqueda = new Busqueda(); _menusBusqueda.InitializeComponent(); this.Close(); _menusBusqueda.Show(); #endregion #endregion } else { MessageBoxResult mbr = MessageBox.Show("OCURRIO UN ERROR AL GUARDAR SUS DATOS... ERROR: " + oerro, "Infomacion", MessageBoxButton.OK, MessageBoxImage.Information); } } } else { MessageBox.Show("La fecha de nacimiento debe ser menor a la fecha actual.","Error", MessageBoxButton.OK, MessageBoxImage.Information); } } }