示例#1
0
        public ActionResult Index()
        {
            var user     = _userRepository.GetBy(u => u.Id == WebUser.Id, "Person,AccessRule,ReportingPerson.Person,Manager.Person,Location,Department,Designation,Shift");
            var employee = _employeeRepository.GetBy(u => u.UserId == WebUser.Id, "User,User.Person,ReportingPerson.User.Person,Manager.User.Person,Location,Department,Designation,Shift");

            var userDocs           = _userDocumentRepository.GetAllBy(m => m.UserId == user.Id);
            var userSkills         = _userSkillRepository.GetAllBy(m => m.UserId == user.Id, "Skill");
            var userHobbies        = _userHobbyRepository.GetAllBy(m => m.UserId == user.Id, "Hobby");
            var userCertifications = _userCertificationRepository.GetAllBy(m => m.UserId == user.Id, "Certification");

            var roleMembers  = _roleMemberRepository.GetAllBy(m => m.UserId == user.Id, "Role").ToList();
            var assets       = _assetRepository.GetAllBy(u => u.AllocatedEmployeeId == user.Id, "AssetCategory").ToList();
            var projects     = _projectMemberRepository.GetAllBy(p => p.EmployeeId == user.Id, "Project").ToList();
            var technologies = _userTechnologyMapRepository.GetAllBy(r => r.UserId == user.Id, "Technology").Select(t => t.Technology).ToList();
            //var emergencyContacts = _emergencyContactRepository.GetAllBy(c => c.UserId == user.Id).ToList();
            //var dependants = _employeeDependentRepository.GetAllBy(d => d.UserId == user.Id).ToList();
            var reportees = _userRepository.GetAllBy(u => u.EmployeeStatus != EmployeeStatus.Ex && u.ReportingPersonId == WebUser.Id, "Person,Designation,AccessRule").ToList();
            var tokens    = _tokenRepository.GetAllBy(t => t.AllocatedToUserId == user.Id).ToList();
            var awards    = _userAwardRepository.GetAllBy(u => u.UserId == user.Id, "Award").ToList();

            ViewBag.WebuserId = employee.Id;
            var userViewModel = new UserViewModel(user)
            {
                UserDocuments      = userDocs.ToList(),
                UserSkills         = userSkills.ToList(),
                UserCertifications = userCertifications.ToList(),
                RoleMembers        = roleMembers.ToList(),
                //Projects = projects.ToList(),
                Technologies = technologies,
                //EmergencyContacts = emergencyContacts.ToList(),
                //EmployeeDependents = dependants.ToList(),
                Reportees = reportees,
                //Tokens = tokens,
                UserHobbies = userHobbies.ToList(),
                UserAwards  = awards
            };

            var linkedAccounts = _linkedAccountRepository.GetAllBy(u => u.UserId == user.Id).ToList();

            userViewModel.LinkedAccounts = linkedAccounts.ToList();

            // If we have snapshots, set snapshot variable
            var snapshot = _systemSnapshotRepository.GetBy(s => s.UserId == user.Id);

            if (snapshot != null)
            {
                userViewModel.HasSoftwareInfo = true;
                userViewModel.Softwares       = JsonConvert.DeserializeObject <List <SoftwareModel> >(snapshot.Softwares);

                userViewModel.HasHardwareInfo = true;
                userViewModel.Hardware        = JsonConvert.DeserializeObject <HardwareModel>(snapshot.Hardwares);
            }

            return(View(userViewModel));
        }
示例#2
0
        public ActionResult UserProfile(int id)
        {
            var user = _userRepository.Get(id, "Person,AccessRule,ReportingPerson.Person,Location,Department,Designation,Shift");

            if (user == null)
            {
                return(HttpNotFound());
            }

            var userSkills         = _userSkillRepository.GetAllBy(m => m.UserId == user.Id, "Skill");
            var userHobbies        = _userHobbyRepository.GetAllBy(m => m.UserId == user.Id, "Hobby");
            var userCertifications = _userCertificationRepository.GetAllBy(m => m.UserId == user.Id, "Certification");
            var technologies       = _userTechnologyMapRepository.GetAllBy(r => r.UserId == user.Id, "Technology").Select(t => t.Technology).ToList();
            var awards             = _userAwardRepository.GetAllBy(u => u.UserId == user.Id, "Award").ToList();

            var userViewModel = new UserViewModel
            {
                Id                 = user.Id,
                EmployeeCode       = user.EmployeeCode,
                AccessRuleId       = user.AccessRuleId,
                AccessRule         = user.AccessRule,
                PersonId           = user.PersonId,
                Person             = user.Person,
                DepartmentId       = user.DepartmentId,
                Department         = user.Department,
                LocationId         = user.LocationId,
                Location           = user.Location,
                DesignationId      = user.DesignationId,
                Designation        = user.Designation,
                ShiftId            = user.ShiftId,
                Shift              = user.Shift,
                ReportingPersonId  = user.ReportingPersonId,
                ReportingPerson    = user.ReportingPerson,
                DateOfJoin         = user.DateOfJoin,
                OfficialEmail      = user.OfficialEmail,
                UserSkills         = userSkills.ToList(),
                UserCertifications = userCertifications.ToList(),
                Technologies       = technologies,
                UserHobbies        = userHobbies.ToList(),
                UserAwards         = awards
            };

            return(View(userViewModel));
        }
示例#3
0
        public ActionResult Details(int id)
        {
            var user = _userRepository.Get(id, "Person,AccessRule,ReportingPerson.Person, Manager.Person, Location,Department,Designation,Shift");

            if (user == null)
            {
                return(HttpNotFound());
            }

            var userDocs           = _userDocumentRepository.GetAllBy(m => m.UserId == user.Id);
            var userSkills         = _userSkillRepository.GetAllBy(m => m.UserId == user.Id, "Skill");
            var userHobbies        = _userHobbyRepository.GetAllBy(m => m.UserId == user.Id, "Hobby");
            var userCertifications = _userCertificationRepository.GetAllBy(m => m.UserId == user.Id, "Certification");
            var roleMembers        = _roleMemberRepository.GetAllBy(m => m.UserId == user.Id, "Role");
            var assets             = _assetRepository.GetAllBy(u => u.AllocatedEmployeeId == user.Id, "AssetCategory").ToList();
            //var leaveEntitlements = _leaveEntitlementRepository.GetAllBy(u => u.AllocatedUserId == user.Id, "LeaveType").ToList();
            var projects     = _projectMemberRepository.GetAllBy(p => p.EmployeeId == user.Id, "Project,Member").ToList();
            var technologies = _userTechnologyMapRepository.GetAllBy(r => r.UserId == user.Id, "Technology").Select(t => t.Technology).ToList();
            //var emergencyContacts = _emergencyContactRepository.GetAllBy(c => c.UserId == user.Id);
            //var dependants = _employeeDependentRepository.GetAllBy(d => d.UserId == user.Id);
            var reportees = _userRepository.GetAllBy(u => u.EmployeeStatus != EmployeeStatus.Ex && u.ReportingPersonId == user.Id, "Person,Designation,AccessRule").ToList();
            var tokens    = _tokenRepository.GetAllBy(t => t.AllocatedToUserId == user.Id).ToList();
            var awards    = _userAwardRepository.GetAllBy(u => u.UserId == user.Id, "Award").ToList();

            var userViewModel = new UserViewModel
            {
                Id                 = user.Id,
                EmployeeCode       = user.EmployeeCode,
                Username           = user.Username,
                AccessRuleId       = user.AccessRuleId,
                AccessRule         = user.AccessRule,
                PersonId           = user.PersonId,
                Person             = user.Person,
                DepartmentId       = user.DepartmentId,
                Department         = user.Department,
                LocationId         = user.LocationId,
                Location           = user.Location,
                DesignationId      = user.DesignationId,
                Designation        = user.Designation,
                ShiftId            = user.ShiftId,
                Shift              = user.Shift,
                ReportingPersonId  = user.ReportingPersonId,
                ReportingPerson    = user.ReportingPerson,
                ManagerId          = user.ManagerId,
                Manager            = user.Manager,
                Experience         = user.Experience,
                DateOfJoin         = user.DateOfJoin,
                ConfirmationDate   = user.ConfirmationDate,
                LastDate           = user.LastDate,
                DateOfResignation  = user.DateOfResignation,
                OfficialEmail      = user.OfficialEmail,
                EmployeeStatus     = user.EmployeeStatus,
                RequiresTimeSheet  = user.RequiresTimeSheet,
                Salary             = user.Salary,
                Bank               = user.Bank,
                BankAccountNumber  = user.BankAccountNumber,
                PANCard            = user.PANCard,
                PaymentMode        = user.PaymentMode,
                UserDocuments      = userDocs.ToList(),
                UserSkills         = userSkills.ToList(),
                UserCertifications = userCertifications.ToList(),
                RoleMembers        = roleMembers.ToList(),
                //Assets = assets.ToList(),
                //LeaveEntitlements = leaveEntitlements.ToList(),
                //Projects = projects.ToList(),
                Technologies = technologies,
                //EmergencyContacts = emergencyContacts.ToList(),
                //EmployeeDependents = dependants.ToList(),
                Reportees = reportees,
                //Tokens = tokens,
                UserHobbies = userHobbies.ToList(),
                UserAwards  = awards
            };

            // If we have snapshots, set snapshot variable
            var snapshot = _systemSnapshotRepository.GetBy(s => s.UserId == user.Id);

            if (snapshot != null)
            {
                userViewModel.HasSoftwareInfo = true;
                userViewModel.Softwares       = JsonConvert.DeserializeObject <List <SoftwareModel> >(snapshot.Softwares);

                userViewModel.HasHardwareInfo = true;
                userViewModel.Hardware        = JsonConvert.DeserializeObject <HardwareModel>(snapshot.Hardwares);
            }

            return(View(userViewModel));
        }