예제 #1
0
        /// <summary>
        /// Assigns the selected team developers ids.
        /// </summary>
        /// <param name="reportPresenter">The report presenter.</param>
        private static void AssignSelectedTeamDevelopersIds(ReportPresenter reportPresenter)
        {
            IList<int> developerIds = null;

            if (string.IsNullOrEmpty(reportPresenter.SelectedTeamMembersIds))
            {
                if (reportPresenter.SelectedMenuItem.Equals(ReportOption.NameLeaveRoaster.ToString()) || reportPresenter.SelectedMenuItem.Equals(ReportOption.NameYearlyLeaveRoster.ToString()) || reportPresenter.SelectedMenuItem.Equals(ReportOption.TaskReport.ToString()) || reportPresenter.SelectedMenuItem.Equals(ReportOption.TaskProjectReport.ToString()))
                {
                    reportPresenter.SelectedTeamMembersIds = Convert.ToString(SessionData.Instance.UserInfo.Developer.DeveloperID, CultureInfo.CurrentCulture);
                    developerIds = new List<int> { SessionData.Instance.UserInfo.Developer.DeveloperID };
                }
                else
                {
                    if (reportPresenter.SelectedMenuItem.Equals(ReportOption.SwipeInOut.ToString()) && SessionData.Instance.UserInfo != null && SessionData.Instance.UserInfo.Developer.UserType != UserType.Admin)
                    {
                        reportPresenter.SelectedTeamMembersIds = Convert.ToString(SessionData.Instance.UserInfo.Developer.DeveloperID, CultureInfo.CurrentCulture);
                        developerIds = new List<int> { SessionData.Instance.UserInfo.Developer.DeveloperID };
                    }
                    else
                    {
                        developerIds = reportPresenter.TeamMembersList.Select(item => item.ID).ToList();
                    }
                }
            }
            else
            {
                developerIds = reportPresenter.SelectedTeamMembersIds.Split(',').Select(id => Convert.ToInt32(id, CultureInfo.CurrentCulture)).ToList();
            }

            if (string.IsNullOrEmpty(reportPresenter.SelectedTeamMembersIds) && (reportPresenter.SelectedMenuItem.Equals(ReportOption.TeamLeaveRoaster.ToString()) || reportPresenter.SelectedMenuItem.Equals(ReportOption.TeamYearlyLeaveRoster.ToString())))
            {
                reportPresenter.SelectedTeamMembersIds = string.Join(",", reportPresenter.TeamMembersList.Select(item => item.ID.ToString(CultureInfo.InvariantCulture)).ToList());
            }

            reportPresenter.AssignSelectedTeamDeveloperIdsList(developerIds);
        }