public async Task <IHttpActionResult> GetEmployeedReport(string groupNum, DateTime periodBegin, DateTime periodEnd) { var watch = System.Diagnostics.Stopwatch.StartNew(); EmployerReportEntity DistinctgroupList = await _employerReportBusiness.GetEmployerReportList(groupNum, periodBegin, periodEnd); watch.Stop(); if (DistinctgroupList != null) { DistinctgroupList.ExecutionTime = Math.Round(TimeSpan.FromMilliseconds(watch.ElapsedMilliseconds).TotalSeconds, 2); } return(Json(DistinctgroupList)); }
public async Task <EmployerReportEntity> GetEmployerReportList(string groupNum, DateTime periodBegin, DateTime periodEnd) { try { using (var connection = dbConnection.Database.Connection) { if (connection != null && connection.State != ConnectionState.Open) { await connection.OpenAsync(); } DbCommand command = connection.CreateCommand(); command.CommandText = Constants.EXEC + ConfigurationManager.AppSettings["PrsSchema"] + Constants.DOT + ConfigurationManager.AppSettings["GetEmployerReport"] + Constants.SPACE + Constants.Group_NUM + Constants.COMMA + Constants.PERIOD_BEGIN + Constants.COMMA + Constants.PERIOD_END; command.Parameters.AddRange(new[] { new SqlParameter { ParameterName = Constants.Group_NUM, Value = groupNum }, new SqlParameter { ParameterName = Constants.PERIOD_BEGIN, Value = periodBegin }, new SqlParameter { ParameterName = Constants.PERIOD_END, Value = periodEnd } }); command.CommandTimeout = 0; using (var reader = await command.ExecuteReaderAsync()) { if (reader.HasRows) { EmployerReport employerReport = new EmployerReport { TitlePage = await GetGroupReportAsync <TitlePage>(dbConnection, reader), FinancialSummary = await GetGroupReportAsync <FinancialSummary>(dbConnection, reader), PhmpEligibility = await GetGroupReportAsync <PhmpEligibility>(dbConnection, reader), ParticipantContacts = await GetGroupReportAsync <ParticipantContacts>(dbConnection, reader), RealTimeTelemed = await GetGroupReportAsync <RealTimeTelemed>(dbConnection, reader), DnaTesting = await GetGroupReportAsync <DnaTesting>(dbConnection, reader), RealTimeChoices = await GetGroupReportAsync <RealTimeChoices>(dbConnection, reader), RealTimeWellness = await GetGroupReportAsync <RealTimeWellness>(dbConnection, reader), RecentScreeningEventSummary = await GetGroupReportAsync <RecentScreeningEventSummary>(dbConnection, reader), ChronicConditions = await GetGroupReportAsync <ChronicConditions>(dbConnection, reader), HealthRiskAssessment = await GetGroupReportAsync <HealthRiskAssessment>(dbConnection, reader), HealthScreenings = await GetGroupReportAsync <HealthScreenings>(dbConnection, reader), IndemnityBenefit = await GetGroupReportAsync <IndemnityBenefit>(dbConnection, reader) }; connection.Close(); EmployerReportEntity groupEntitiesList = EntityMapper <EmployerReport, EmployerReportEntity> .MapEntity(employerReport); return(groupEntitiesList); } return(null); } } } catch { return(null); } }