Esempio n. 1
0
 public IActionResult SaveKRAItems(EmployeeAssignViewModel model)
 {
     if (model.SelectedKeyResultAreas.Length > 0)
     {
         var items = new List <int>();
         for (int i = 0; i <= model.SelectedKeyResultAreas.Length - 1; i++)
         {
             items.Add(int.Parse(model.SelectedKeyResultAreas[i].ToString()));
         }
         _Services.SaveKRAItems(model.Employee.Id, items);
     }
     return(RedirectToAction("Assignment", new { id = model.Employee.Id }));
 }
Esempio n. 2
0
        public IActionResult Assignment(int id)
        {
            var _employee = _Services.EmployeeById(id);
            var employee  = new EmployeeViewModel
            {
                Id         = _employee.Id,
                EmployeeNo = _employee.EmployeeNo,
                Name       = _employee.LastName + ", " + _employee.FirstName + " " + _employee.MiddleName,
                Company    = _employee.Company.Description,
                Branch     = _employee.Branch.Description,
                Category   = _employee.Category.Description,
                Department = _employee.Department.Description,
                Position   = _employee.Position.Description,
            };

            var kralist        = new List <AssignedKeyResultViewModel>();
            var behaviorallist = new List <AssignedBehavioralViewModel>();
            var header         = _Services.EmployeeAssignmentByEmployeeId(id);

            if (header != null)
            {
                var kra = _Services.EmployeeKRAAssignmentByHeaderId(header.Id)
                          .Select(a => new AssignedKeyResultViewModel
                {
                    Id          = a.Id,
                    Title       = a.KeyResultArea.Title,
                    Description = a.KeyResultArea.Description,
                    Weight      = a.KeyResultArea.Weight
                }).ToList();
                kralist = kra;
                var behavioral = _Services.EmployeeBehavioralAssignmentByHeaderId(header.Id)
                                 .Select(a => new AssignedBehavioralViewModel
                {
                    Id          = a.Id,
                    Title       = a.BehavioralFactor.Title,
                    Description = a.BehavioralFactor.Description,
                    Weight      = a.BehavioralFactor.Weight
                }).ToList();
                behaviorallist = behavioral;
            }
            var kraitems = _Services.GetAvailableKRA(id)
                           .Select(a => new KeyResultAreaViewModel
            {
                Id    = a.Id,
                Title = a.Title,
            }).ToList();
            var bfitems = _Services.GetAvailableBehavioral(id)
                          .Select(a => new BehavioralFactorViewModel
            {
                Id    = a.Id,
                Title = a.Title,
            }).ToList();

            var aes    = _Services.ActiveSeason();
            var season = new EvaluationSeasonItem();

            if (aes != null)
            {
                season.Id        = aes.Id;
                season.Title     = aes.Title;
                season.Remarks   = aes.Remarks;
                season.StartDate = aes.StartDate;
                season.EndDate   = aes.EndDate;
            }
            ;


            var model = new EmployeeAssignViewModel
            {
                Employee = employee,
                AssignedBehavioralItems = behaviorallist,
                AssignedKeyResultsItems = kralist,
                BehavioralFactors       = bfitems,
                KeyResultAreas          = kraitems,
                IsWithActiveSeason      = _Services.IsWithActiveSeason(),
                ActiveSeason            = season,
            };

            return(View(model));
        }