Example #1
0
        private void InitializeEmpSkillsReportPage(EmployeeSkillsReportViewModel viewModel)
        {
            viewModel.FilterTypeDropDownItems = new List <SelectListItem>
            {
                new SelectListItem
                {
                    Text  = "Project Account",
                    Value = "acc"
                },
                new SelectListItem
                {
                    Text  = "Project Name",
                    Value = "prj"
                },
                new SelectListItem
                {
                    Text  = "Allocation Type",
                    Value = "allc"
                },
                new SelectListItem
                {
                    Text  = "Employee Name",
                    Value = "emp"
                },
                new SelectListItem
                {
                    Text  = "Tech. SKills",
                    Value = "techs"
                },
                new SelectListItem
                {
                    Text  = "Employee ID",
                    Value = "eid"
                },
                new SelectListItem
                {
                    Text  = "Total Experience",
                    Value = "tot",
                },
                new SelectListItem
                {
                    Text  = "Project Manager",
                    Value = "pm"
                },
                new SelectListItem
                {
                    Text  = "Reporting Manager",
                    Value = "RM"
                }
            };

            if (string.IsNullOrEmpty(viewModel.FilterBy) == false && Session["FilterValueListItems"] != null)
            {
                viewModel.FilterValueDropDownItems = (List <SelectListItem>)Session["FilterValueListItems"];
            }
        }
Example #2
0
        public ActionResult GetEmpSkillsReport(string filterBy, int?filterValue, string filterText = "", int page = 1)
        {
            EmployeeSkillsReportViewModel viewModel = new EmployeeSkillsReportViewModel()
            {
                FilterBy    = filterBy,
                FilterValue = filterValue,
                FilterText  = filterText,
            };

            try
            {
                InitializeEmpSkillsReportPage(viewModel);

                viewModel.PagingInfo = new PagingInfo
                {
                    TotalRecordsCount = 0,
                    RecordsPerPage    = RecordsPerPage,
                    CurentPageNo      = page
                };

                viewModel.PagingInfo.TotalRecordsCount = techService.GetEmployeeSkillsReportCount(filterBy, filterValue.HasValue ? filterValue.Value.ToString() : "", filterText);
                if (viewModel.PagingInfo.TotalRecordsCount > 0)
                {
                    List <EmployeeSkillsReportDto> empSkillsDto = techService.GetEmployeeSkillsReport(filterBy, filterValue.HasValue ? filterValue.Value.ToString() : "", filterText, RecordsPerPage, page);
                    var empReport = Mapper.Map <List <EmployeeSkillsReportDto>, List <EmployeeSkillsReportModel> >(empSkillsDto);
                    foreach (var model in empReport)
                    {
                        float overallExp = 0;
                        if (model.PastExperience.HasValue)
                        {
                            overallExp = model.PastExperience.Value + ((float)DateTime.Today.Subtract(model.DateOfJoin).TotalDays / 365);
                        }
                        else
                        {
                            overallExp = (float)DateTime.Today.Subtract(model.DateOfJoin).TotalDays / 365;
                        }
                        model.OverallExperience = string.Format("{0:0.0}", overallExp);
                    }
                    viewModel.EmployeeSkillsReports = empReport;
                }
                else
                {
                    DisplayWarningMessage("No records to display");
                }
            }
            catch (Exception exp)
            {
                DisplayLoadErrorMessage(exp);
            }

            return(View(viewModel));
        }