public void ProjectAllocationThrowsError() { var client = new TargetProcessClient { ApiSiteInfo = new ApiSiteInfo(TargetProcessRoutes.Route.ProjectAllocations) }; var projectAllocation = new ProjectAllocation { }; }
public async Task <IActionResult> Post([FromBody] ProjectAllocationDTO dto) { var projectAllocation = new ProjectAllocation(dto.ProjectId, dto.EmployeeId, dto.PercentageAllocation); if (projectAllocation.IsValid()) { await this._projectAllocationService.Add(projectAllocation); return(CreatedAtAction(nameof(this.Get), new { id = projectAllocation.Id }, projectAllocation)); } return(BadRequest()); }
public int CreateProjectAllocation(ProjectAllocation allocationInfo) { try { _context.ProjectAllocation.Add(allocationInfo); _context.SaveChanges(); } catch (Exception ex) { } return(allocationInfo.AllocationId); }
public void AlllocateProject(ProjectAllocation projectAllocation) { try { db.ProjectAllocations.Add(projectAllocation); db.SaveChanges(); Console.WriteLine("Record Inserted....."); } catch (Exception e) { Console.WriteLine(e.Message); } }
public IEnumerable <EmpAndAllocationDto> GetAllEmployeesWithAllocationDetails() { List <EmpAndAllocationDto> emps = (from emp in Entities join rm in Entities on emp.ReportingManagerID equals rm.EmployeeEntryID into rme from rmd in rme.DefaultIfEmpty() where emp.IsDeleted == false && emp.LastWorkingDay.HasValue == false || (emp.LastWorkingDay.HasValue == true && emp.LastWorkingDay.Value >= DateTime.Today) orderby emp.EmployeeID select new EmpAndAllocationDto { EmployeeEntryID = emp.EmployeeEntryID, EmployeeID = emp.EmployeeID, EmployeeName = emp.FirstName + " " + emp.LastName, EmploymentType = DataContext.DropDownSubCategories.FirstOrDefault(s => s.SubCategoryID == emp.EmploymentTypeID).SubCategoryName, BusinessUnit = DataContext.DropDownSubCategories.FirstOrDefault(s => s.SubCategoryID == emp.BusinessUnitID).SubCategoryName, PrimarySkills = emp.PrimarySkills, VisaCategory = emp.VisaCategoryID.HasValue ? DataContext.DropDownSubCategories.FirstOrDefault(s => s.SubCategoryID == emp.VisaCategoryID).SubCategoryName : "", VisaValidUpto = emp.VisaValidUpto, PastExperience = emp.PastExperience, ProjectManager = "", ReportingManager = rmd.FirstName + " " + rmd.LastName, DateOfJoin = emp.DateOfJoin, }).Distinct().ToList(); foreach (EmpAndAllocationDto emp in emps) { EmpAssetDetail asset = DataContext.EmpAssetDetails.FirstOrDefault(ea => ea.EmployeeEntryID == emp.EmployeeEntryID); emp.PrimarySkills = asset?.PrimarySkills + ";" + asset?.SecondarySkills; emp.PastExperience = asset?.PastExperience; DateTime today = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day); ProjectAllocation allocation = DataContext.ProjectAllocations.Where(pa => pa.EmployeeID == emp.EmployeeEntryID && pa.IsDeleted == false && pa.AllocationEndDate >= today).OrderByDescending(al => al.AllocationEndDate).FirstOrDefault(); if (allocation != null) { Project project = DataContext.Projects.FirstOrDefault(e => e.ProjectID == allocation.ProjectID && e.IsDeleted == false); if (project != null) { emp.ProjectName = project.ProjectName; Employee pm = Entities.FirstOrDefault(e => e.EmployeeEntryID == project.ProjectManagerID); emp.ProjectManager = $"{pm?.FirstName} {pm?.LastName}"; } DropDownSubCategory allType = DataContext.DropDownSubCategories.FirstOrDefault(s => s.IsDeleted == false && s.SubCategoryID == allocation.AllocationTypeID); emp.AllocationStartDate = allocation.AllocationStartDate; emp.AllocationEndDate = allocation.AllocationEndDate; } } return(emps); }
public async Task <IActionResult> AllocateProjectToEmployee([FromBody] ProjectAllocation allocationInfo) { if (ModelState.IsValid) { try { var allocationId = _projectService.AllocateProjectToEmployee(allocationInfo); if (allocationId > 0) { return(Ok(allocationId)); } else { return(NotFound()); } } catch (Exception) { return(BadRequest()); } } return(BadRequest()); }
public BatchViewModel(ProjectAllocation p, BatchAllocation b) { batch = b; project = p; }
public void CreateProjectAllocationThrowsError() { var client = CommonMethods.GetClientByRoute(TargetProcessRoutes.Route.ProjectAllocations); var projectAllocation = new ProjectAllocation(); }
public int AllocateProjectToEmployee(ProjectAllocation allocationInfo) { allocationInfo.IsAllocationActive = true; allocationInfo.CreatedDateTime = DateTime.Now; return(_projectRepository.CreateProjectAllocation(allocationInfo)); }
public Task <int> Add(ProjectAllocation projectAllocation) { return(this._projectAllocationRepository.Add(projectAllocation)); }
public Task <int> Add(ProjectAllocation project) { this._context.Add(project); return(this._context.SaveChangesAsync()); }