Beispiel #1
0
        //
        // GET: /SalaryReviewAnalysis/Details/5
        public ActionResult Details(string referenceNumber)
        {
            var viewModel = SalaryReviewAnalysisEditorViewModel.Create(Repository, null, null, referenceNumber, GetUser());

            if (viewModel == null)
            {
                return(RedirectToAction("Index"));
            }

            return(View(viewModel));
        }
Beispiel #2
0
        //
        // GET: /SalaryReviewAnalysis/Create?NewSraEmployee=2749660017247
        public ActionResult Create(string newSraEmployee)
        {
            var viewModel = SalaryReviewAnalysisEditorViewModel.Create(Repository, newSraEmployee, GetUser());

            //viewModel.NewSraEmployee = Repository.OfType<Employee>()
            //    .Queryable
            //    .Where(e => e.id.Equals(newSraEmployee))
            //        .FirstOrDefault();

            return(View(viewModel));
        }
Beispiel #3
0
        //
        // GET: /SalaryReviewAnalysis/Edit?ReferenceNumber=20100323147
        //public ActionResult CreateEdit(string referenceNumber)
        public ActionResult CreateEdit(string newSraEmployee, string proposedTitle, string referenceNumber)
        {
            var user = GetUser();

            //var viewModel = SalaryReviewAnalysisEditorViewModel.Create(Repository, null, null, referenceNumber);
            var viewModel = SalaryReviewAnalysisEditorViewModel.Create(Repository, newSraEmployee, proposedTitle, referenceNumber, user);

            if (viewModel.SalaryReviewAnalysis == null)
            {
                return(RedirectToAction("Index"));
            }

            // Logic to set possible OriginatingDepartments
            viewModel.IsDepartmentUser = IsDepartmentUser;

            var allSchoolDepartments = Department.GetAllForUser(Repository, user, false, "Name", true);

            if (IsDepartmentUser)
            {
                var usersUnits = user.Units.Select(u => u.PPSCode).ToArray();

                viewModel.PossibleOriginatingDepartments = allSchoolDepartments
                                                           .Where(x => usersUnits.Contains(x.Id))
                                                           .ToList();
            }
            else
            {
                // All school departments for Dean's Office User:
                viewModel.PossibleOriginatingDepartments = allSchoolDepartments;
            }

            if (String.IsNullOrEmpty(viewModel.SalaryReviewAnalysis.ReferenceNumber))
            {
                if (user != null)
                {
                    viewModel.SalaryReviewAnalysis.OriginatingDepartment   = Department.GetOriginatingDepartmentForUser(Repository, user.EmployeeID);
                    viewModel.SalaryReviewAnalysis.InitiatedByReviewerName = user.FullName;
                }
            }

            //var salaryReviewAnalysis = _salaryReviewAnalysisRepository.GetNullableById(id);

            //if (viewModel.SalaryReviewAnalysis == null) return RedirectToAction("Index");

            //var viewModel = SalaryReviewAnalysisViewModel.Create(Repository);
            //viewModel.SalaryReviewAnalysis = salaryReviewAnalysis;

            return(View(viewModel));
        }