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)); }
public List <Project> GetAllProjectsForMe() { // Get only Projects to which i am added var employee = _employeeRepository.GetBy(u => u.UserId == WebUser.Id, "User,User.Person,ReportingPerson.User.Person,Manager.User.Person,Location,Department,Designation,Shift"); var myProjects = _projectMemberRepository.GetAllBy(m => m.EmployeeId == employee.Id, "Project").Select(m => m.Project).ToList(); // Get all public Projects var publicProjects = _projectRepository.GetAllBy(p => p.IsPublic).ToList(); // Merge public to this list foreach (var pp in publicProjects) { if (myProjects.All(p => p.Id != pp.Id)) { myProjects.Add(pp); } } return(myProjects); }
public ActionResult GetAllProjectsForTimeSheet() { // Get only Projects to which i am added var employee = _employeeRepository.GetBy(u => u.UserId == WebUser.Id, "User,User.Person"); var myProjects = _projectMemberRepository.GetAllBy(m => m.EmployeeId == employee.Id && m.MemberStatus == MemberStatus.Active, "Project").Select(m => m.Project).ToList(); var getOnlyOpenProjects = myProjects.Where(p => !(p.Status == ProjectStatus.Cancelled || p.Status == ProjectStatus.Closed)).ToList(); // Get all public Projects var publicProjects = _projectRepository.GetAllBy(p => p.IsPublic && !(p.Status == ProjectStatus.Cancelled || p.Status == ProjectStatus.Closed)).ToList(); // Merge public to this list foreach (var pp in publicProjects) { if (getOnlyOpenProjects.All(p => p.Id != pp.Id)) { getOnlyOpenProjects.Add(pp); } } return(Json(getOnlyOpenProjects, JsonRequestBehavior.AllowGet)); }
public ActionResult GetAllProjectsForTimeSheet() { // Get only Projects to which i am added var employee = _employeeRepository.GetBy(u => u.UserId == WebUser.Id, "User,User.Person,ReportingPerson.User.Person,Manager.User.Person,Location,Department,Designation,Shift"); var myProjects = _projectMemberRepository.GetAllBy(m => m.EmployeeId == employee.Id, "Project").Select(m => m.Project).ToList(); var selectItems = myProjects.Select(p => new SelectItem { Id = p.Id, Title = p.Title }); return(Json(selectItems, JsonRequestBehavior.AllowGet)); }
public ActionResult Leaves(EventDataFilter vm) { // Restrict to Members of the Project var employee = _employeeRepository.GetBy(u => u.UserId == WebUser.Id, "User,User.Person,ReportingPerson.User.Person,Manager.User.Person,Location,Department,Designation,Shift"); var members = _projectMemberRepository.GetAllBy(m => m.ProjectId == vm.id).Select(m => m.EmployeeId).Distinct().ToList(); Func <IQueryable <Leave>, IQueryable <Leave> > leaveFilter = q => { q = q.Include("CreatedByUser.Person").Where(p => members.Contains(p.CreatedByUserId)); if (vm.start.HasValue) { q = q.Where(t => t.Start >= vm.start.Value); } if (vm.start.HasValue) { q = q.Where(t => t.End <= vm.end.Value); } q = q.OrderByDescending(c => c.CreatedOn); return(q); }; var payload = _leaveRepository.Search(leaveFilter).ToList().Select(h => new EventData { id = h.Id, allDay = true, title = $"{h.CreatedByUser.Person.Name} - Leave - {h.Status}", start = h.Start.ToString("s"), end = h.End.ToString("s") }).ToList(); return(Json(payload, JsonRequestBehavior.AllowGet)); }
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)); }