// GET: materias/Delete/5 public ActionResult Delete(int?id) { if (Convert.ToInt32(Session["NivelDeAcesso"]) == 3) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } materias materias = db.materias.Find(id); if (materias == null) { return(HttpNotFound()); } return(View(materias)); } else if (Convert.ToInt32(Session["NivelDeAcesso"]) == 2) { return(RedirectToAction("Details", "Professores_Turmas")); } else if (Convert.ToInt32(Session["NivelDeAcesso"]) == 1) { return(RedirectToAction("Details", "alunos")); } else { return(RedirectToAction("Login", "Login")); } }
public ActionResult Create([Bind(Include = "Nome,Descricao")] materias materias) { if (Convert.ToInt32(Session["NivelDeAcesso"]) == 3) { if (ModelState.IsValid) { db.materias.Add(materias); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(materias)); } else if (Convert.ToInt32(Session["NivelDeAcesso"]) == 2) { return(RedirectToAction("Details", "Professores_Turmas")); } else if (Convert.ToInt32(Session["NivelDeAcesso"]) == 1) { return(RedirectToAction("Details", "alunos")); } else { return(RedirectToAction("Login", "Login")); } }
public void iniciarMaterias(materias vistaMateria) { vistaMateriaObj = vistaMateria; rellenarTabla(); vistaMateriaObj.btn_eliminar.Click += new EventHandler(btn_Delete); vistaMateriaObj.txt_buscar.TextChanged += new EventHandler(buscando); ControlCamposVacios.soloLetrasTxtBox(vistaMateriaObj.txt_buscar); }
public Form1() { InitializeComponent(); button_materias.BackColor = Color.Black; button_materias.FlatAppearance.MouseOverBackColor = Color.Black; doc = new docentes(); mat = new materias(); grp = new grupos(); hr = new horario(); bajarNivel(mat); bajarNivel(doc); bajarNivel(grp); bajarNivel(hr); }
public ActionResult DeleteConfirmed(int id) { if (Convert.ToInt32(Session["NivelDeAcesso"]) == 3) { materias materias = db.materias.Find(id); db.materias.Remove(materias); db.SaveChanges(); return(RedirectToAction("Index")); } else if (Convert.ToInt32(Session["NivelDeAcesso"]) == 2) { return(RedirectToAction("Details", "Professores_Turmas")); } else if (Convert.ToInt32(Session["NivelDeAcesso"]) == 1) { return(RedirectToAction("Details", "alunos")); } else { return(RedirectToAction("Login", "Login")); } }
public ActionResult Details(int id) { materias materia = db.materias.Find(id); return(View(materia)); }
void HandleValueChanged(object sender, ValueChangedEventArgs args) { string _profesor = "", _materia = "", _hora = ""; if (args.DatabaseError != null) { Debug.LogError(args.DatabaseError.Message); return; } // Do something with the data in args.Snapshot //Debug.Log(args.Snapshot.GetRawJsonValue()); // WriteString(args.Snapshot.GetRawJsonValue()); // Debug.Log(args.Snapshot.Value); //Debug.Log(args.Snapshot.Key); int i, x = 0, J; //la i debe ser hora parseado a int i = int.Parse(horaActual); J = i; //long valor = args.Snapshot.ChildrenCount;//crear dependiendo de la cantidad que obtendremos maximo 5 minimo 1 y lo demas colocarlo en null o "" int valor = 0; if (J >= 1600) {//para reducir el valor de obtenciones de clases Debug.Log("entro a la obtencion de horass"); for (int y = J; y <= 2000; y += 100) { J += 100; valor++; } } else //si es 1500 le aumentara a los 500 para haci tener limite de 2000 { J = i + 600; valor = 6; } DescripcionM.text = args.Snapshot.Child("" + i).Child("description").Value.ToString();//asigna texto de descripcion de la hora actual ProfesorD.text = args.Snapshot.Child("" + i).Child("profesor").Value.ToString(); MateriaD.text = args.Snapshot.Child("" + i).Child("materia").Value.ToString(); materias[] m = new materias[valor]; while (i != J && i >= 700 && i <= 2000)//deve evaluar al mismo tiempo si i sea limite a 2000 y i mayor a 700 //if(){} si la i es igual a 2000 solamente mostrar 1 ves en lugar de +400 y asi desde 4 horas antes reducir 100 a la muestra { Debug.Log("entro a la obtencion"); Debug.Log(args.Snapshot.Child("" + i).Child("materia").Value.ToString()); //unicamente obtendra un Objeto con materia y con profesor m[x] = new materias(i, args.Snapshot.Child("" + i).Child("materia").Value.ToString(), args.Snapshot.Child("" + i).Child("profesor").Value.ToString()); //colocar y crear una cadena con saltos de linea de cada seccion concatenada _profesor = _profesor + m[x].getprofesor() + "\n\n"; _materia = _materia + m[x].getmateria() + "\n\n"; _hora = _hora + m[x].gethora() + "\n"; i += 100; x++; } x = 0; while (x != m.Length) { Debug.Log(m[x].gethora() + "materia: " + m[x].getmateria()); x++; } Debug.Log(args.Snapshot.ChildrenCount.ToString()); Debug.Log("hora: " + _hora); Debug.Log("materias: " + _materia); Materia.text = _materia; Hora.text = _hora; Profesor.text = _profesor; /** * Falta seccionar y obtener de la hora actual a 4 mas de adelante solamente * **/ }
public JsonResult Create(MCurso curso) { String periodo = MConfiguracionApp.getPeridoActual(db); Respuesta respuesta = new Respuesta(); if (sesion.esAdministrador(db)) { if (ModelState.IsValid) { materias materia = db.materias.Find(curso.nombre_materia); MUsuario usuario = new MUsuario().getUsuarioId(curso.idUsuario); bool tieneCurso = curso.tieneCurso(curso.idUsuario, curso.nombre_materia, periodo); if (!tieneCurso) { if (materia != null) { if (usuario != null) { cursos cur = new cursos { estado = curso.estado, fecha_finalizacion = curso.fecha_finalizacion, idUsuario = curso.idUsuario, nombre_materia = curso.nombre_materia.ToUpper(), periodo = periodo, eliminado = 0 }; db.cursos.Add(cur); db.SaveChanges(); respuesta.RESPUESTA = "OK"; respuesta.MENSAJE = "Grupo guardado."; } else { respuesta.RESPUESTA = "ERROR"; respuesta.MENSAJE = "Usuario " + curso.idUsuario + " no existe "; } } else { respuesta.RESPUESTA = "ERROR"; respuesta.MENSAJE = "La Asignatura '" + curso.nombre_materia + "' no existe"; } } else { respuesta.RESPUESTA = "ERROR"; respuesta.MENSAJE = "Él Monitor " + curso.idUsuario + " tiene a cargo " + curso.nombre_materia + "."; } } else { respuesta.RESPUESTA = "ERROR"; respuesta.MENSAJE = "Datos incorrecto."; } } else { respuesta.RESPUESTA = "LOGIN"; } return(Json(respuesta)); }