public ViewModelBase GetModelFromTeamViewType(TeamViewType type) { switch (type) { case TeamViewType.Create: return(new CreateViewModel()); } return(null); }
public void Execute(object parameter) { if (_navigator is Navigator obj) { ViewType viewType = (ViewType)parameter; obj.CurrentViewModel = obj.GetModelFromViewType(viewType); } else if (_navigator is NavigatorTeam obj1) { TeamViewType viewType = (TeamViewType)parameter; obj1.CurrentViewModel = obj1.GetModelFromTeamViewType(viewType); } }
/// <summary> /// Assigns the leave counts. /// </summary> /// <param name="presenter">The presenter.</param> /// <param name="teamViewType">Type of the team view.</param> /// <param name="durationOption">The duration option.</param> private void AssignLeaveCounts(TeamDashboardPresenter presenter, TeamViewType teamViewType, string durationOption) { if (teamViewType == TeamViewType.Team) { presenter.AssignLeaveCountByStatusList(this.RetrieveLeaveCountByStatusList(durationOption, presenter.TeamMember.DeveloperID, null)); } else { presenter.AssignLeaveCountByStatusList(this.RetrieveLeaveCountByStatusList(durationOption, null, presenter.TeamMember.DeveloperID.ToString(CultureInfo.CurrentCulture))); } }
/// <summary> /// Loads the task list. /// </summary> /// <param name="request">The request.</param> /// <param name="selectedTaskIds">The selected task ids.</param> /// <param name="selectedStatus">The selected status.</param> /// <param name="developerId">The developer identifier.</param> /// <param name="teamViewType">Type of the team view.</param> /// <returns> /// JSON result /// </returns> public ActionResult LoadTaskList([DataSourceRequest]DataSourceRequest request, string selectedTaskIds, string selectedStatus, string developerId, TeamViewType teamViewType) { int? count = null; if (teamViewType == TeamViewType.None) { count = CountNumber; } IList<int> projectIds = null; int? selectedTaskStatus = null; if (!string.IsNullOrEmpty(selectedTaskIds)) { projectIds = selectedTaskIds.Split(',').Select(id => Convert.ToInt32(id, CultureInfo.CurrentCulture)).ToList(); } if (!string.IsNullOrEmpty(selectedStatus)) { selectedTaskStatus = Convert.ToInt32(selectedStatus, CultureInfo.CurrentCulture); } var list = this.developerService.RetrieveDeveloperTasks(projectIds, Convert.ToInt32(developerId, CultureInfo.CurrentCulture), count, selectedTaskStatus); var taskList = this.taskService.RetrieveTeamPortalTask(projectIds, Convert.ToInt32(developerId, CultureInfo.CurrentCulture), count, selectedTaskStatus); var priorityList = this.lookupService.RetrieveTaskPriorityList(SessionData.Instance.UserInfo.Developer.DeveloperID); var taskStatusFilterList = this.lookupService.RetrieveTaskStatusFilterList(SessionData.Instance.UserInfo.Developer.DeveloperID); foreach (var task in list) { foreach (var taskStatus in taskStatusFilterList) { if (task.Status == taskStatus.ID) { task.StatusValue = taskStatus.Name; break; } } } foreach (var task in taskList) { foreach (var taskStatus in taskStatusFilterList) { if (task.Status == taskStatus.ID) { task.StatusValue = taskStatus.Name; break; } } } foreach (var task in taskList) { foreach (var taskPriority in priorityList) { if (task.Priority == taskPriority.ID) { task.PriorityValue = taskPriority.Name; break; } } } foreach (var item in list) { var taskItem = new TeamPortalTask { WorkItemID = item.WorkItemID, StatusValue = item.StatusValue, PriorityValue = null, Title = item.Title, ProjectName = item.ProjectName, ProjectShortName = item.ProjectShortName, Effort = item.Effort, IsTfsTask = true }; taskList.Add(taskItem); } DataSourceResult result = taskList.ToDataSourceResult(request); return this.Json(result, JsonRequestBehavior.AllowGet); }
/// <summary> /// Retrieves next month team allocations. /// </summary> /// <param name="presenter">The presenter.</param> /// <param name="tab">The tab type.</param> private void RetrieveNextMonthTeamAllocations(TeamDashboardPresenter presenter, TeamViewType tab) { var nextMonthDates = RetrieveNextMonthDates(); this.RetrieveTeamAllocations(presenter, nextMonthDates.Item1, nextMonthDates.Item2, tab); }
/// <summary> /// Retrieves the team allocations. /// </summary> /// <param name="presenter">The presenter.</param> /// <param name="fromDate">From date</param> /// <param name="toDate"> To date</param> /// <param name="tab">The type of tab</param> private void RetrieveTeamAllocations(TeamDashboardPresenter presenter, DateTime? fromDate, DateTime? toDate, TeamViewType tab) { if (tab == TeamViewType.Team) { var teamAllocations = this.teamEngagementService.RetrieveDeveloperList(new List<int>() { presenter.TeamMember.DeveloperID }, null, fromDate, toDate, SessionData.Instance.UserInfo.Developer.DeveloperID); presenter.AssignTeamAllocationList(teamAllocations.Where(team => team.DeveloperID != presenter.TeamMember.DeveloperID).ToList()); presenter.TotalAllocationHours = presenter.TeamAllocationList.Count > 0 ? (from a in presenter.TeamAllocationList select a.AllocatedHours).Sum() : 0; } else { presenter.AssignTeamAllocations(this.teamEngagementService.RetrieveDeveloperProjectList(presenter.TeamMember.DeveloperID, null, fromDate, toDate)); presenter.TotalAllocationHours = presenter.TeamAllocations.Count > 0 ? (from a in presenter.TeamAllocations select a.AllocatedHours).Sum() : 0; } }