public Resultado ResponderNota(Nota nota, Comentario nuevoComentario, UsuarioLogueado usuarioLogueado) { CrearArchivos(); LeerNotas(); var resultado = new Resultado(); //FALTA VALIDAR QUE EL USUARIO LOGUEADO PUEDA ACCEDER A LA NOTA if (resultado.EsValido) { var notacomentada = ListaNotas.Single(x => x.Id == nota.Id); ListaNotas.Remove(notacomentada); var comentarios = notacomentada.Comentarios == null ? new List <Comentario>() : notacomentada.Comentarios.ToList(); if (nuevoComentario.Mensaje != "") { comentarios.Add(nuevoComentario); } else { resultado.Errores.Add("no se escrbribio ningun comentario"); } notacomentada.Comentarios = comentarios.ToArray(); ListaNotas.Add(notacomentada); } GuardarNotas(ListaNotas); return(resultado); }
public Nota[] ObtenerCuadernoComunicaciones(int idPersona, UsuarioLogueado usuariologueado) { CrearArchivos(); LeerNotas(); LeerHijos(); LeerPadres(); List <Nota> notas = new List <Nota>(); if (VerificarUsuarioLogeado(Roles.Directora, usuariologueado).EsValido | VerificarUsuarioLogeado(Roles.Padre, usuariologueado).EsValido | VerificarUsuarioLogeado(Roles.Docente, usuariologueado).EsValido) { //FALTA VALIDAR QUE SEA HIJO DEL PADRE, O QUE ESTE EN ALGUNA SALA DEL DOCENTE var alumno = ListaHijos.Single(x => x.Id == idPersona); if (alumno.Notas != null) { foreach (var nota in alumno.Notas) { var notaenlista = ListaNotas.SingleOrDefault(x => x.Id == nota.Id); notas.Add(notaenlista); } } } GuardarHijos(ListaHijos); GuardarPadre(ListaPadres); GuardarNotas(ListaNotas); return(notas.ToArray()); }
public Resultado MarcarNotaComoLeida(Nota nota, UsuarioLogueado usuarioLogueado) { CrearArchivos(); LeerNotas(); //FALTA VALIDAR QUE EL USUARIO PUEDA LLEGAR A LA NOTA Resultado resultado = VerificarUsuarioLogeado(Roles.Padre, usuarioLogueado); if (resultado.EsValido) { ListaNotas.Find(x => x.Id == nota.Id).Leida = true; } GuardarNotas(ListaNotas); return(resultado); }
// fazer a validação para ativar o botão de gerar o lote private void ListaNotas_CellContentClick(object sender, DataGridViewCellEventArgs e) { //var selecionar = (DataGridView)sender; //selecionar.EndEdit(); //foreach (DataGridViewRow row in ListaNotas.Rows) //{ // if (e.RowIndex >= 0) // { // var cbxCell = (DataGridViewCheckBoxCell)selecionar.Rows[e.RowIndex].Cells[0]; // if ((bool)cbxCell.Value) // // if (Convert.ToBoolean(cbxCell.Value)) // { // button2.Enabled = true; // } // else // { // button2.Enabled = false; // } // } //} if (e.ColumnIndex == 0 && e.RowIndex > -1) { ListaNotas.CommitEdit(DataGridViewDataErrorContexts.Commit); var i = 0; foreach (DataGridViewRow row in ListaNotas.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { i++; } } if (i > 0) { button2.Enabled = true; } else { button2.Enabled = false; } } }
protected void Page_Load(object sender, EventArgs e) { l_notas = new ListaNotas(Server.MapPath(@"~/Archivos/Notas.bin")); l_notas.CerrarFichero(); }
public Form1() { InitializeComponent(); ListaNotas.Refresh(); }
//HACIENDO PRIMERO LO DE SALAS SE EVITA DUPLICIDAD DE CODIGO public Resultado AltaNota(Nota nota, Sala[] salas, Hijo[] hijos, UsuarioLogueado usuariologueado) { CrearArchivos(); var resultado = new Resultado(); if (hijos == null) { foreach (var sala in salas) { LeerHijos(); foreach (var buscador in ListaHijos) { if (buscador.Sala.Id == sala.Id) { LeerNotas(); var notasxhijo = buscador.Notas == null ? new List <Nota>() : buscador.Notas.ToList(); if (notasxhijo.Any(x => x.Id == nota.Id)) { resultado.Errores.Add("la nota esta agregada"); } else { nota.Id = ListaNotas.Count() + 1; } ListaNotas.Add(nota); notasxhijo.Add(nota); buscador.Notas = notasxhijo.ToArray(); GuardarNotas(ListaNotas); } } GuardarHijos(ListaHijos); } }//si selecciona salas else { resultado.Errores.Add("no se seleccionaron salas"); } if (salas != null) { foreach (var hijo in hijos) { LeerHijos(); foreach (var buscador in ListaHijos) { if (hijo.Id == buscador.Id) { LeerNotas(); var notasxhijo = buscador.Notas == null ? new List <Nota>() : buscador.Notas.ToList(); if (notasxhijo.Any(x => x.Id == nota.Id)) { resultado.Errores.Add("la nota esta agregada"); } else { nota.Id = ListaNotas.Count() + 1; } ListaNotas.Add(nota); notasxhijo.Add(nota); buscador.Notas = notasxhijo.ToArray(); GuardarNotas(ListaNotas); } } GuardarHijos(ListaHijos); } }//si selecciona hijos else { resultado.Errores.Add("no se seleccionaron ningun hijo"); } return(resultado); }