protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { cargarCombo(ddl_TipoDoc); if (Session["origen"] == null) { Session["origen"] = "default"; } string origen = Session["origen"].ToString(); if (origen.Equals("consulta")) { Docente docenteConsulta = (Docente)Session["docente"]; txt_legajo.Text = docenteConsulta.legajo.ToString(); txt_Nombre.Text = docenteConsulta.docente.nombre.ToString(); txt_Apellido.Text = docenteConsulta.docente.apellido.ToString(); ddl_TipoDoc.SelectedIndex = docenteConsulta.docente.tipoDoc.id; txt_NumDoc.Text = docenteConsulta.docente.numDoc.ToString(); txt_Domicilio.Text = docenteConsulta.docente.domicilio.ToString(); txt_Telefono.Text = docenteConsulta.docente.telefono.ToString(); txt_Celular.Text = docenteConsulta.docente.celular.ToString(); txt_mail.Text = docenteConsulta.docente.mail.ToString(); txt_FechaNacimiento.Text = docenteConsulta.docente.fechaNacimiento.ToString(); txt_salario.Text = docenteConsulta.salario.ToString(); txt_horaDesde.Text = docenteConsulta.horarioTrabajo.desde; txt_horaHasta.Text = docenteConsulta.horarioTrabajo.hasta; Session["origen"] = "default"; } else { txt_legajo.Text = DocenteDao.MaxLegajo().ToString(); } } }
protected void grillaDocente_SelectedIndexChanged(object sender, EventArgs e) { Docente docente = DocenteDao.obtenerPorLegajo(int.Parse(grillaDocente.SelectedRow.Cells[1].Text)); Session["docente"] = docente; Session["origen"] = "consulta"; Response.Redirect("Docente.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { cargarCombo(ddl_tipoDoc); listDocente = DocenteDao.obtenerTodo(); grillaDocente.DataSource = listDocente; grillaDocente.DataBind(); } }
protected void btn_Guardar_Click(object sender, EventArgs e) { Persona docentePersona = new Persona(); docentePersona.nombre = txt_Nombre.Text; docentePersona.apellido = txt_Apellido.Text; docentePersona.numDoc = int.Parse(txt_NumDoc.Text); if (ddl_TipoDoc.SelectedIndex != 0) { docentePersona.tipoDoc = TipoDocumentoDao.obtenerTipoDocumento(ddl_TipoDoc.SelectedIndex); } else { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clave", "alert('Faltó ingresar el Tipo de Documento del Docente. Ingrese nuevamente');", true); return; } docentePersona.domicilio = txt_Domicilio.Text; docentePersona.telefono = txt_Telefono.Text; docentePersona.celular = txt_Celular.Text; docentePersona.mail = txt_mail.Text; docentePersona.fechaNacimiento = DateTime.Parse(txt_FechaNacimiento.Text); Docente docente = new Docente(); docente.docente = docentePersona; docente.legajo = int.Parse(txt_legajo.Text); docente.salario = int.Parse(txt_salario.Text); Horario horario = new Horario(); horario.desde = txt_horaDesde.Text; horario.hasta = txt_horaHasta.Text; docente.horarioTrabajo = horario; Docente DocenteViejo = DocenteDao.obtenerPorLegajo(int.Parse(txt_legajo.Text)); if (DocenteViejo != null) { Persona personaDocenteViejo = DocenteViejo.docente; DocenteDao.update(DocenteViejo, docente); } else { DocenteDao.add(docente, docentePersona, horario); } }
protected void btnRegistrar_Click(object sender, EventArgs e) { idCursos = new List <int>(); idCursos = new List <int>(); foreach (ListItem i in list_cursos.Items) { if (i.Selected) { idCursos.Add(int.Parse(i.Value)); } } if (gv_busqueda.SelectedRow != null || idCursos.Count > 0) { Docente_x_cursoDao.registrarCursadoDocente(DocenteDao.obtenerPorLegajo(int.Parse(gv_busqueda.SelectedRow.Cells[1].Text)), idCursos, DateTime.Now); } }
protected void btn_Buscar_Click(object sender, EventArgs e) { int numDoc = 0; int legajo = 0; if (txt_numeroDoc.Text != "") { numDoc = int.Parse(txt_numeroDoc.Text); } if (txt_legajo.Text != "") { legajo = int.Parse(txt_legajo.Text); } grillaDocente.DataSource = DocenteDao.buscarPorParametros(txt_nombre.Text, txt_apellido.Text, legajo, ddl_tipoDoc.SelectedIndex, numDoc); grillaDocente.DataKeyNames = new string[] { "legajo" }; grillaDocente.DataBind(); txt_apellido.Text = ""; txt_legajo.Text = ""; txt_nombre.Text = ""; txt_numeroDoc.Text = ""; ddl_tipoDoc.Focus(); }
protected void btn_Eliminar_Click(object sender, EventArgs e) { DocenteDao.delete(DocenteDao.obtenerPorLegajo(int.Parse(txt_legajo.Text))); }
protected void cargarGrilla() { gv_busqueda.DataSource = DocenteDao.obtenerTodo(); gv_busqueda.DataKeyNames = new string[] { "legajo" }; gv_busqueda.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { listDocente = DocenteDao.obtenerTodo(); grillaDocente.DataSource = listDocente; grillaDocente.DataBind(); }