private void ActualizarGrillaFiltrada() { clsProfesor temp = new clsProfesor(); if (tbFiltroNombre.Text != string.Empty) { temp.Nombre = tbFiltroNombre.Text; } if (tbFiltroApellido.Text != string.Empty) { temp.Apellido = tbFiltroApellido.Text; } if (tbFiltroDni.Text != string.Empty) { temp.Dni = tbFiltroDni.Text; } if (cbFiltroEstado.SelectedItem.ToString() != "Todos") { if (cbFiltroEstado.SelectedItem.ToString() == "Habilitados") { temp.Estado = 1; } else { temp.Estado = 0; } } dgvDocentes.Rows.Clear(); try { List<IEntidad> LE = Repo.Lista(temp); foreach (clsProfesor EPro in LE) { dgvDocentes.Rows.Add(); dgvDocentes.Rows[dgvDocentes.Rows.Count - 1].Cells["IdProfesor"].Value = EPro.Id; dgvDocentes.Rows[dgvDocentes.Rows.Count - 1].Cells["Nombre"].Value = EPro.Nombre; dgvDocentes.Rows[dgvDocentes.Rows.Count - 1].Cells["Apellido"].Value = EPro.Apellido; dgvDocentes.Rows[dgvDocentes.Rows.Count - 1].Cells["Dni"].Value = EPro.Dni; dgvDocentes.Rows[dgvDocentes.Rows.Count - 1].Cells["Direccion"].Value = EPro.Direccion; dgvDocentes.Rows[dgvDocentes.Rows.Count - 1].Cells["Telefono"].Value = EPro.Telefono; dgvDocentes.Rows[dgvDocentes.Rows.Count - 1].Cells["Email"].Value = EPro.Email; dgvDocentes.Rows[dgvDocentes.Rows.Count - 1].Cells["Contraseña"].Value = EPro.Contraseña; if (EPro.Estado == 1) { dgvDocentes.Rows[dgvDocentes.Rows.Count - 1].Cells["Estado"].Value = "Habilitado"; } else { dgvDocentes.Rows[dgvDocentes.Rows.Count - 1].Cells["Estado"].Value = "Deshabilitado"; } } } catch (Exception ex) { MessageBox.Show("Se produjo el siguiente error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Actualizar(IEntidad entidad) { clsProfesor profesor = new clsProfesor(); try { profesor = getCast(entidad); } catch (Exception e) { throw e; } int filas; try { filas = manager.UpdateProfesor(profesor); if (filas == 0) { throw new ArgumentException("El profesor no existe"); } } catch (Exception e) { throw e; } }
public void Agregar(IEntidad entidad) { clsProfesor profesor = new clsProfesor(); try { profesor = getCast(entidad); } catch (Exception e) { throw e; } clsProfesor compare = new clsProfesor(); compare.Dni = profesor.Dni; try { if (manager.SelectProfesor(compare).Count == 0) manager.InsertarProfesor(profesor); else throw new ArgumentException("El Profesor ingresado ya existe"); } catch (Exception e) { throw e; } }
public frmNotas(clsAdministrador Administrador, clsProfesor Profesor) { InitializeComponent(); if (Administrador != null) { Iniciador = inicio.Amdinistrador; } else { if (Profesor != null) { Profesor_inicial = Profesor; Iniciador = inicio.Profesor; } } }
private void ActualizarGrillaFiltrada() { clsProfesor temp = new clsProfesor(); if (tbFiltroNombre.Text != string.Empty) { temp.Nombre = tbFiltroNombre.Text; } if (tbFiltroApellido.Text != string.Empty) { temp.Apellido = tbFiltroApellido.Text; } if (tbFiltroDni.Text != string.Empty) { temp.Dni = tbFiltroDni.Text; } temp.Estado = 1; dgvDocentes.Rows.Clear(); try { List<IEntidad> LE = Repo.Lista(temp); foreach (clsProfesor EPro in LE) { dgvDocentes.Rows.Add(); dgvDocentes.Rows[dgvDocentes.Rows.Count - 1].Cells["IdProfesor"].Value = EPro.Id; dgvDocentes.Rows[dgvDocentes.Rows.Count - 1].Cells["Nombre"].Value = EPro.Nombre; dgvDocentes.Rows[dgvDocentes.Rows.Count - 1].Cells["Apellido"].Value = EPro.Apellido; dgvDocentes.Rows[dgvDocentes.Rows.Count - 1].Cells["Dni"].Value = EPro.Dni; dgvDocentes.Rows[dgvDocentes.Rows.Count - 1].Cells["Direccion"].Value = EPro.Direccion; dgvDocentes.Rows[dgvDocentes.Rows.Count - 1].Cells["Telefono"].Value = EPro.Telefono; dgvDocentes.Rows[dgvDocentes.Rows.Count - 1].Cells["Email"].Value = EPro.Email; dgvDocentes.Rows[dgvDocentes.Rows.Count - 1].Cells["CantidadCursos"].Value = Convert.ToString(RProfesor.CantidadCursos(EPro.Id)); } } catch (Exception ex) { MessageBox.Show("Se produjo el siguiente error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public frmRegistroCalificaciones(clsAdministrador Administrador,clsAlumno Alumno,clsProfesor Profesor) { InitializeComponent(); if (Administrador != null) { this.Administrador = Administrador; iniciador = inicio.Administrador; } else { if (Alumno != null) { this.Alumno = Alumno; iniciador = inicio.Alumno; } else { this.Profesor = Profesor; this.iniciador = inicio.Profesor; } } }
public List<clsNotaFormateada> Notas_por_Profesor(clsProfesor Profe) { List<clsNotaFormateada> res = new List<clsNotaFormateada>(); DataTable dt; try { dt = dbManager.Consultar ( "select resultado.IdNota,Alumnos.Nombre, Alumnos.Apellido,Cursos.Nombre as \"Curso\",resultado.Nota,resultado.Fecha,resultado.Estado " + "from " + " Alumnos , " + "(select * from Nota where IdCurso In ( select IdCurso from Dicta where IdProfesor = '" + Profe.Id.ToString() + "') )as \"resultado\" ,Cursos " + "where Alumnos.IdAlumno = resultado.IdAlumno " + "and Cursos.IdCurso = resultado.IdCurso "+ "and resultado.Estado = 1; " ); } catch (Exception e) { throw e; } foreach (DataRow item in dt.Rows) { clsNotaFormateada p = new clsNotaFormateada(); p.Id = Convert.ToInt32(item["IdNota"]); p.Nombre_Alumno = Convert.ToString(item["Nombre"]); p.Apellido = Convert.ToString(item["Apellido"]); p.Nombre_Curso = Convert.ToString(item["Curso"]); p.Nota = Convert.ToDouble(item["Nota"]); p.Fecha = Convert.ToDateTime(item["Fecha"]); p.Estado = Convert.ToInt32(item["Estado"]); res.Add(p); } return res; }
public List<IEntidad> Notas_Por_Profesor(int id) { List<IEntidad> list = new List<IEntidad>(); clsProfesor temp = new clsProfesor(); temp.Id = id; try { list.AddRange(manager.Notas_por_Profesor(temp)); } catch (Exception e) { throw e; } return list; }
public frmAsignarDocentes2(clsProfesor Profesor) { InitializeComponent(); this.Profesor = Profesor; }
public int UpdateProfesor(clsProfesor entidad) { int filas; try { String query = "update Profesores set " + "Nombre = '" + entidad.Nombre + "', Apellido = '" + entidad.Apellido + "', Dni ='" + entidad.Dni + "', Telefono = '" + entidad.Telefono + "', Contraseña = '" + entidad.Contraseña + "', Estado = '" + entidad.Estado + "', Direccion = '" + entidad.Direccion + "', Email= '" + entidad.Email + "' where IdProfesor = " + entidad.Id + ";"; filas = dbmanager.Ejecutar(query, Tipo.ACTUALIZAR); } catch (Exception e) { throw e; } return filas; }
public List<clsProfesor> SelectProfesor(clsProfesor entidad) { bool id = false, nombre = false, apellido = false, dni = false, telefono = false, contraseña = false, estado = false, direccion = false; string query = string.Empty; if (entidad.Id != -1 || entidad.Nombre != null || entidad.Apellido != null || entidad.Dni != null || entidad.Telefono != null || entidad.Contraseña != null || entidad.Estado != -1 || entidad.Direccion != null || entidad.Email != null) { query = "select * from Profesores where"; if (entidad.Id != -1) { query += " IdProfesor = '" + entidad.Id + "'"; id = true; } if (entidad.Nombre != null) { if (id) { query += " and"; } query += " Nombre LIKE '" + entidad.Nombre + "%'"; nombre = true; } if (entidad.Apellido != null) { if (id | nombre) { query += " and"; } query += " Apellido LIKE '" + entidad.Apellido + "%'"; apellido = true; } if (entidad.Dni != null) { if (id | nombre | apellido) { query += " and"; } query += " Dni LIKE '" + entidad.Dni + "%'"; dni = true; } if (entidad.Telefono != null) { if (id | nombre | apellido | dni) { query += " and"; } query += " Telefono LIKE '" + entidad.Telefono + "%'"; telefono = true; } if (entidad.Contraseña != null) { if (id | nombre | apellido | dni | telefono) { query += " and"; } query += " Contraseña = '" + entidad.Contraseña + "'"; contraseña = true; } if (entidad.Estado != -1) { if (id | nombre | apellido | dni | telefono | contraseña) { query += " and"; } query += " Estado = " + entidad.Estado; estado = true; } if (entidad.Direccion != null) { if (id | nombre | apellido | dni | telefono | contraseña | estado) { query += " and"; } query += " Direccion LIKE '" + entidad.Direccion + "%'"; direccion = true; } if (entidad.Email != null) { if (id | nombre | apellido | dni | telefono | contraseña | estado | direccion) { query += " and"; } query += " Email LIKE '" + entidad.Email + "%'"; } } else { query = "select * from Profesores"; } query += ";"; List<clsProfesor> res = new List<clsProfesor>(); DataTable dt; try { dt = dbmanager.Consultar(query); } catch (Exception e) { throw e; } foreach (DataRow item in dt.Rows) { clsProfesor p = new clsProfesor(); p.Id = Convert.ToInt32(item["IdProfesor"]); p.Nombre = Convert.ToString(item["Nombre"]); p.Apellido = Convert.ToString(item["Apellido"]); p.Dni = Convert.ToString(item["Dni"]); p.Telefono = Convert.ToString(item["Telefono"]); p.Contraseña = Convert.ToString(item["Contraseña"]); p.Estado = Convert.ToInt32(item["Estado"]); p.Direccion = Convert.ToString(item["Direccion"]); p.Email = Convert.ToString(item["Email"]); res.Add(p); } return res; }
public List<clsProfesor> ListarProfesores() { List<clsProfesor> res = new List<clsProfesor>(); DataTable dt; try { dt = dbmanager.Consultar("select * from Profesores;"); } catch (Exception e) { throw e; } foreach (DataRow item in dt.Rows) { clsProfesor p = new clsProfesor(); p.Id = Convert.ToInt32(item["IdProfesor"]); p.Nombre = Convert.ToString(item["Nombre"]); p.Apellido = Convert.ToString(item["Apellido"]); p.Dni = Convert.ToString(item["Dni"]); p.Telefono = Convert.ToString(item["Telefono"]); p.Contraseña = Convert.ToString(item["Contraseña"]); p.Estado = Convert.ToInt32(item["Estado"]); p.Direccion = Convert.ToString(item["Direccion"]); p.Email = Convert.ToString(item["Email"]); res.Add(p); } return res; }
public clsProfesor Login(string usuario, string contraseña) { clsManejadorProfesor pmanager = new clsManejadorProfesor(); clsProfesor consulta = new clsProfesor(); clsProfesor result; try { consulta.Dni = usuario; consulta.Contraseña = contraseña; List<clsProfesor> resultados = pmanager.SelectProfesor(consulta); if (resultados.Count() != 0) { result = resultados[0]; } else { return null; } } catch (Exception a) { throw (a); } return (result); }
public frmModificarDocente(clsProfesor Profesor) { InitializeComponent(); this.Profesor = Profesor; }
private void GuardarCambios() { if (tbNombre.Text != string.Empty && tbApellido.Text != string.Empty && tbDni.Text != string.Empty) { try { if (tbDni.Text.Length == 8) { Repo = RepoF.getRepositorio(RepoType.PROFESOR); clsProfesor ProfesorModificado = new clsProfesor(); ProfesorModificado.Id = Profesor.Id; ProfesorModificado.Nombre = tbNombre.Text; ProfesorModificado.Apellido = tbApellido.Text; ProfesorModificado.Dni = tbDni.Text; ProfesorModificado.Direccion = tbDireccion.Text; ProfesorModificado.Telefono = tbTelefono.Text; ProfesorModificado.Email = tbEmail.Text; ProfesorModificado.Contraseña = tbContraseña.Text; ProfesorModificado.Estado = Convert.ToInt32(ckbEstado.Checked); Repo.Actualizar(ProfesorModificado); Profesor = ProfesorModificado; tbUsuario.Text = ProfesorModificado.Dni; MessageBox.Show("Los cambios del alumno se guardaron correctamente", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Information); tbNombre.Focus(); } else { MessageBox.Show("Dni ingresado no valido ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); tbDni.Clear(); tbDni.Focus(); } } catch (Exception ex) { MessageBox.Show("Se produjo el siguiente error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); CargarTextBox(); tbNombre.Focus(); } } else { MessageBox.Show("Ingrese todos los datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); CargarTextBox(); } }
public IEntidad ObtenerPorId(int id) { clsProfesor profesor = new clsProfesor(); profesor.Id = id; clsProfesor nalumno = null; try { nalumno = manager.SelectProfesor(profesor)[0]; if (nalumno == null) { throw new ArgumentException("El profesor no existe"); } } catch (Exception e) { throw e; } return nalumno; }
public List<IEntidad> Lista(IEntidad filtro) { clsProfesor alumno = new clsProfesor(); List<IEntidad> list = new List<IEntidad>(); try { alumno = getCast(filtro); } catch (Exception e) { throw e; } try { list.AddRange(manager.SelectProfesor(alumno)); } catch (Exception e) { throw e; } return list; }
public int DeleteProfesor(clsProfesor entidad) { int filas; try { String query = "delete Profesores where IdProfesor = " + entidad.Id + ";"; filas = dbmanager.Ejecutar(query, Tipo.ELIMINAR); } catch (Exception e) { throw e; } return filas; }
public List<IEntidad> ListaProfesores(int idCurso) { List<IEntidad> LPro = new List<IEntidad>(); try { foreach (DataRow r in manager.ListaProfesores(idCurso).Rows) { clsProfesor Profesor = new clsProfesor(); Profesor.Id = Convert.ToInt32(r["IdProfesor"]); Profesor.Dni = Convert.ToString(r["Dni"]); Profesor.Nombre = Convert.ToString(r["Nombre"]); Profesor.Apellido = Convert.ToString(r["Apellido"]); Profesor.Direccion = Convert.ToString(r["Direccion"]); Profesor.Telefono = Convert.ToString(r["Telefono"]); Profesor.Email = Convert.ToString(r["Email"]); Profesor.Estado = Convert.ToInt32(r["Estado"]); LPro.Add(Profesor); } } catch (Exception e) { throw e; } return LPro; }
public frmQuitarAsignacionDocentes(clsProfesor Profesor) { InitializeComponent(); this.Profesor = Profesor; }
public int InsertarProfesor(clsProfesor entidad) { int filas; try { string query = "insert into Profesores values('" + entidad.Nombre + "','" + entidad.Apellido + "','" + entidad.Dni + "','" + entidad.Telefono + "','" + entidad.Contraseña + "','" + entidad.Estado + "','" + entidad.Direccion + "','" + entidad.Email + "');"; filas = dbmanager.Ejecutar(query, Tipo.INSERTAR); } catch (Exception e) { throw e; } return filas; }