public ActionResult AsignarTutoria(FormCollection values) { var id_curso = values["ID_CURSO"]; var id_usuario = values["ID_USUARIO"]; var id_institucion = values["ID_INSTITUCION"]; var descripcion = values["DESCRIPCION"]; var fecha = values["FECHA_HORA"]; var hora = values["Hora"]; var fecha_hora = fecha + " " + hora; USUARIOS estudiante = db.USUARIOS.Find(int.Parse(id_usuario)); CURSOS curso = db.CURSOS.Find(int.Parse(id_curso)); INSTITUCION institucion = db.INSTITUCION.Find(int.Parse(id_institucion)); TUTORIA_CURSOS tc = new TUTORIA_CURSOS { ID_INSTITUCION = institucion.ID_INSTITUCION, ID_USUARIO = estudiante.ID_USUARIO, ID_CURSO = curso.ID_CURSO, DESCRIPCION = descripcion, FECHA_HORA = fecha_hora }; if (!ModelState.IsValid) { return(View(tc)); } db.TUTORIA_CURSOS.Add(tc); db.SaveChanges(); return(RedirectToAction("RegistrarEstudiante")); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Object user = Session["user"]; if (user != null) { USUARIO userSesion = (USUARIO)user; if (userSesion.INSTITUCIONID != null) { // if (userSesion.PERFIL == 2) { menuAdmin.Visible = true; menuNormal.Visible = false; } else { menuNormal.Visible = true; menuAdmin.Visible = false; } INSTITUCION institucion = new INSTITUCION(); institucion = institucion.obtainInstitutionById(Int32.Parse(userSesion.INSTITUCIONID.ToString())); if (institucion != null) { Session.Add("institucion", institucion.NOMBRE); lblInsitucion.Text = institucion.NOMBRE; } else { Response.Redirect("Cuenta/Login.aspx"); } PROFESOR profesor = new PROFESOR(); profesor = profesor.obtainProfesorByUserId(userSesion.USUARIOID); if (profesor != null) { lblNombre.Text = profesor.NOMBRELARGO; lblCedula.Text = profesor.CEDULA; lblNombreCompletoMenuNormal.Text = profesor.NOMBRELARGO; lblCedulaMenuNormal.Text = profesor.CEDULA; } else { Response.Redirect("Cuenta/Login.aspx"); } } else { Response.Redirect("Cuenta/Login.aspx"); } } else { Response.Redirect("Cuenta/Login.aspx"); } } }
public int deleteInstitution(int institutionId) { int result = 0; INSTITUCION institutionDelete = obtainInstitutionById(institutionId); if (institutionDelete != null) { Datos.INSTITUCIONs.Remove(institutionDelete); result = Datos.SaveChanges(); } return(result); }
private void cargarInstituciones() { INSTITUCION institucion = new INSTITUCION(); List <INSTITUCION> instituciones = institucion.obtainAllInstitutions(); if (instituciones != null && instituciones.Count() > 0) { gridInstituciones.DataSource = instituciones; gridInstituciones.DataBind(); } limpiar(); }
protected void btnGuardarInstitucion_Click(object sender, EventArgs e) { String textoValidacion = validarInstitucion(false); if (textoValidacion.Equals("")) { INSTITUCION institucion = new INSTITUCION(); institucion.addInstitution(txtNombreInstitucion.Text); cargarInstituciones(); lblSucess.Text = "Se creo Correctamente la Notificacion"; pnlSucess.Visible = true; } else { lblError.Text = textoValidacion; pnlError.Visible = true; } }
protected void btnEliminarInstitucion_Click(object sender, EventArgs e) { String textoValidacion = validarInstitucion(true); if (textoValidacion.Equals("")) { INSTITUCION institucion = new INSTITUCION(); institucion.deleteInstitution(Convert.ToInt32(lblInstitucionId.Text)); cargarInstituciones(); lblSucess.Text = "Se elimino Correctamente la Notificacion"; pnlSucess.Visible = true; } else { lblError.Text = textoValidacion; pnlError.Visible = true; } }
public INSTITUCION addInstitution(String institutionName) { INSTITUCION institution = new INSTITUCION(); List<INSTITUCION> institutions = obtainInstitutionByName(institutionName); if (institutions.Count <= 0) { try { institution.INSTITUCIONID = 0; institution.NOMBRE = institutionName; Datos.INSTITUCIONs.Add(institution); Datos.SaveChanges(); } catch (Exception ex) { string x = ex.Message; } } return institution; }
public INSTITUCION addInstitution(String institutionName) { INSTITUCION institution = new INSTITUCION(); List <INSTITUCION> institutions = obtainInstitutionByName(institutionName); if (institutions.Count <= 0) { try { institution.INSTITUCIONID = 0; institution.NOMBRE = institutionName; Datos.INSTITUCIONs.Add(institution); Datos.SaveChanges(); } catch (Exception ex) { string x = ex.Message; } } return(institution); }
private void cargarInstituciones() { INSTITUCION institucion = new INSTITUCION(); List<INSTITUCION> instituciones = institucion.obtainAllInstitutions(); if (instituciones != null && instituciones.Count() > 0) { gridInstituciones.DataSource = instituciones; gridInstituciones.DataBind(); } limpiar(); }