/// <summary> /// Process Upload files - Read data from excel and converts to business objects. /// Persists data to the database. /// </summary> /// <param name="filePath">File path</param> public void ProcessFile(string filePath) { var launchPadDetails = new List <LaunchPadDetail>(); ExtractDataFromExcel(filePath, launchPadDetails); try { if (launchPadDetails.Any()) { var lpManagementDataService = new LPManagementDataService(); lpManagementDataService.PersistLaunchPadDetails(launchPadDetails); } } catch (Exception ex) { throw ex; } }
/// <summary> /// Get launch pad details for the given filter criteria. /// </summary> /// <param name="location">Location</param> /// <param name="quarter">Quarter</param> /// <param name="status">Status</param> /// <param name="financialYear">Financial year</param> /// <param name="practice">Practice</param> /// <returns>List of LaunchPadDetails.</returns> public IEnumerable <LaunchPadDetail> GetLauchPadDetails(Location location, Quarter quarter, Status status, int financialYear, string practice) { var lastFourYears = financialYear - 4; var lpManagementDataService = new LPManagementDataService(); var launchPadDetails = lpManagementDataService.GetLaunchPadDetails() .ToList() .Where(x => x.FinancialYear >= lastFourYears && x.FinancialYear <= financialYear); if (location != Location.All) { launchPadDetails = launchPadDetails.Where(x => x.Location == location).ToList(); } if (practice != "All") { launchPadDetails = launchPadDetails.Where(x => x.Practice == practice).ToList(); } return(launchPadDetails); }
/// <summary> /// Gets launch pad details by launch pad code. /// </summary> /// <param name="launchPadCode">Launch pad code.</param> /// <returns>List of launch pad details.</returns> public LaunchPadSummary GetLaunchPadDetailsByLaunchPadCode(string launchPadCode) { var lpManagementDataService = new LPManagementDataService(); var launchPadDetails = lpManagementDataService.GetLaunchPadDetailsByLaunchPadCode(launchPadCode).ToList(); var totalNoOfLPCount = launchPadDetails.Count; var overallScoreAbove70PercentCount = launchPadDetails.Where(x => x.EmployeeScoreDetail.OverallScore >= 70).ToList().Count; var overallScore60To70PercentCount = launchPadDetails.Where(x => x.EmployeeScoreDetail.OverallScore >= 69 && x.EmployeeScoreDetail.OverallScore <= 60).ToList().Count; var overallScoreBelow60PercentCount = launchPadDetails.Where(x => x.EmployeeScoreDetail.OverallScore < 60).ToList().Count; var launchPadSummary = new LaunchPadSummary() { LaunchPadCode = launchPadCode, Status = launchPadDetails[0].Status, TotalNoOfLPCount = totalNoOfLPCount, OverallScoreAbove70PercentCount = overallScore60To70PercentCount, OverallScore60To70PercentCount = overallScore60To70PercentCount, OverallScoreBelow60PercentCount = overallScoreBelow60PercentCount }; return(launchPadSummary); }