/// <summary> /// Adds the new allocation row. /// </summary> /// <param name="presenter">list of team allocation presenter</param> /// <returns> /// Add New Allocation Row /// </returns> public PartialViewResult AddNewAllocationRow(TeamAllocationPresenter presenter) { this.SetProjectListInPresenter(presenter); var developerList = this.developerService.RetrieveList(null, null, SessionData.Instance.UserInfo.Developer.DeveloperID); presenter.AssignDeveloperList(developerList.Where(x => x.DeveloperID != presenter.DeveloperId).ToList()); int idCount = 1; for (int i = 0; i < presenter.TeamAllocationList.Count; i++) { if (presenter.TeamAllocationList[i].AllocationID == 0) { var lastPartialID = presenter.TeamAllocationList.Last(); var id = lastPartialID.PartialID; idCount = id + 1; } } presenter.TeamAllocationList.Add(new TeamEngagementDateListItem() { Date = DateTimeHelper.RetrieveCurrentDateTime(), EndDate = DateTimeHelper.RetrieveCurrentDateTime(), ProjectAllocatedHours = 0, AllocationID = 0, PartialID = idCount }); presenter.IdSuffixValue = presenter.TeamAllocationList.Count; return this.PartialView(AllocationListConstant, presenter); }
public PartialViewResult DeleteAllocationListRecord(TeamAllocationPresenter presenter, string allocationId, string partialId, string developerId, string startDate, string endDate, string projectId, string pageFlag, string date) { this.SetProjectListInPresenter(presenter); var developerList = this.developerService.RetrieveList(null, null, SessionData.Instance.UserInfo.Developer.DeveloperID); presenter.AssignDeveloperList(developerList.Where(x => x.DeveloperID != presenter.DeveloperId).ToList()); var teamAllocationList = presenter.TeamAllocationList.ToList(); var removableListItem = partialId == "0" ? presenter.TeamAllocationList.Single(r => r.AllocationID == Convert.ToInt32(allocationId)) : presenter.TeamAllocationList.Single(r => r.PartialID == Convert.ToInt32(partialId)); if (removableListItem != null) { if (partialId == "0") { ModelState.Clear(); this.teamEngagementService.Delete(Convert.ToInt32(developerId, CultureInfo.CurrentCulture), Convert.ToInt32(projectId, CultureInfo.CurrentCulture), Convert.ToDateTime(startDate, CultureInfo.InvariantCulture), Convert.ToDateTime(endDate, CultureInfo.InvariantCulture)); var projectids = presenter.SelectedProjects.Count > 0 ? presenter.SelectedProjects.Select(s => s.ProjectID).ToList() : null; presenter.SelectedDate = (!string.IsNullOrEmpty(pageFlag) && pageFlag.Equals(DateCurrentPage, StringComparison.OrdinalIgnoreCase)) || !string.IsNullOrEmpty(date) ? Convert.ToDateTime(date) : DateTimeHelper.RetrieveCurrentDateTime(); var startDateTime = (string.IsNullOrEmpty(pageFlag) && string.IsNullOrEmpty(date)) || (!string.IsNullOrEmpty(pageFlag) && pageFlag.Equals(DateCurrentPage, StringComparison.OrdinalIgnoreCase)) ? presenter.SelectedDate : presenter.SelectedDate.RetrieveCurrentMonthStartDate(); var endDateTime = !string.IsNullOrEmpty(pageFlag) && pageFlag.Equals(FromCalendarPage, StringComparison.OrdinalIgnoreCase) ? presenter.SelectedDate.RetrieveCurrentMonthEndDate() : (!string.IsNullOrEmpty(pageFlag) && pageFlag.Equals(DateCurrentPage, StringComparison.OrdinalIgnoreCase) ? presenter.SelectedDate : (DateTime?)null); presenter.AssignTeamAllocationList(this.RetrieveTeamAllocationList(presenter, projectids, startDateTime, endDateTime)); foreach (var allocationList in teamAllocationList.Where(item => item.PartialID > 0).ToList()) { presenter.TeamAllocationList.Add(allocationList); } presenter.IdSuffixValue = presenter.TeamAllocationList.Count; } else { ModelState.Clear(); teamAllocationList.Remove(removableListItem); presenter.AssignTeamAllocationList(teamAllocationList); } } presenter.IdSuffixValue = presenter.TeamAllocationList.Count; return this.PartialView(AllocationListConstant, presenter); }
public ActionResult ViewAllocation(TeamAllocationPresenter presenter) { this.AddBreadcrumbItem(Resources.Assignments, Url.AssignmentsAction()); this.AddBreadcrumbItem(Resources.ManageAllocation, Url.ViewAllocationAction()); if (presenter != null) { presenter.LeaveDays = this.RetireveLeavesDetails(presenter.DeveloperId.ToString()); this.SetProjectListInPresenter(presenter); if (!string.IsNullOrEmpty(presenter.SelectedProjectIds)) { List<string> ids = presenter.SelectedProjectIds.Split(CommaSeparatorCharConst).ToList(); presenter.AssignSelectedProjects(presenter.MasterProjects.Where(project => ids.Contains(project.ProjectID.ToString(CultureInfo.CurrentCulture))).ToList()); IList<DeveloperListItem> developerList = this.developerService.RetrieveList(null, null, SessionData.Instance.UserInfo.Developer.DeveloperID); presenter.AssignDeveloperList(developerList.Where(x => x.DeveloperID != presenter.DeveloperId).ToList()); } this.AssignTeamAllocationValues(presenter); } return this.View(ViewTeamAllocationConst, presenter); }
/// <summary> /// Manages the allocation. /// </summary> /// <param name="developerId">The developer identifier.</param> /// <param name="date">The date.</param> /// <param name="pageFlag">The page flag.</param> /// <returns> /// Manage Allocation Page /// </returns> public ActionResult ManageAllocation(int developerId, string date, string pageFlag) { this.AddBreadcrumbItem(Resources.Assignments, Url.AssignmentsAction()); this.AddBreadcrumbItem(Resources.ViewAllocations, Url.ViewAllocationAction()); var presenter = new TeamAllocationPresenter(); presenter.LeaveDays = this.RetireveLeavesDetails(developerId.ToString()); this.SetProjectListInPresenter(presenter); presenter.DeveloperId = developerId; var developerList = this.developerService.RetrieveList(null, null, SessionData.Instance.UserInfo.Developer.DeveloperID); presenter.AssignDeveloperList(developerList.Where(x => x.DeveloperID != developerId).ToList()); var projectids = presenter.SelectedProjects.Count > 0 ? presenter.SelectedProjects.Select(s => s.ProjectID).ToList() : null; presenter.DeveloperInfo = this.developerService.RetrieveWithManagerInfo(new List<int>() { presenter.DeveloperId }, SessionData.Instance.UserInfo.Developer.DeveloperID); if (presenter.DeveloperInfo != null) { presenter.DeveloperInfo.DeveloperImage = presenter.DeveloperInfo.LoginID.RetrieveDeveloperImageName(); } presenter.SelectedDate = (!string.IsNullOrEmpty(pageFlag) && pageFlag.Equals(DateCurrentPage, StringComparison.OrdinalIgnoreCase)) || !string.IsNullOrEmpty(date) ? Convert.ToDateTime(date) : DateTimeHelper.RetrieveCurrentDateTime(); var startDate = (string.IsNullOrEmpty(pageFlag) && string.IsNullOrEmpty(date)) || (!string.IsNullOrEmpty(pageFlag) && pageFlag.Equals(DateCurrentPage, StringComparison.OrdinalIgnoreCase)) ? presenter.SelectedDate : presenter.SelectedDate.RetrieveCurrentMonthStartDate(); var endDate = !string.IsNullOrEmpty(pageFlag) && pageFlag.Equals(FromCalendarPage, StringComparison.OrdinalIgnoreCase) ? presenter.SelectedDate.RetrieveCurrentMonthEndDate() : (!string.IsNullOrEmpty(pageFlag) && pageFlag.Equals(DateCurrentPage, StringComparison.OrdinalIgnoreCase) ? presenter.SelectedDate : (DateTime?)null); presenter.AssignTeamAllocationList(this.RetrieveTeamAllocationList(presenter, projectids, startDate, endDate)); if (presenter.TeamAllocationList.Count >= 0) { if (!string.IsNullOrEmpty(pageFlag) && pageFlag.Equals(FromCalendarPage, StringComparison.OrdinalIgnoreCase)) { presenter.SelectedDate = DateTimeHelper.RetrieveCurrentDateTime(); } presenter.TeamAllocationList.Add(new TeamEngagementDateListItem() { Date = presenter.SelectedDate, EndDate = presenter.SelectedDate, ProjectAllocatedHours = 0, AllocationID = 0, PartialID = 1 }); } presenter.IdSuffixValue = presenter.TeamAllocationList.Count; return this.View(ManageAllocationConstant, presenter); }
/// <summary> /// Views the allocation. /// </summary> /// <param name="developerId">The developer identifier.</param> /// <param name="date">The date.</param> /// <returns> /// View Allocation Page /// </returns> public ActionResult ViewAllocation(int developerId, string date) { this.AddBreadcrumbItem(Resources.Assignments, Url.AssignmentsAction()); this.AddBreadcrumbItem(Resources.ManageAllocation, Url.ViewAllocationAction()); TeamAllocationPresenter presenter = new TeamAllocationPresenter(); this.SetProjectListInPresenter(presenter); presenter.DeveloperId = developerId; IList<DeveloperListItem> developerList = this.developerService.RetrieveList(null, null, SessionData.Instance.UserInfo.Developer.DeveloperID); presenter.AssignDeveloperList(developerList.Where(x => x.DeveloperID != developerId).ToList()); presenter.SelectedDate = date.ConvertToSelectedDateTime(DateTimeHelper.RetrieveCurrentDateTime()); this.AssignTeamAllocationValues(presenter); presenter.AssignSelectedProjects(presenter.MasterProjects); presenter.LeaveDays = this.RetireveLeavesDetails(developerId.ToString()); return this.View(ViewTeamAllocationConst, presenter); }