public EmploymentsDTO GetAllEmploymentsByEmployeeId(int id) { try { var employmentsList = _employmentService.GetAllEmploymentsByEmployeeId(id); var result = new EmploymentsDTO { Employments = employmentsList, Status = CollectionGetStatus.Success }; return(result); } catch (Exception e) { Console.Write(e.Message); var result = new EmploymentsDTO { Status = CollectionGetStatus.Failure }; return(result); } }
private void SynchronizeEmployments() { _employmentsDTO = _employmentController.GetAllEmploymentsByEmployeeId(Employee.Id); employmentListView.Items.Clear(); if (_employmentsDTO.Employments != null) { foreach (var e in _employmentsDTO.Employments) { if (!e.Id.Equals(Employment.Id)) { var position = _positionsDTO.Positions.Find(p => p.Id.Equals(e.PositionId)); string[] lv = { e.Id.ToString(), (position != null) ? position.Name : "jak to tu jest to niefajnie", e.Salary.ToString(), e.StartDate.ToString(), e.EndDate.ToString(), e.StorePlaceId != null ? e.StorePlace.Name : "BRAK" }; employmentListView.Items.Add(new ListViewItem(lv)); } } } }