private void btnBuscar_Click(object sender, EventArgs e) { if (txtBuscar.Text == "") { MetroMessageBox.Show(this, "Campo buscar vacio", "error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { mgListaComunicado.Rows.Clear(); ComunicadoComponent comunicadoComponent = new ComunicadoComponent(); List <Comunicado> listaPersona = new List <Comunicado>(); listaPersona = comunicadoComponent.buscar(txtBuscar.Text); int n = 0; foreach (var item in listaPersona) { n = mgListaComunicado.Rows.Add(); mgListaComunicado.Rows[n].Cells[0].Value = item.Id; mgListaComunicado.Rows[n].Cells[1].Value = item.persona.nombre; mgListaComunicado.Rows[n].Cells[2].Value = item.persona.apellido; mgListaComunicado.Rows[n].Cells[3].Value = item.persona.DNI; mgListaComunicado.Rows[n].Cells[4].Value = item.visto; string dat = item.fecha.ToString("dd-MM-yyyy"); mgListaComunicado.Rows[n].Cells[5].Value = dat; mgListaComunicado.Rows[n].Cells[6].Value = item.maestro.nombre + " " + item.maestro.apellido; n++; } } }
private void mgListaComunicado_CellContentClick(object sender, DataGridViewCellEventArgs e) { Comunicado comunicado = new Comunicado(); ComunicadoComponent comunicadoComponent = new ComunicadoComponent(); comunicado = comunicadoComponent.ReadBy(int.Parse(mgListaComunicado.CurrentRow.Cells[0].Value.ToString())); txtColeccione.Text = comunicado.comunicado; }
private void metroButton2_Click(object sender, EventArgs e) { ComunicadoComponent comunicadoComponent = new ComunicadoComponent(); comunicadoComponent.Delete(int.Parse(mgListaComunicado.CurrentRow.Cells[0].Value.ToString())); txtColeccione.Text = ""; llenarGrillaListado(); }
private void metroButton1_Click(object sender, EventArgs e) { if (mgListaComunicado.Rows.Count != 0) { Comunicado comunicado = new Comunicado(); ComunicadoComponent comunicadoComponent = new ComunicadoComponent(); comunicado = comunicadoComponent.ReadBy(int.Parse(mgListaComunicado.CurrentRow.Cells[0].Value.ToString())); comunicadoComponent.Update(comunicado.Id); llenarGrilla(); } }
private void metroButton3_Click(object sender, EventArgs e) { if (txtColeccione.Text == "") { MetroMessageBox.Show(this, "Campo Comunicado esta vacio", "error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { ComunicadoComponent comunicadoComponent = new ComunicadoComponent(); Comunicado comunicado = new Comunicado(); comunicado.Id = int.Parse(mgListaComunicado.CurrentRow.Cells[0].Value.ToString()); comunicado.comunicado = txtColeccione.Text; comunicadoComponent.Update(comunicado); txtColeccione.Text = ""; } }
private void metroButton1_Click(object sender, EventArgs e) { if (txtNuevaComunicacion.Text == "") { MetroMessageBox.Show(this, "Campo Comunicado esta vacio", "error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { Alumno alumno = new Alumno(); alumno.Id = int.Parse(mgAlumno.CurrentRow.Cells[0].Value.ToString()); Comunicado comunicado = new Comunicado(persona, alumno); comunicado.comunicado = txtNuevaComunicacion.Text; ComunicadoComponent comunicadoComponent = new ComunicadoComponent(); comunicadoComponent.Create(comunicado); ValidadoresComponent.Alta("Comunicacion", this); llenarListaComunicado(); RecorridoForm.LimpiarTXT(this); } }
void llenarListaComunicado() { ComunicadoComponent comunicadoComponent = new ComunicadoComponent(); AlumnoComponent cursoAlumnoComponent = new AlumnoComponent(); int año = DateTime.Now.Year; List <Comunicado> result = new List <Comunicado>(); Curso curso = new Curso(); curso = (Curso)txtCurso.SelectedItem; foreach (var item in comunicadoComponent.Read()) { foreach (var alumno in cursoAlumnoComponent.ObtenerAlumnodeCunCurso(curso.Id)) { if (item.persona.Id == alumno.Id) { result.Add(item); } } } int n = 0; foreach (var item in result) { mgListaComunicado.Rows.Clear(); n = mgListaComunicado.Rows.Add(); mgListaComunicado.Rows[n].Cells[0].Value = item.Id; mgListaComunicado.Rows[n].Cells[1].Value = item.persona.nombre; mgListaComunicado.Rows[n].Cells[2].Value = item.persona.apellido; mgListaComunicado.Rows[n].Cells[3].Value = item.persona.DNI; mgListaComunicado.Rows[n].Cells[4].Value = item.visto; string dat = item.fecha.ToString("dd-MM-yyyy"); mgListaComunicado.Rows[n].Cells[5].Value = dat; mgListaComunicado.Rows[n].Cells[6].Value = item.maestro.nombre + " " + item.maestro.apellido; n++; } }
void llenarGrilla() { mgListaComunicado.Rows.Clear(); ComunicadoComponent comunicadoComponent = new ComunicadoComponent(); List <Comunicado> listaPersona = new List <Comunicado>(); listaPersona = comunicadoComponent.ReadByAlumnoYaño(persona.Id, cursos.salaHorario.año); int n = 0; foreach (var item in listaPersona) { n = mgListaComunicado.Rows.Add(); mgListaComunicado.Rows[n].Cells[0].Value = item.Id; mgListaComunicado.Rows[n].Cells[1].Value = item.persona.nombre; mgListaComunicado.Rows[n].Cells[2].Value = item.persona.apellido; mgListaComunicado.Rows[n].Cells[3].Value = item.persona.DNI; mgListaComunicado.Rows[n].Cells[4].Value = item.visto; string dat = item.fecha.ToString("dd-MM-yyyy"); mgListaComunicado.Rows[n].Cells[5].Value = dat; mgListaComunicado.Rows[n].Cells[6].Value = item.maestro.nombre + " " + item.maestro.apellido; n++; } }
private void metroButton1_Click(object sender, EventArgs e) { if (txtNuevaComunicacion.Text == "") { MetroMessageBox.Show(this, "Campo Comunicado esta vacio", "error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { Alumno alumno = new Alumno(); alumno.Id = int.Parse(mgAlumno.CurrentRow.Cells[0].Value.ToString()); Maestro maestro = new Maestro(); MaestroComponent maestroComponent = new MaestroComponent(); maestro = maestroComponent.ReadByUsuario(SessionManager.instance.GetUSuario().Id); Comunicado comunicado = new Comunicado(maestro, alumno); comunicado.comunicado = txtNuevaComunicacion.Text; ComunicadoComponent comunicadoComponent = new ComunicadoComponent(); comunicadoComponent.Create(comunicado); ValidadoresComponent.Alta("Comunicacion", this); llenarGrillaListado(); RecorridoForm.LimpiarTXT(this); } }