public static bool realizarSolicitacao(int TurmaId, int ProfessorId, int HorarioId, DateTime dtInicio, DateTime dtFim, out string lMensagens, List <Sala> pSalas, int UsuarioId) { lMensagens = ""; var lReservas = ReservaSalaBLL.Listar(); bool reserved = false; foreach (var item in pSalas) { if (lReservas.Count(x => x.Sala.Id == item.Id && x.HorarioAula.Id == HorarioId && x.PeriodoInicial >= dtInicio && x.PeriodoFim <= dtInicio) == 0) { // Sala pode ser reservada IncluirSolicitacao(item, UsuarioId, HorarioId, dtInicio, dtFim, TurmaId); reserved = true; lMensagens = "Solicitação Realizada para a Sala " + item.Descricao + ""; break; } } return(reserved); }
private void PopularGrid() { // IList<ReservaSala> lReservas = new List<ReservaSala>(); var lReservasAux = ReservaSalaBLL.Listar().ToList(); if (ddlDisciplina.SelectedValue != "0") { lReservasAux = lReservasAux.Where(x => x.Turma.Disciplina.Id == Convert.ToInt32(ddlDisciplina.SelectedValue)) .ToList(); } if (ddlProfessor.SelectedValue != "0") { lReservasAux = lReservasAux.Where(x => x.Turma.Professor.Id == Convert.ToInt32(ddlProfessor.SelectedValue)) .ToList(); } if (ddlTurma.SelectedValue != "0") { lReservasAux = lReservasAux.Where(x => x.Turma.Id == Convert.ToInt32(ddlTurma.SelectedValue)) .ToList(); } gdvReservas.DataSource = lReservasAux; gdvReservas.DataBind(); }
private void PopularGrid() { var lReservasAux = ReservaSalaBLL.Listar().ToList(); if (!String.IsNullOrEmpty(Session["UsuarioId"].ToString())) { gdvReservas.DataSource = lReservasAux.Where(x => x.Turma.Professor.Id == Convert.ToInt32(Session["UsuarioId"])); } else { gdvReservas.DataSource = lReservasAux; } gdvReservas.DataBind(); }