예제 #1
0
        public async Task <IActionResult> EditReference(int id)
        {
            var reference = await _sysAdminSvc.GetReference(id);

            if (reference.Type == ReferenceTypeEnum.Duty)
            {
                return(RedirectToAction(nameof(EditDuty), new { id = id }));
            }

            RefViewMode model = await _sysAdminSvc.GetReference(id);

            if (model == null || model.ID <= 0)
            {
                ModelState.AddModelError("", "没有定位到要显示的参照项");
            }

            return(View(model));
        }
예제 #2
0
        public async Task <IActionResult> Resume(int id)
        {
            var employee = await _employeeService.GetEmployee(id);

            var qualifs = await _sysAdminService.GetReferences(ReferenceTypeEnum.Qualification);

            var model = new ResumeViewModel
            {
                ActiviteStatus     = employee.ActiveStatus,
                CurrentDutyName    = employee.DutyName,
                CurrentProjectName = employee.ProjectName,
                EmployeeID         = employee.ID,
                EmployeeName       = employee.Name,
                OrganizationName   = (await _sysAdminService.GetOrganiztion(employee.OrganizationID)).Name,
                SpecialtyName      = (await _sysAdminService.GetReference(employee.SpecialtyID)).ReferenceValue,
                Title          = employee.Title,
                Certifications = (await _employeeService.GetCertifications(id))
                                 .Select(c => CertViewModel.Create(c, employee, qualifs)).ToArray(),
                Logs = (from il in await _analysisService.GetStaffInLogs(id)
                        select new TransferLog
                {
                    Date = il.InDate,
                    FromDuty = "",
                    FromProject = "",
                    LogType = TransferLogType.In,
                    TimeStamp = il.CreatedOn,
                    ToProject = il.ProjectName,
                    ToDuty = il.DutyName,
                }).Union(
                    from ol in await _analysisService.GetStaffOutLogs(id)
                    select new TransferLog
                {
                    Date        = ol.OutDate,
                    FromDuty    = ol.DutyName,
                    FromProject = ol.ProjectName,
                    LogType     = TransferLogType.Out,
                    TimeStamp   = ol.CreatedOn,
                    ToProject   = "",
                    ToDuty      = "",
                }
                    ).OrderBy(l => l.Date).ThenBy(l => l.TimeStamp).ToArray(),
            };

            return(View(model));
        }