private void LoadAssignmentsForProject(int project_id) { var assignmentLogic = new AssignmentLogic(); this.AssignmentViewModels = assignmentLogic.GetAssignmentsByProjectId(project_id) .Select(a => new AssignmentViewModel(a)) .ToList(); assignmentLogic.Dispose(); this.AssignmentViewModels.Add(new AssignmentViewModel { Id = 0, Name = ResourceStringManager.GetResourceByKey("All") }); this.cb_AssignmentFilter.SelectedItem = this.AssignmentViewModels.Single(a => a.Id == 0); }
public void GetAssignmentsByProjectId_Test() { // ARRANGE var assignment = CreateTestAssignment(); int projectId = assignment.Project_Id.Value; var assignmentLogic = new AssignmentLogic(); // ACT var foundAssignments = assignmentLogic.GetAssignmentsByProjectId(projectId); assignmentLogic.Dispose(); // ASSERT Assert.IsNotNull(foundAssignments); Assert.IsTrue(foundAssignments.All(a => a.Project_Id.Value == projectId)); }
public OpenAssignmentsViewModel(int project_Id) { if (project_Id != 0) { AssignmentLogic assignmentLogic = new AssignmentLogic(); var assignments = assignmentLogic.GetAssignmentsByProjectId(project_Id) .Where(a => a.AssignmentStatus == Common.Enums.EnumDefinition.AssignmentStatus.InProgress || a.AssignmentStatus == Common.Enums.EnumDefinition.AssignmentStatus.Future || a.AssignmentStatus == Common.Enums.EnumDefinition.AssignmentStatus.Postponed) .ToList(); if (assignments.Any()) { AssignmentNames = new List <string>(); foreach (var assignment in assignments) { AssignmentNames.Add(assignment.Name); } } } }