protected void btnBuscar_Click(object sender, EventArgs e) { try { Talento tal = new Talento(); DataSet ds = new DataSet(); tal._num_dni = Convert.ToInt32(txtDNI.Text); ds = Talento.buscar_Reniec_dni(tal); if (ds.Tables[0].Rows.Count > 0) { txtNomb.Text = (ds.Tables[0].Rows[0][3]).ToString(); txtApell.Text = (ds.Tables[0].Rows[0][1]).ToString() + " " + (ds.Tables[0].Rows[0][2]).ToString(); } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", "alert('DNI no existe en la BD de Reniec')", true); } Session["DNI"] = txtDNI.Text; } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", "alert('Error')", true); } }
public IHttpActionResult GetTalento(int id) { Talento talento = db.Talento.Find(id); if (talento == null) { return(NotFound()); } return(Ok(talento)); }
public JsonResult GetTalento([FromBody] Talento objeto) { using (var bd = new bd_talentosContext()) { try { dynamic talento = bd.Talento.Find(objeto.IdTalento); return(Json(talento)); } catch (Exception ex) { throw ex; } } }
public JsonResult IncluirTalento([FromBody] Talento objeto) { try { var bd = new bd_talentosContext(); bd.Talento.Add(objeto); bd.SaveChanges(); dynamic obj = new bd_talentosContext().Talento.ToList(); return(Json(obj)); } catch (Exception ex) { throw ex; } }
public JsonResult GetInfoBancaria([FromBody] Talento objeto) { using (var bd = new bd_talentosContext()) { try { dynamic list = bd.InfoBancaria.Where(l => l.IdTalento == objeto.IdTalento).ToList(); return(Json(list)); } catch (Exception ex) { throw ex; } } }
public JsonResult ExcluirTalento([FromBody] Talento objeto) { using (var bd = new bd_talentosContext()) { try { dynamic _item = bd.Talento.Find(objeto.IdTalento); bd.Talento.Remove(_item); bd.SaveChanges(); dynamic obj = bd.Talento.ToList(); return(Json(obj)); } catch (Exception ex) { throw ex; } } }
public IHttpActionResult PutTalento(int id, Talento talento) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != talento.IdTalento) { return(BadRequest()); } if (talento.ConhecimentosTalento != null) { foreach (var c in talento.ConhecimentosTalento) { db.Entry(c).State = EntityState.Modified; } } db.Entry(talento).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TalentoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult DeleteTalento(int id) { Talento talento = (from t in db.Talento.Include(c => c.ConhecimentosTalento) where t.IdTalento.Equals(id) select t).FirstOrDefault(); if (talento == null) { return(NotFound()); } if (talento.ConhecimentosTalento != null) { db.Conhecimento.RemoveRange(talento.ConhecimentosTalento); db.SaveChanges(); } db.Talento.Remove(talento); db.SaveChanges(); return(Ok(talento)); }
protected void btnHabilitar_Click(object sender, EventArgs e) { try { Talento tal = new Talento(); tal._num_dni = Convert.ToInt32(txtDNI.Text); Talento.habilitar_Talento(tal); limpiar_talento(); limpiar_experiencia(); gdvExp.DataSource = null; gdvExp.DataBind(); ddlDNI_SelectedIndexChanged(null, null); } catch (Exception ex) { } }
public IHttpActionResult PostTalento([FromBody] JObject talento) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Talento t = new Talento(); t = talento.ToObject <Talento>(); if (t.ConhecimentosTalento != null) { foreach (Conhecimento c in t.ConhecimentosTalento) { db.Conhecimento.Add(c); } db.SaveChanges(); } db.Talento.Add(t); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = t.IdTalento }, t)); }
protected void btnEliminar_Click(object sender, EventArgs e) { try { Talento tal = new Talento(); tal._num_dni = Convert.ToInt32(txtDNI.Text); Talento.eliminar_Talento(tal); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", "alert('Se eliminó el Talento correctamente')", true); limpiar_talento(); limpiar_experiencia(); gdvExp.DataSource = null; gdvExp.DataBind(); ddlDNI_SelectedIndexChanged(null, null); } catch (Exception ex) { } }
public void ExcluirTalento(Talento entidadeExcluida) { talentoNegocio.Excluir <Talento>(entidadeExcluida); }
public void AtualizarTalento(Talento entidadeModificada) { talentoNegocio.Atualizar <Talento>(entidadeModificada); }
public void InserirTalento(Talento entidadeNova) { talentoNegocio.Inserir <Talento>(entidadeNova); }
public Talento Save(Talento model) { throw new NotImplementedException(); }
protected void btnGrabar_Click(object sender, EventArgs e) { try { Talento tal = new Talento(); Experiencia exp = new Experiencia(); tal._nombres = txtNomb.Text; tal._apellidos = txtApell.Text; tal._num_dni = Convert.ToInt32(txtDNI.Text); tal._fecha_nac = Convert.ToDateTime(txtFechanac.Text); tal._lugar_nac = dlDist.SelectedValue; if (rbtnMale.Checked) { tal._sexo = rbtnMale.Text; } else { tal._sexo = rbtnFemale.Text; } tal._estado_civil = Convert.ToInt16(dlEstCivil.SelectedValue); tal._residencia = Convert.ToInt16(dlResid.SelectedValue); tal._direccion = txtDir.Text; tal._ubigeo = dlDistRes.SelectedValue; tal._telefono_fijo = Convert.ToInt32(txtFijo.Text); tal._telefono_celular = Convert.ToInt32(txtCell.Text); tal._correo = txtCorreo.Text; if (dlNivel.SelectedItem.ToString() == "Ninguno") { tal._estudio = "00"; if (rbLectura.Checked) { tal._lect_esc = rbLectura.Text; } else { if (rbEscritura.Checked) { tal._lect_esc = rbEscritura.Text; } else { tal._lect_esc = rbAmbos.Text; } } } else { tal._estudio = dlGrado.SelectedValue; tal._lect_esc = ""; } tal._idioma = Convert.ToInt16(dlIdioma.SelectedValue); Talento.insertar_Talento(tal); DataTable dt = Session["datos"] as DataTable; DataSet ds = new DataSet(); Actividad act = new Actividad(); OrgAtendida org = new OrgAtendida(); int codActiv, codOrg; for (int i = 0; i < dt.Rows.Count; i++) { exp._num_dni = Convert.ToInt32(txtDNI.Text); if (dt.Rows[i][0].ToString() == "0") { act._nombre = dt.Rows[i][1].ToString(); ds = Actividad.buscar_Actividad_nombre(act); if (ds.Tables[0].Rows.Count == 0) { Actividad.insertar_Actividad(act); codActiv = Convert.ToInt16((Actividad.buscar_Actividad_nombre(act)).Tables[0].Rows[0][0]); } else { codActiv = Convert.ToInt16(ds.Tables[0].Rows[0][0]); } exp._actividad = codActiv; } else { exp._actividad = Convert.ToInt16(dt.Rows[i][0].ToString()); } exp._duracion = dt.Rows[i][4].ToString(); exp._certificado = dt.Rows[i][7].ToString(); exp._lugar_activ = dt.Rows[i][2].ToString(); if (dt.Rows[i][5].ToString() == "0") { org._nombre = dt.Rows[i][6].ToString(); ds = OrgAtendida.buscar_OrgAtendida_nombre(org); if (ds.Tables[0].Rows.Count == 0) { OrgAtendida.insertar_OrgAtendida(org); codOrg = Convert.ToInt16((OrgAtendida.buscar_OrgAtendida_nombre(org)).Tables[0].Rows[0][0]); } else { codOrg = Convert.ToInt16(ds.Tables[0].Rows[0][0]); } exp._organizacion_atendida = codOrg; } else { exp._organizacion_atendida = Convert.ToInt16(dt.Rows[i][5].ToString()); } exp._referente = dt.Rows[i][8].ToString(); exp._reconocimientos = dt.Rows[i][9].ToString(); Experiencia.insertar_Experiencia(exp); } btnCV_Click(null, null); limpiar_talento(); limpiar_experiencia(); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", "alert('Grabó correctamente')", true); } catch (Exception ex) { //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", "alert('"+ex.Message+"')", true); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", "alert('Este Talento ya existe')", true); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //------------------------------------ dlDep.DataSource = Ubigeo.listar_dept(); dlDep.DataBind(); dlDep_SelectedIndexChanged(null, null); dlProv_SelectedIndexChanged(null, null); //------------------------------------ dlEstCivil.DataSource = Estado_Civil.listar_estcivil(); dlEstCivil.DataBind(); dlResid.DataSource = Residencia.listar_residencia(); dlResid.DataBind(); //------------------------------------ dlDepRes.DataSource = Ubigeo.listar_dept(); dlDepRes.DataBind(); dlDepRes_SelectedIndexChanged(null, null); dlProvRes_SelectedIndexChanged(null, null); //------------------------------------ dlNivel.DataSource = Estudio.listar_nivel(); dlNivel.DataBind(); dlNivel_SelectedIndexChanged(null, null); dlGrado_SelectedIndexChanged(null, null); //------------------------------------ dlIdioma.DataSource = Idioma.listar_idioma(); dlIdioma.DataBind(); //------------------------------------ dlDepAct.DataSource = Ubigeo.listar_dept(); dlDepAct.DataBind(); dlDepAct_SelectedIndexChanged(null, null); dlProvAct_SelectedIndexChanged(null, null); //------------------------------------ dlActiv.DataSource = Actividad.listar_Actividad(); dlActiv.DataBind(); //------------------------------------ dlOrg.DataSource = OrgAtendida.listar_OrgAtendida(); dlOrg.DataBind(); //------------------------------------ ddlDNI.DataSource = Talento.listar_Talento_combo_mant(); ddlDNI.DataBind(); string popupScript = "Javascript: return " + "window.open('" + "../Admin/CV.aspx" + "', 'CustomPopUp', " + "'width=1000, height=600, menubar=no, resizable=no');"; btnCV.Attributes.Add("onclick", popupScript); } }
protected void btnBuscar_Click(object sender, EventArgs e) { try { Talento tal = new Talento(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); string ubigeonac, ubigeo, sexo, estudio, estado; tal._num_dni = Convert.ToInt32(txtDNI.Text); ds = Talento.listar_Talento_dni(tal); txtNomb.Text = (ds.Tables[0].Rows[0][2]).ToString(); txtApell.Text = (ds.Tables[0].Rows[0][1]).ToString(); txtFechanac.Text = Convert.ToDateTime(ds.Tables[0].Rows[0][3]).ToShortDateString(); ubigeonac = (ds.Tables[0].Rows[0][4]).ToString(); dlDep.SelectedValue = ubigeonac.Substring(0, 2); dlDep_SelectedIndexChanged(null, null); dlProv.SelectedValue = ubigeonac.Substring(0, 4); dlProv_SelectedIndexChanged(null, null); dlDist.SelectedValue = ubigeonac; sexo = (ds.Tables[0].Rows[0][5]).ToString(); if (sexo == "Masculino") { rbtnMale.Checked = true; rbtnFemale.Checked = false; } else { rbtnMale.Checked = false; rbtnFemale.Checked = true; } dlEstCivil.SelectedIndex = Convert.ToInt16(ds.Tables[0].Rows[0][6]) - 1; dlResid.SelectedIndex = Convert.ToInt16(ds.Tables[0].Rows[0][7]) - 1; txtDir.Text = (ds.Tables[0].Rows[0][8]).ToString(); ubigeo = (ds.Tables[0].Rows[0][9]).ToString(); dlDepRes.SelectedValue = ubigeo.Substring(0, 2); dlDepRes_SelectedIndexChanged(null, null); dlProvRes.SelectedValue = ubigeo.Substring(0, 4); dlProvRes_SelectedIndexChanged(null, null); dlDistRes.SelectedValue = ubigeo; txtFijo.Text = (ds.Tables[0].Rows[0][10]).ToString(); txtCell.Text = (ds.Tables[0].Rows[0][11]).ToString(); txtCorreo.Text = (ds.Tables[0].Rows[0][12]).ToString(); estudio = (ds.Tables[0].Rows[0][13]).ToString(); if (estudio == "00") { rbLectura.Enabled = true; rbEscritura.Enabled = true; rbAmbos.Enabled = true; switch ((ds.Tables[0].Rows[0][14]).ToString()) { case "Lectura": { rbLectura.Checked = true; rbEscritura.Checked = false; rbAmbos.Checked = false; }; break; case "Escritura": { rbLectura.Checked = false; rbEscritura.Checked = true; rbAmbos.Checked = false; }; break; case "Ambos": { rbLectura.Checked = false; rbEscritura.Checked = false; rbAmbos.Checked = true; }; break; } } else { rbLectura.Enabled = false; rbEscritura.Enabled = false; rbAmbos.Enabled = false; dlNivel.SelectedIndex = Convert.ToInt16(estudio.Substring(0, 1)); dlNivel_SelectedIndexChanged(null, null); dlGrado.SelectedIndex = Convert.ToInt16(estudio.Substring(1, 1)) - 1; } dlIdioma.SelectedIndex = Convert.ToInt16(ds.Tables[0].Rows[0][15]) - 1; estado = (ds.Tables[0].Rows[0][17]).ToString(); if (estado == "1") { lbEstado.Text = "Habilitado"; btnHabilitar.Enabled = false; } else { lbEstado.Text = "Inhabilitado"; btnHabilitar.Enabled = true; } cargarExperiencia(); Session["DNI"] = txtDNI.Text; } catch (Exception ex) { } }
protected void btnActualizar_Click(object sender, EventArgs e) { try { Talento tal = new Talento(); tal._nombres = txtNomb.Text; tal._apellidos = txtApell.Text; tal._num_dni = Convert.ToInt32(txtDNI.Text); tal._fecha_nac = Convert.ToDateTime(txtFechanac.Text); tal._lugar_nac = dlDist.SelectedValue; //tal._sexo = txtSexo.Text; if (rbtnMale.Checked) { tal._sexo = rbtnMale.Text; } else { tal._sexo = rbtnFemale.Text; } tal._estado_civil = Convert.ToInt16(dlEstCivil.SelectedValue); tal._residencia = Convert.ToInt16(dlResid.SelectedValue); tal._direccion = txtDir.Text; tal._ubigeo = dlDistRes.SelectedValue; tal._telefono_fijo = Convert.ToInt32(txtFijo.Text); tal._telefono_celular = Convert.ToInt32(txtCell.Text); tal._correo = txtCorreo.Text; if (dlNivel.SelectedItem.ToString() == "Ninguno") { tal._estudio = "00"; if (rbLectura.Checked) { tal._lect_esc = rbLectura.Text; } else { if (rbEscritura.Checked) { tal._lect_esc = rbEscritura.Text; } else { tal._lect_esc = rbAmbos.Text; } } } else { tal._estudio = dlGrado.SelectedValue; tal._lect_esc = ""; } tal._idioma = Convert.ToInt16(dlIdioma.SelectedValue); Talento.actualizar_Talento(tal); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", "alert('Se actualizó el Talento correctamente')", true); limpiar_talento(); limpiar_experiencia(); gdvExp.DataSource = null; gdvExp.DataBind(); ddlDNI_SelectedIndexChanged(null, null); //ddlDNI.DataSource = Talento.listar_Talento_combo_mant(); //ddlDNI.DataBind(); } catch (Exception ex) { } }