public T004_SEMANA buscarSemana() { RepositoryT004_SEMANA _semana = new RepositoryT004_SEMANA(); return(_semana.ObterTodos().Where(x => x.T004_DT_INICIO <= DateTime.Now.Date && x.T004_DT_FIM >= DateTime.Now.Date).FirstOrDefault()); }
public ActionResult carregaForm(int?COORDENACAO) { IEnumerable <VW001_INFORME_ATUAL> viewInforme = new List <VW001_INFORME_ATUAL>(); IEnumerable <T002_INFORME> informe = new List <T002_INFORME>(); RepositoryT002_INFORME _dbInforme = new RepositoryT002_INFORME(); RepositoryVW001_INFORME_ATUAL _dbVwInforme = new RepositoryVW001_INFORME_ATUAL(); RepositoryT004_SEMANA _semana = new RepositoryT004_SEMANA(); string competencia = _semana.ObterTodos().OrderByDescending(x => x.T004_ID_SEMANA).FirstOrDefault().T004_COMPETENCIA; var semana = _semana.ObterTodos().Where(x => x.T004_DT_FIM >= DateTime.Now.Date).FirstOrDefault().T004_NR_SEMANA_MES; ViewBag.coord = COORDENACAO; ViewBag.Mat = "DESKTOP-FABIA"; ViewBag.comp = competencia; ViewBag.semana = semana; informe = _dbInforme.ObterTodos(); informe = informe.Where(i => i.T004_NR_SEMANA == semana && i.T003_ID_COORDENACAO == COORDENACAO && i.T002_COMPETENCIA == competencia).Take(2); viewInforme = _dbVwInforme.ObterTodos().Where(i => i.T003_ID_COORDENACAO == COORDENACAO).OrderByDescending(i => i.T002_ID_INFORME).Take(2); return(View("_carregaForm", viewInforme)); }