public ActionResult EmployeesDashboard()
        {
            ResourceCountModel model = new ResourceCountModel();

            try
            {
                ResourceCountDto dto = empService.GetEmployeesCountSummary();
                model = Mapper.Map <ResourceCountDto, ResourceCountModel>(dto);
            }
            catch (Exception exp) { }
            return(PartialView(model));
        }
Esempio n. 2
0
        public ResourceCountDto GetEmployeesCountSummary()
        {
            ResourceCountDto dto = new ResourceCountDto
            {
                TotalCount = (from e in Entities
                              where e.IsDeleted == false &&
                              (e.LastWorkingDay.HasValue == false || (e.LastWorkingDay.HasValue && e.LastWorkingDay.Value >= DateTime.Today))
                              select e).Count(),
                DeliveryCount = GetEmployeesCountByBU(BusinessUnit.Delivery),
                BoCount       = GetEmployeesCountByBU(BusinessUnit.BusinessOperations),
                BdCount       = GetEmployeesCountByBU(BusinessUnit.BusinessDevelopment),
            };

            return(dto);
        }
        private string GenerateEmailBody(string templateFilePath)
        {
            logger.Info("Generating email body");
            List <BillabilityWiseAllocationSummaryDto> allocationSummary = allocationService.GetBillabilityWiseAllocationSummary().ToList();
            ResourceCountDto dto = empService.GetEmployeesCountSummary();
            string           emailTemplateContent = FilesHandler.GetFileContent(templateFilePath);
            StringBuilder    emailBody            = new StringBuilder(emailTemplateContent);

            emailBody.Replace("__TODAY__", DateTime.Today.Year.ToString() + "/" + DateTime.Today.Month + "/" + DateTime.Today.Day);
            emailBody.Replace("__TOTAL_COUNT__", dto.TotalCount.ToString());
            emailBody.Replace("__DELIVERY_COUNT__", dto.DeliveryCount.ToString());
            emailBody.Replace("__BD_COUNT__", dto.BdCount.ToString());
            emailBody.Replace("__BO_COUNT__", dto.BoCount.ToString());
            emailBody.Replace("__BILLABLE__", allocationSummary.FirstOrDefault(e => e.AllocationType == "Billable")?.NumberOfEmployees.ToString());
            emailBody.Replace("__COMMITED_BUFFER__", allocationSummary.FirstOrDefault(e => e.AllocationType == "Committed Buffer")?.NumberOfEmployees.ToString());
            emailBody.Replace("__NON_COMMITED_BUFFER__", allocationSummary.FirstOrDefault(e => e.AllocationType == "Non-Committed Buffer")?.NumberOfEmployees.ToString());
            emailBody.Replace("__NOT_ALLOCATED_YET_DELIVERY__", allocationSummary.FirstOrDefault(e => e.AllocationType == "Not Allocated - Delivery")?.NumberOfEmployees.ToString());
            emailBody.Replace("__NOT_ALLOCATED_YET_OTHERS__", allocationSummary.FirstOrDefault(e => e.AllocationType == "BD & BO")?.NumberOfEmployees.ToString());
            emailBody.Replace("__BENCH_AVAILABLE__", allocationSummary.FirstOrDefault(e => e.AllocationType == "Bench (Available)")?.NumberOfEmployees.ToString());
            emailBody.Replace("__BENCH_EARMARKED__", allocationSummary.FirstOrDefault(e => e.AllocationType == "Bench (Earmarked)")?.NumberOfEmployees.ToString());
            return(emailBody.ToString());
        }