/// <summary>
 /// Weeklies the project hour burn down report.
 /// </summary>
 /// <param name="reportPresenter">The report presenter.</param>
 private void WeeklyProjectHourBurnDownReport(ProjectDashboardPresenter reportPresenter)
 {
     reportPresenter.AssignWeeklyProjectHourBurnDown(this.projectHourReportService.RetrieveWeeklyProjectHourBurnDown(reportPresenter.ReportFilter.DateFrom, reportPresenter.ReportFilter.DateTo, reportPresenter.ReportFilter.SelectedProject));
 }
        public ActionResult RetrieveTaskList(ProjectDashboardPresenter presenter, string statusType, string projectPortalId, string sortOnValue, string sortDirection)
        {
            ModelState.Clear();
            if (presenter != null)
            {
                var projectId = Convert.ToInt32(projectPortalId, CultureInfo.CurrentCulture);
                presenter.ProjectId = projectId;
                presenter.TaskStatus = Convert.ToInt32(statusType, CultureInfo.CurrentCulture);
                presenter.SortOnValue = sortOnValue;
                presenter.SortDirection = sortDirection;
                presenter.AssignTaskStatusFilter(this.lookupService.RetrieveTaskStatusFilterList(SessionData.Instance.UserInfo.Developer.DeveloperID));
                presenter.AssignPriorityList(this.lookupService.RetrieveTaskPriorityList(SessionData.Instance.UserInfo.Developer.DeveloperID));
                var taskDetails = this.RetrieveSortedTasks(projectId, presenter.TaskStatus, sortOnValue, sortDirection);
                presenter.AssignProjectPortalTask(taskDetails);
            }

            return this.PartialView(ProjectTaskContainerPartialView, presenter);
        }
        private static void ValidateReportFilter(ProjectDashboardPresenter presenter)
        {
            string resultFrom, resultTo;

            if (!ValidateDate(presenter.ReportFilter.DateFrom, out resultFrom))
            {
                presenter.ValidationErrors.Add(StartDate, resultFrom);
            }

            if (!ValidateDate(presenter.ReportFilter.DateTo, out resultTo))
            {
                presenter.ValidationErrors.Add(EndDate, resultTo);
            }

            if (string.IsNullOrEmpty(resultFrom) && string.IsNullOrEmpty(resultTo) && !CompareDates(presenter.ReportFilter.DateFrom, presenter.ReportFilter.DateTo))
            {
                presenter.ValidationErrors.Add(CompareDate, Resources.ReportCompareStartEndDate);
            }

            if (Convert.ToInt32(presenter.ReportFilter.SelectedRoleGroup, CultureInfo.CurrentCulture) == -1 && presenter.SelectedMenuItem.Equals(ReportOption.ProjectTeamMemberAllocation.ToString()))
            {
                presenter.ValidationErrors.Add(Role, Resources.RoleErrorMessage);
            }
        }
        /// <summary>
        /// Shows the more summary.
        /// </summary>
        /// <param name="presenter">The presenter.</param>
        /// <param name="projectPortalId">The project portal id.</param>
        /// <returns>show more summary rows</returns>
        public ActionResult ShowMoreSummary(ProjectDashboardPresenter presenter, string projectPortalId)
        {
            if (presenter != null)
            {
                presenter.AssignProjectPortalProjectSummaryList(this.projectService.RetrieveProjectPortalProjectSummaryList(Convert.ToInt32(projectPortalId, CultureInfo.CurrentCulture), null, null, presenter.SummaryOffset, ProjectDashboardPresenter.SummaryNumberOfRecord, SessionData.Instance.UserInfo.Developer.DeveloperID));
                presenter.ProjectPortalProjectSummaryList.ForEach(DecodeSummaryNewValue);
            }

            return this.PartialView(ProjectSummaryPartialView, presenter);
        }
        public ActionResult ValidateProjectPopUpDetails(ProjectDashboardPresenter presenter, string projectStatusId)
        {
            ModelState.Clear();
            if (presenter != null)
            {
                if (presenter.Project.Status == 0 && projectStatusId != "undefined" && projectStatusId != string.Empty)
                {
                    presenter.Project.Status = Convert.ToByte(projectStatusId);
                }

                ValidatePopUpErrorDetails(presenter);
            }

            return new JsonResult { Data = presenter, MaxJsonLength = int.MaxValue };
        }
        public ActionResult ValidateFilterDetails(ProjectDashboardPresenter presenter)
        {
            ModelState.Clear();
            if (presenter != null)
            {
                ValidateReportFilter(presenter);
            }

            return new JsonResult { Data = presenter, MaxJsonLength = int.MaxValue };
        }
        /// <summary>
        /// Refreshes the project dashboard history details.
        /// </summary>
        /// <param name="presenter">The presenter.</param>
        /// <param name="projectPortalId">The project portal id.</param>
        /// <returns>
        /// partial view for
        /// </returns>
        public ActionResult RefreshProjectDashboardHistoryDetails(ProjectDashboardPresenter presenter, string projectPortalId)
        {
            if (presenter != null && !string.IsNullOrEmpty(presenter.SelectedReleaseTypeIds))
            {
                presenter.ProjectPortalProjectSummaryList.ForEach(DecodeSummaryNewValue);
                IList<int> selectedReleaseTypeIds = presenter.SelectedReleaseTypeIds.Split(',').Select(releaseType => Convert.ToInt32(releaseType, CultureInfo.CurrentCulture)).ToList();
                presenter.AssignSelectedReleaseTypes(presenter.ReleaseTypeList.Where(releaseType => selectedReleaseTypeIds.Contains(releaseType.ID)).ToList());
                presenter.Offset = DefaultOffset;
                presenter.DateTo = DateTimeExtensions.RetrieveTodayEndTime(presenter.DateTo);
                presenter.AssignProjectPortalHistoryList(this.projectService.RetrieveProjectPortalHistoryInfo(presenter.SelectedReleaseTypeIds, Convert.ToInt32(projectPortalId, CultureInfo.CurrentCulture), presenter.DateFrom, presenter.DateTo, presenter.Offset, ProjectDashboardPresenter.NumberOfRecord, SessionData.Instance.UserInfo.Developer.DeveloperID));
            }

            return this.PartialView(ProjectHistoryPartialView, presenter);
        }
        /// <summary>
        /// Assigns the project portal history.
        /// </summary>
        /// <param name="presenter">The presenter.</param>
        /// <param name="projectPortalId">The project portal id.</param>
        /// <param name="historyTypeIds">The history type ids.</param>
        /// <param name="fromDate">From date.</param>
        /// <param name="toDate">To date.</param>
        private void AssignProjectPortalHistory(ProjectDashboardPresenter presenter, int projectPortalId, string historyTypeIds, string fromDate, string toDate)
        {
            presenter.DateFrom = !string.IsNullOrEmpty(fromDate) ? Convert.ToDateTime(fromDate) : DateTimeHelper.RetrieveCurrentDate().AddMonths(-1);
            presenter.DateTo = !string.IsNullOrEmpty(toDate) ? Convert.ToDateTime(toDate) : DateTimeHelper.RetrieveCurrentDateTime();
            var date = presenter.DateTo;
            date = new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second);

            if (SessionData.Instance.UserInfo != null && SessionData.Instance.UserInfo.Developer != null)
            {
                presenter.AssignProjectPortalHistoryList(this.projectService.RetrieveProjectPortalHistoryInfo(null, projectPortalId, presenter.DateFrom, date, presenter.Offset, ProjectDashboardPresenter.NumberOfRecord, SessionData.Instance.UserInfo.Developer.DeveloperID));
                presenter.AssignProjectPortalProjectSummaryList(this.projectService.RetrieveProjectPortalProjectSummaryList(projectPortalId, null, null, presenter.SummaryOffset, ProjectDashboardPresenter.SummaryNumberOfRecord, SessionData.Instance.UserInfo.Developer.DeveloperID));
            }

            presenter.AssignReleaseTypes(this.lookupService.RetrieveHistoryEntity(null, null, SessionData.Instance.UserInfo.Developer.DeveloperID));

            if (!string.IsNullOrEmpty(historyTypeIds))
            {
                var selectedhistoryTypeIds = historyTypeIds.Split(',').Select(s => Convert.ToInt32(s, CultureInfo.CurrentCulture)).ToList();
                presenter.AssignSelectedReleaseTypes(presenter.ReleaseTypeList.Where(releaseTypeItem => selectedhistoryTypeIds.Contains(releaseTypeItem.ID)).ToList());
            }
            else
            {
                presenter.AssignSelectedReleaseTypes(presenter.ReleaseTypeList);
            }
        }
 /// <summary>
 /// Assigns the project dashboard basic details.
 /// </summary>
 /// <param name="project">The project.</param>
 /// <param name="projectPortalId">The project portal id.</param>
 /// <param name="presenter">The presenter.</param>
 private void AssignProjectDashboardBasicDetails(Project project, int projectPortalId, ProjectDashboardPresenter presenter)
 {
     presenter.CompletedPercent = project.CompletedPercent.HasValue ? project.CompletedPercent.Value : 0;
     presenter.AssignProjectPortalInformation(this.projectService.RetrieveProjectPortalInfo(projectPortalId, SessionData.Instance.UserInfo.Developer.DeveloperID));
     presenter.AssignStatusList(this.lookupService.RetrieveProjectStatusList(SessionData.Instance.UserInfo.Developer.DeveloperID));
     presenter.AssignSupervisors(this.developerService.RetrieveManagers(null, false, SessionData.Instance.UserInfo.Developer.DeveloperID));
     presenter.AssignRoleGroups(this.lookupService.RetrieveRoleGroups(SessionData.Instance.UserInfo.Developer.DeveloperID));
     this.AssignProjectList(presenter);
     if (string.IsNullOrEmpty(presenter.SelectedSupervisorIds))
     {
         presenter.Supervisors.ForEach(s => presenter.SelectedSupervisors.Add(s.DeveloperID));
         presenter.SelectedSupervisorIds = string.Join(",", presenter.SelectedSupervisors.Select(s => s.ToString(CultureInfo.InvariantCulture)).ToList());
     }
 }
 /// <summary>
 /// Assigns the project portal sprint.
 /// </summary>
 /// <param name="presenter">The presenter.</param>
 /// <param name="projectPortalId">The project portal identifier.</param>
 private void AssignProjectPortalSprint(ProjectDashboardPresenter presenter, int projectPortalId)
 {
     presenter.AssignTaskStatusFilter(this.lookupService.RetrieveTaskStatusFilterList(SessionData.Instance.UserInfo.Developer.DeveloperID));
     presenter.AssignPriorityList(this.lookupService.RetrieveTaskPriorityList(SessionData.Instance.UserInfo.Developer.DeveloperID));
     presenter.AssignProjectPortalTaskSummary(this.taskService.RetrieveProjectPortalTaskSummary(projectPortalId, SessionData.Instance.UserInfo.Developer.DeveloperID));
     var statusValue = presenter.ProjectPortalTaskSummary.Where(item => item.Count > 0 && !item.Status.Equals(InProgress)).Count();
     presenter.TaskStatus = statusValue > 0 ? Convert.ToInt32(NewStatus) : InProgressStatus;
    
     var projectTaskDetails = this.RetrieveSortedTasks(projectPortalId, presenter.TaskStatus, null, null);
     presenter.AssignProjectPortalTask(projectTaskDetails);
     presenter.SelectedSortingOption = DefaultTaskSortingOptionId;
     presenter.AssignProjectPortalSprintInformation(this.projectService.RetrieveProjectPortalSprintInfo(projectPortalId, SessionData.Instance.UserInfo.Developer.DeveloperID));
     if (presenter.ProjectPortalSprintDetail != null)
     {
         presenter.AssignProjectPortalImpedimentList(this.projectService.RetrieveProjectPortalImpedimentInfo(presenter.ProjectPortalSprintDetail.SprintID, SessionData.Instance.UserInfo.Developer.DeveloperID));
         presenter.AssignProjectPortalFeatureList(this.projectService.RetrieveProjectPortalFeatureInfo(presenter.ProjectPortalSprintDetail.SprintID, SessionData.Instance.UserInfo.Developer.DeveloperID));
         presenter.AssignProjectPortalBurnDownInfo(this.projectService.RetrieveProjectPortalBurnDownInfo(presenter.ProjectPortalSprintDetail.SprintID, SessionData.Instance.UserInfo.Developer.DeveloperID, null));
     }
 }
        /// <summary>
        /// Assigns the compliance detail.
        /// </summary>
        /// <param name="presenter">The presenter.</param>
        /// <param name="projectPortalId">The project portal identifier.</param>
        /// <param name="releaseTypeIds">The release type ids.</param>
        /// <param name="releaseStatusIds">The release status ids.</param>
        private void AssignComplianceDetail(ProjectDashboardPresenter presenter, int projectPortalId, string releaseTypeIds, string releaseStatusIds)
        {
            presenter.AssignReleaseTypes(this.lookupService.RetrieveReleaseTypes(SessionData.Instance.UserInfo.Developer.DeveloperID));
            presenter.AssignArtifactStatus(this.lookupService.RetrieveArtifactStatusTypes(SessionData.Instance.UserInfo.Developer.DeveloperID));
            if (!string.IsNullOrEmpty(releaseTypeIds))
            {
                var selectedReleaseTypeIds = releaseTypeIds.Split(',').Select(s => Convert.ToInt32(s, CultureInfo.CurrentCulture)).ToList();
                presenter.AssignSelectedReleaseTypes(presenter.ReleaseTypeList.Where(releaseType => selectedReleaseTypeIds.Contains(releaseType.ID)).ToList());
            }
            else
            {
                presenter.AssignSelectedReleaseTypes(presenter.ReleaseTypeList.Where(r => r.ID == (byte)ReleaseType.UAT).ToList());
            }

            if (!string.IsNullOrEmpty(releaseStatusIds))
            {
                var selectedReleaseStatusIds = releaseStatusIds.Split(',').Select(s => Convert.ToInt32(s, CultureInfo.CurrentCulture)).ToList();
                presenter.AssignSelectedArtifactsList(presenter.ProjectStatusList.Where(projectStatus => selectedReleaseStatusIds.Contains(projectStatus.ID)).ToList());
            }
            else
            {
                presenter.AssignSelectedArtifactsList(presenter.ArtifactStatusList);
            }

            IList<int> releaseEnvironmentList = new List<int>();
            releaseEnvironmentList.Add(UatReleaseType);
            releaseEnvironmentList.Add(InternalReleaseType);
            releaseEnvironmentList.Add(ProductionReleaseType);
            releaseEnvironmentList.Add(BetaReleaseType);

            var artifactList = this.projectArtifactService.RetrieveList(projectPortalId, releaseEnvironmentList, null, SessionData.Instance.UserInfo.Developer.DeveloperID);
            (from artifact in artifactList
             from artifactStatus in presenter.ArtifactStatusList
             where artifact.Status == artifactStatus.ID
             select MapProcessComplianceStatusTitle(artifactStatus, artifact)).ToList();

            AssignProjectArtifactList(presenter, artifactList);
            AssignReleaseArtifactList(presenter, artifactList);
        }
 /// <summary>
 /// Assigns the project portal health.
 /// </summary>
 /// <param name="presenter">The presenter.</param>
 /// <param name="projectPortalId">The project portal identifier.</param>
 private void AssignProjectPortalHealth(ProjectDashboardPresenter presenter, int projectPortalId)
 {
     presenter.AssignProjectPortalBugsBySeverityAndBugType(this.projectService.RetrieveProjectPortalBugsBySeverityAndBugType(projectPortalId, SessionData.Instance.UserInfo.Developer.DeveloperID));
     presenter.AssignBugsBySeverityStateAndEnvironmentList(this.projectService.RetrieveProjectPortalBugsBySeverityStateAndEnvironment(projectPortalId, SessionData.Instance.UserInfo.Developer.DeveloperID));
     presenter.AssignBugsBySeverityAndEnvironment(this.projectService.RetrieveProjectPortalBugsBySeverityAndEnvironment(projectPortalId, SessionData.Instance.UserInfo.Developer.DeveloperID));
     presenter.AssignProjectPortalBugsByEnvironmentAndBugType(this.projectService.RetrieveProjectPortalBugsByEnvironmentAndBugType(projectPortalId, SessionData.Instance.UserInfo.Developer.DeveloperID));
 }
        /// <summary>
        /// Assigns the interval offset.
        /// </summary>
        /// <param name="presenter">The presenter.</param>
        private void AssignIntervalOffset(ProjectDashboardPresenter presenter)
        {
            var count = 1;
            var countRevisedPlanEndDateOffset = 1;
            var currentDate = DateTimeHelper.RetrieveCurrentDate();
            if (presenter.ProjectPortalPredictionInfoList.Count > 0)
            {
                foreach (var item in presenter.ProjectPortalPredictionInfoList)
                {
                    var firstDate = item.WeekDate.Split('-');
                    var year = firstDate[1].Split(',');
                    item.FirstDayOfCurrentWeek = Convert.ToDateTime(firstDate[0] + year[1], CultureInfo.CurrentCulture);
                    item.LastDayOfCurrentWeek = Convert.ToDateTime(year[0] + year[1], CultureInfo.CurrentCulture);

                    if (item.FirstDayOfCurrentWeek <= currentDate && item.LastDayOfCurrentWeek < currentDate)
                    {
                        count++;
                    }

                    if (item.FirstDayOfCurrentWeek <= item.RevisedPlanEndDate && item.LastDayOfCurrentWeek < item.RevisedPlanEndDate)
                    {
                        countRevisedPlanEndDateOffset++;
                    }

                    if (item.PredictedConsumedHoursByRevisedPlanEndDate != 0)
                    {
                        presenter.RevisedVelocityResult = item.PredictedConsumedHoursByRevisedPlanEndDate;
                    }
                }

                presenter.ProjectPortalPredictionInfoList[0].IntervalOffset = count;

                if (presenter.ProjectPortalPredictionInfoList.FirstOrDefault().RevisedPlanEndDate != null)
                {
                    presenter.ProjectPortalPredictionInfoList[0].RevisedPlanEndDateIntervalOffset = countRevisedPlanEndDateOffset;
                }
            }
        }
 /// <summary>
 /// Projects the hour breakdown.
 /// </summary>
 /// <param name="presenter">The presenter.</param>
 private void ProjectHourBreakdownReport(ProjectDashboardPresenter presenter)
 {
     presenter.AssignProjectHourBreakdown(this.projectHourReportService.RetrieveProjectHourBreakdown(presenter.ReportFilter.SelectedProject, presenter.ReportFilter.DateFrom, presenter.ReportFilter.DateTo));
     presenter.AssignProjectFeatureHourBreakdownInfoReport(this.projectHourReportService.RetrieveProjectFeatureHourBreakdownInfo(presenter.ReportFilter.SelectedProject, presenter.ReportFilter.DateFrom, presenter.ReportFilter.DateTo));
 }
 public ActionResult ValidateProjectComplianceDetails(ProjectDashboardPresenter presenter)
 {
     ValidateDetails(presenter);
     return new JsonResult { Data = presenter, MaxJsonLength = int.MaxValue };
 }
        /// <summary>
        /// Assigns the project dashboard.
        /// </summary>
        /// <param name="presenter">The presenter.</param>
        /// <param name="projectPortalId">The project portal identifier.</param>
        private void AssignProjectDashboardDetails(ProjectDashboardPresenter presenter, int projectPortalId)
        {
            presenter.DateTo = DateTimeHelper.RetrieveCurrentDateTime();
            var defaultProjectStartDate = presenter.ProjectPortalDetail != null ? (presenter.ProjectPortalDetail.FirstTimesheetDate.HasValue ? presenter.ProjectPortalDetail.FirstTimesheetDate.Value : presenter.DateTo.AddMonths(-1)) : presenter.DateTo.AddMonths(-1);
            presenter.LastTwoMonthStartDate = presenter.DateTo.AddMonths(-2);
            var dateFrom = presenter.ProjectPortalDetail != null ? (presenter.ProjectPortalDetail.StartDate.HasValue ? presenter.ProjectPortalDetail.StartDate.Value : defaultProjectStartDate) : defaultProjectStartDate;
            presenter.DateFrom = dateFrom;
            presenter.AssignProjectPortalEstimatedVsConsumedHours(this.projectHourReportService.RetrieveWeeklyProjectHourBurnDown(dateFrom, presenter.DateTo, projectPortalId));
            presenter.AssignProjectPortalDefectInfo(this.projectService.RetrieveProjectPortalDefectInfo(projectPortalId, SessionData.Instance.UserInfo.Developer.DeveloperID, dateFrom, presenter.DateTo));
            presenter.AssignProjectPortalDefectInfoForLastTwoMonths(this.projectService.RetrieveProjectPortalDefectInfo(projectPortalId, SessionData.Instance.UserInfo.Developer.DeveloperID, presenter.LastTwoMonthStartDate, presenter.DateTo));

            IList<byte> releaseTypes = new List<byte>();
            releaseTypes.Add(UatReleaseType);
            releaseTypes.Add(ProductionReleaseType);

            IList<int> productIds = new List<int>();
            productIds.Add(projectPortalId);

            presenter.AssignReleaseItemsList(presenter.DateTo, this.releaseService.RetrieveList(releaseTypes, productIds, presenter.DateTo, null, SessionData.Instance.UserInfo.Developer.DeveloperID));

            presenter.AssignProjectComplianceList(this.projectService.RetrieveProjectComplianceInfo(projectPortalId, SessionData.Instance.UserInfo.Developer.DeveloperID, null));
        }
 public ActionResult ValidateHistory(ProjectDashboardPresenter presenter)
 {
     ValidateHistoryDate(presenter);
     return new JsonResult { Data = presenter, MaxJsonLength = int.MaxValue };
 }
 /// <summary>
 /// Sets the report details.
 /// </summary>
 /// <param name="presenter">The presenter.</param>
 private void SetReportDetails(ProjectDashboardPresenter presenter)
 {
     if (presenter.SelectedMenuItem.Equals(ReportOption.ProjectHoursAnalysis.ToString()) || presenter.SelectedMenuItem.Equals(ReportOption.ProjectHoursAnalysisDrillDown.ToString()))
     {
         presenter.AssignDashboardProjectHourAnalysisReportList(this.projectHourReportService.RetrieveProjectHourAnalysis(presenter.ReportFilter.SelectedProject, presenter.ReportFilter.DateFrom, presenter.ReportFilter.DateTo));
     }
     else if (presenter.SelectedMenuItem.Equals(ReportOption.ProjectTeamMemberAllocation.ToString()))
     {
         this.ProjectTeamMemberAllocationReport(presenter);
     }
     else if (presenter.SelectedMenuItem.Equals(ReportOption.WeeklyProjectHourBurndown.ToString()))
     {
         this.WeeklyProjectHourBurnDownReport(presenter);
     }
     else if (presenter.SelectedMenuItem.Equals(ReportOption.ProjectHourBreakdown.ToString()))
     {
         this.ProjectHourBreakdownReport(presenter);
     }
 }
        /// <summary>
        /// Refreshes the project dashboard compliance details.
        /// </summary>
        /// <param name="projectId">The project id.</param>
        /// <param name="presenter">The presenter.</param>
        /// <returns>
        /// result view
        /// </returns>
        public ActionResult RefreshProjectDashboardComplianceDetails(string projectId, ProjectDashboardPresenter presenter)
        {
            if (string.IsNullOrWhiteSpace(projectId))
            {
                return this.Redirect(Url.AccountAction());
            }

            var projectPortalId = Convert.ToInt32(projectId, CultureInfo.CurrentCulture);
            var project = this.projectService.RetrieveById(projectPortalId, SessionData.Instance.UserInfo.Developer.DeveloperID);

            if (project == null)
            {
                return this.Redirect(Url.AccountAction());
            }

            presenter.ProjectId = projectPortalId;

            presenter.AssignReleaseTypes(this.lookupService.RetrieveReleaseTypes(SessionData.Instance.UserInfo.Developer.DeveloperID));
            presenter.AssignArtifactStatus(this.lookupService.RetrieveArtifactStatusTypes(SessionData.Instance.UserInfo.Developer.DeveloperID));

            ////IList<int> selectedArtifactsList = null;
            IList<int> selectedReleaseTypeList = null;
            ////if (!string.IsNullOrEmpty(presenter.SelectedArtifactStatusIds))
            ////{
            ////    selectedArtifactsList = presenter.SelectedArtifactStatusIds.Split(',').Select(s => Convert.ToInt32(s, CultureInfo.CurrentCulture)).ToList();
            ////    presenter.AssignSelectedArtifactsList(presenter.ArtifactStatusList.Where(artifact => selectedArtifactsList.Contains(artifact.ID)).ToList());
            ////}

            if (!string.IsNullOrEmpty(presenter.SelectedReleaseTypeIds))
            {
                selectedReleaseTypeList = presenter.SelectedReleaseTypeIds.Split(',').Select(s => Convert.ToInt32(s, CultureInfo.CurrentCulture)).ToList();
                presenter.AssignSelectedReleaseTypes(presenter.ReleaseTypeList.Where(releaseType => selectedReleaseTypeList.Contains(releaseType.ID)).ToList());
            }

            var artifactList = this.projectArtifactService.RetrieveList(projectPortalId, selectedReleaseTypeList, null, SessionData.Instance.UserInfo.Developer.DeveloperID);
            (from artifact in artifactList
             from artifactStatus in presenter.ArtifactStatusList
             where artifact.Status == artifactStatus.ID
             select MapProcessComplianceStatusTitle(artifactStatus, artifact)).ToList();

            AssignProjectArtifactList(presenter, artifactList);

            AssignReleaseArtifactList(presenter, artifactList);

            return this.PartialView(ProjectCompliancePartialView, presenter);
        }
 /// <summary>
 /// retrieves common developer names
 /// </summary>
 /// <param name="presenter">The presenter.</param>
 /// <param name="projectPortalId">The project portal identifier.</param>
 /// <returns>list of project portal team</returns>
 private IList<ProjectPortalTeamInfo> RetriveCommonDevelopers(ProjectDashboardPresenter presenter, int projectPortalId)
 {
     var projectPortalTeamInfoList = this.projectService.RetrieveProjectPortalTeamInfo(projectPortalId, SessionData.Instance.UserInfo.Developer.DeveloperID);
     var onSiteMembersList = projectPortalTeamInfoList.Where(item => item.Type == 4).ToList();
     var offShoreMembersList = projectPortalTeamInfoList.Where(item => item.Type == 3).ToList();
     var commonDeveloperList = (from onSiteMembers in onSiteMembersList
                                join offShoreMembers in offShoreMembersList on onSiteMembers.DeveloperID equals offShoreMembers.DeveloperID
                                select offShoreMembers).ToList();
     commonDeveloperList.ForEach(s => projectPortalTeamInfoList.Remove(s));
     return projectPortalTeamInfoList;
 }
        /// <summary>
        /// Shows the more history.
        /// </summary>
        /// <param name="presenter">The presenter.</param>
        /// <param name="projectPortalId">The project portal id.</param>
        /// <returns>history rows</returns>
        public ActionResult ShowMoreHistory(ProjectDashboardPresenter presenter, string projectPortalId)
        {
            if (presenter != null)
            {
                presenter.ProjectPortalProjectSummaryList.ForEach(DecodeSummaryNewValue);
                presenter.DateTo = DateTimeExtensions.RetrieveTodayEndTime(presenter.DateTo);
                presenter.AssignProjectPortalHistoryList(this.projectService.RetrieveProjectPortalHistoryInfo(presenter.SelectedReleaseTypeIds, Convert.ToInt32(projectPortalId, CultureInfo.CurrentCulture), presenter.DateFrom, presenter.DateTo, presenter.Offset, ProjectDashboardPresenter.NumberOfRecord, SessionData.Instance.UserInfo.Developer.DeveloperID));
            }

            return this.PartialView(ProjectHistoryContentsPartialView, presenter);
        }
        /// <summary>
        /// Indexes the specified project identifier.
        /// </summary>
        /// <param name="projectId">The project identifier.</param>
        /// <param name="tabId">The tab identifier.</param>
        /// <param name="itemId">The item identifier.</param>
        /// <param name="requiredAllocationsPerWeek">The required allocations per week.</param>
        /// <param name="dashboard">The dashboard.</param>
        /// <param name="includeInactive">The include inactive.</param>
        /// <param name="releaseTypeIds">The release type ids.</param>
        /// <param name="releaseStatusIds">The release status ids.</param>
        /// <param name="historyTypeIds">The history type ids.</param>
        /// <param name="fromDate">From date.</param>
        /// <param name="toDate">To date.</param>
        /// <returns>
        /// return view
        /// </returns>
        public ActionResult Index(string projectId, string tabId, string itemId, string requiredAllocationsPerWeek, string dashboard, string includeInactive, string releaseTypeIds, string releaseStatusIds, string historyTypeIds, string fromDate, string toDate)
        {
            if (dashboard == null)
            {
                this.AddBreadcrumbItem(Resources.ManageProject, Url.ProjectsAction());
            }
            else
            {
                this.AddBreadcrumbItem(Resources.Dashboard, Url.DashboardAction());
            }

            var breadCrumbTabName = string.Empty;
            if (!string.IsNullOrEmpty(tabId))
            {
                if (tabId.Equals("Compliance", StringComparison.OrdinalIgnoreCase))
                {
                    breadCrumbTabName = Resources.ReleasesHeader;
                }
                else
                {
                    breadCrumbTabName = tabId;
                }

                this.AddBreadcrumbItem(string.Format(CultureInfo.CurrentCulture, BreadcrumbFormat, Resources.ProjectDashboard, breadCrumbTabName), Url.ProjectDashboardAction());
            }
            else
            {
                this.AddBreadcrumbItem(Resources.ProjectDashboard, Url.ProjectDashboardAction());
            }

            var presenter = new ProjectDashboardPresenter();
            InitializeFilter(presenter.ReportFilter);
            UpdateFilters(presenter.ReportFilter, itemId);
            presenter.CompletedPercent = 0;

            if (string.IsNullOrWhiteSpace(projectId))
            {
                return this.Redirect(Url.AccountAction());
            }

            var projectPortalId = Convert.ToInt32(projectId, CultureInfo.CurrentCulture);
            var project = this.projectService.RetrieveById(projectPortalId, SessionData.Instance.UserInfo.Developer.DeveloperID);
            if (project == null)
            {
                return this.Redirect(Url.AccountAction());
            }
            else
            {
                presenter.Project = project;
                presenter.OldRiskValue = presenter.Project.Risk;
            }

            presenter.ProjectId = projectPortalId;
            if (!string.IsNullOrEmpty(itemId))
            {
                presenter.SelectedMenuItem = itemId;
            }

            if (!string.IsNullOrEmpty(includeInactive))
            {
                presenter.IncludeInactive = Convert.ToBoolean(includeInactive, CultureInfo.CurrentCulture);
            }

            int selectedProject;
            if (!string.IsNullOrEmpty(projectId) && int.TryParse(projectId, out selectedProject))
            {
                presenter.ReportFilter.SelectedProject = selectedProject;
            }

            this.AssignProjectDashboardBasicDetails(project, projectPortalId, presenter);
            if (tabId == ProjectViewType.Prediction.ToString() && presenter.ProjectPortalDetail != null && presenter.ProjectPortalDetail.IsSupport != null && presenter.ProjectPortalDetail.IsSupport.Value)
            {
                return this.Redirect(Url.AccountAction());
            }

            this.AssignTabData(project, tabId, presenter, projectPortalId, requiredAllocationsPerWeek, releaseTypeIds, releaseStatusIds, historyTypeIds, fromDate, toDate);

            presenter.TabId = tabId;

            return this.View(presenter);
        }
        public ActionResult RefreshProjectDashboardReport(ProjectDashboardPresenter presenter)
        {
            if (presenter != null)
            {
                presenter.ReportFilterXml = HttpContext.Server.HtmlEncode(SerializeObject(presenter.ReportFilter, typeof(ReportFilter)));
                return this.Json(presenter);
            }

            return this.Json(string.Empty);
        }
        public ActionResult Index(ProjectDashboardPresenter presenter)
        {
            if (presenter != null)
            {
                if (presenter.ReportFilter != null)
                {
                    this.AddBreadcrumbItem(Resources.ProjectDashboard, Url.ProjectDashboardAction());
                    this.AddBreadcrumbItem(Resources.ProjectDashboard + " - " + presenter.SelectedProjectPortalTab, Url.ProjectDashboardAction());

                    var project = this.projectService.RetrieveById(presenter.ReportFilter.SelectedProject, SessionData.Instance.UserInfo.Developer.DeveloperID);

                    this.AssignProjectDashboardBasicDetails(project, presenter.ReportFilter.SelectedProject, presenter);

                    SetSelectedReportMenu(presenter);

                    this.SetReportDetails(presenter);
                }

                return this.View(presenter);
            }

            return this.View(string.Empty);
        }
        public ActionResult SubmitProjectPopUpDetails(ProjectDashboardPresenter presenter, string projectStatusId)
        {
            ModelState.Clear();
            if (presenter != null)
            {
                if (presenter.Project.Status == 0 && projectStatusId != "undefined" && projectStatusId != string.Empty)
                {
                    presenter.Project.Status = Convert.ToByte(projectStatusId);
                }

                DecodeProjectRawText(presenter);
                var project = this.projectService.RetrieveById(presenter.Project.ProjectID, SessionData.Instance.UserInfo.Developer.DeveloperID);
                project.CompanyID = SessionData.Instance.UserInfo.Developer.CompanyID;
                Map(presenter.Project, project);
                this.projectService.InsertOrUpdate(project, null, SessionData.Instance.UserInfo.Developer.DeveloperID);
            }

            return this.Json(string.Empty);
        }
        public ActionResult AssignArtifactList(ProjectDashboardPresenter presenter, string artifactType, string projectArtifactId, string nodeIndex)
        {
            var list = new List<ProcessComplianceListItem>();
            if (presenter != null)
            {
                if (!string.IsNullOrEmpty(artifactType) && artifactType.Equals(Release, StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(nodeIndex))
                {
                    list = presenter.ReleaseArtifactList.Where(a => a.NodeIndex == Convert.ToInt32(nodeIndex, CultureInfo.CurrentCulture)).SelectMany(a => a.Items).ToList();
                    list = list.Where(x => x.ProjectArtifactID != Convert.ToInt32(projectArtifactId, CultureInfo.CurrentCulture)).ToList();
                }
                else if (!string.IsNullOrEmpty(artifactType) && artifactType.Equals(Project, StringComparison.OrdinalIgnoreCase))
                {
                    list = presenter.ProcessComplianceList.SelectMany(a => a.Items).ToList();
                    list = list.Where(x => x.ProjectArtifactID != Convert.ToInt32(projectArtifactId, CultureInfo.CurrentCulture)).ToList();
                }
            }

            return this.Json(list, JsonRequestBehavior.AllowGet);
        }
        public ActionResult RetrieveProjectStatusReasonDetail(ProjectDashboardPresenter presenter, string projectPortalId)
        {
            ModelState.Clear();
            if (presenter != null)
            {
                var projectId = Convert.ToInt32(projectPortalId, CultureInfo.CurrentCulture);

                presenter.AssignProjectStatusReason(this.projectService.RetrieveProjectStatusReason(projectId, SessionData.Instance.UserInfo.Developer.DeveloperID));
            }

            return this.PartialView(ProjectStatusReasonContainerPartialView, presenter);
        }
        public ActionResult SubmitDetails(ProjectDashboardPresenter presenter)
        {
            if (presenter != null)
            {
                IList<int> selectedCopyToArtifacts = null;
                DecodeRawText(presenter);
                this.projectArtifactService.InsertOrUpdate(presenter.ProcessComplianceItem, SessionData.Instance.UserInfo.Developer.DeveloperID);
                if (!string.IsNullOrEmpty(presenter.SelectedArtifactId) && presenter.ProcessComplianceItem.DueDate.HasValue)
                {
                    selectedCopyToArtifacts = presenter.SelectedArtifactId.Split(',').Select(id => Convert.ToInt32(id, CultureInfo.CurrentCulture)).ToList();
                    this.projectArtifactService.UpdateDueDate(selectedCopyToArtifacts, presenter.ProcessComplianceItem.DueDate.Value, SessionData.Instance.UserInfo.Developer.DeveloperID);
                }
            }

            return new JsonResult { Data = true, MaxJsonLength = int.MaxValue };
        }
        /// <summary>
        /// Validates the details.
        /// </summary>
        /// <param name="presenter">The presenter.</param>
        private static void ValidateDetails(ProjectDashboardPresenter presenter)
        {
            if (presenter.ProcessComplianceItem.Status == null)
            {
                presenter.ValidationErrors.Add(ArtifactId, @Resources.SelectStatusErrorMessage);
            }

            var dateNow = DateTimeHelper.RetrieveCurrentDate();
            if (!presenter.ProcessComplianceItem.DueDate.HasValue)
            {
                presenter.ValidationErrors.Add(DueDate, Resources.ValidDateErrorMessage);
            }
            else if (presenter.ProcessComplianceItem.DueDate < dateNow)
            {
                presenter.ValidationErrors.Add(DueDate, Resources.ValidDateErrorMessage);
            }
        }
 /// <summary>
 /// Projects the team member allocation report.
 /// </summary>
 /// <param name="reportPresenter">The report presenter.</param>
 private void ProjectTeamMemberAllocationReport(ProjectDashboardPresenter reportPresenter)
 {
     reportPresenter.SelectedRoleIds = reportPresenter.ReportFilter.SelectedRoleGroup > 0 ? reportPresenter.ReportFilter.SelectedRoleGroup.ToString(CultureInfo.InvariantCulture) : null;
     reportPresenter.SelectedProjectIds = reportPresenter.ReportFilter.SelectedProject > 0 ? reportPresenter.ReportFilter.SelectedProject.ToString(CultureInfo.InvariantCulture) : null;
     AssignSelectedSupervisors(reportPresenter);
     reportPresenter.AssignDashboardProjectTeamMemberAllocation(this.reportService.RetrieveDashboardProjectTeamMemberAllocation(reportPresenter.ReportFilter.DateFrom, reportPresenter.ReportFilter.DateTo, reportPresenter.SelectedRoleIds, reportPresenter.SelectedSupervisorIds, reportPresenter.SelectedProjectIds, SessionData.Instance.UserInfo.Developer.DeveloperID));
 }