/// <summary> /// Bring back Project Level information by the search project /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <IActionResult> DisplayProjectSearch(ProjectSearchInput input) { if (TempData.Peek("userName") == null) { return(UserNotAllowedAccess(isUserLoggedIn: false)); } if (TempData.Peek("userRole").ToString() == "Employee") { return(UserNotAllowedAccess(isUserLoggedIn: true)); } ProjectSearchDatabaseOutput result; var databaseInput = new ProjectSearchDatabaseInput { SearchedProject = input.SearchedProject }; try { result = await _IProjectManagerDomain.ProjectSearch(databaseInput); result.ChartData = result.GetIndividualHoursForChart(); } catch (Exception ex) { TempData.Add("ProjectSearchError", $"The project you searched for, {input.SearchedProject}, return no results. Please verify you have entered the correct Project Name or Project Code Name and try again."); return(RedirectTo("ProjectManager", "ProjectSearch")); } return(View(result)); }
public async Task ProjectSearch_ByProjectCodeName() { //Arrange var input = new ProjectSearchDatabaseInput { SearchedProject = "Paper" }; //Act var result = await _projectManagerRepository.ProjectSearch(input); //Assert Assert.NotNull(result); Assert.Equal("11/8/2018", result.ShortDate); }
public async Task <ProjectSearchDatabaseOutput> ProjectSearch(ProjectSearchDatabaseInput input) { var p = new DynamicParameters(); p.Add("@p_SearchedProject", input.SearchedProject); ProjectSearchDatabaseOutput output; using (IDbConnection connection = new SqlConnection(_connectionString)) { output = await connection.QueryFirstAsync <ProjectSearchDatabaseOutput>("sp_ProjectSearch", p, commandType : CommandType.StoredProcedure); } return(output); }
public async Task <ProjectSearchDatabaseOutput> ProjectSearch(ProjectSearchDatabaseInput input) { return(await _IProjectManagerRepository.ProjectSearch(input)); }