Esempio n. 1
0
 async Task PrepareDropdownForEdit()
 {
     ViewBag.Organizations = new SelectList(
         await _sysAdminService.GetOrganiztions(),
         nameof(Organization.ID), nameof(Organization.Name));
     ViewBag.Specialties = new SelectList(
         await _sysAdminService.GetReferences(ReferenceTypeEnum.Specialty),
         nameof(Reference.ID), nameof(Reference.ReferenceValue));
 }
Esempio n. 2
0
        public async Task <IActionResult> References(ReferenceTypeEnum t)
        {
            ViewBag.ReferenceType = t;
            var model = await _sysAdminSvc.GetReferences(t);

            return(View(model));
        }
Esempio n. 3
0
        public async Task <IActionResult> ListEmployees(int?id, string msg)
        {
            if (!id.HasValue)
            {
                throw new Exception("必须传递项目的唯一ID");
            }

            var project = await _projectService.GetProjectById(id.Value);

            var employees = await _employeeService.GetEmployeesInProject(id.Value, false);

            var specialities = await _sysAdminService.GetReferences(ReferenceTypeEnum.Specialty);

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

            ViewBag.ProjectName = project.FullName;
            ViewBag.ProjectId   = id;
            var model = (from e in employees
                         select ProjEmployeeViewModel.Create(e, specialities)).ToArray();

            if (!string.IsNullOrWhiteSpace(msg))
            {
                ModelState.AddModelError("", msg);
            }
            return(View(model));
        }
Esempio n. 4
0
        internal static async Task WriteExcelReference(MemoryStream stream, ISysAdminService sysAdminService)
        {
            IWorkbook   workbook   = new XSSFWorkbook();
            IDataFormat dataformat = workbook.CreateDataFormat();
            ICellStyle  dateStyle  = workbook.CreateCellStyle();

            dateStyle.DataFormat = dataformat.GetFormat("yyyy-MM-dd");

            ISheet orgSheet  = workbook.CreateSheet("Organizations");
            ISheet specSheet = workbook.CreateSheet("Specialties");

            FullSheet <Entity.Organization>(await sysAdminService.GetOrganiztions(), orgSheet, dateStyle);
            FullSheet <Entity.Reference>(await sysAdminService.GetReferences(Entity.ReferenceTypeEnum.Specialty), specSheet, dateStyle);

            workbook.Write(stream);
        }
Esempio n. 5
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));
        }