Ejemplo n.º 1
0
        public string GetNomineeNameOfCurrentNomination(int nominationId)
        {
            var nomination = GetReviewNomination(nominationId);
            var user       = _commonDataBaseContext.Query <User>().FirstOrDefault(u => u.ID == nomination.UserId);

            if (user != null)
            {
                return(user.DisplayName);
            }

            return(string.Empty);
        }
Ejemplo n.º 2
0
        public string GetLoggedInUserName(string emailId)
        {
            var data = _commonDataBaseContext.Query <User>().FirstOrDefault(u => u.EmailAddress == emailId);

            if (data != null)
            {
                return(data.FirstName + " " + data.LastName);
            }
            return(null);
        }
Ejemplo n.º 3
0
        public IEnumerable <Project> GetProjects()
        {
            var engagementList = _utilityCommonDbContext.Query <Engagement>().ToList();
            var projectList    = new List <Project>();

            foreach (Engagement engagement in engagementList)
            {
                var project = _commonMapper.MapBasicPropertiesOfEngagementToProject(engagement);
                projectList.Add(project);
            }
            //   var projectList = _context.Query<Project>().Where(p => p.ArchiveDate == null).ToList();
            return(projectList);
        }
Ejemplo n.º 4
0
        private List <NominationListViewModel> GetWinnersList(int month, int year, int awardId)
        {
            var customdate    = _customDateService.GetCustomDate(awardId);
            var award         = _encourageDatabaseContext.Query <Award>().FirstOrDefault(a => a.Id == awardId);
            var listOfWinners = new List <NominationListViewModel>();

            if (award != null)
            {
                _logger.Log("Home-GetWinnersList");

                int requiredMonth   = month != 0 ? month : customdate.Month;
                int requiredYear    = year != 0 ? year : customdate.Year;
                int requiredAwardId = award.Id;

                List <Shortlist> winners;
                switch (award.Code)
                {
                case "PINNACLE":
                    winners = _encourageDatabaseContext.Query <Shortlist>()
                              .Where(w =>
                                     w.IsWinner == true &&
                                     w.Nomination.AwardId == requiredAwardId &&
                                     w.WinningDate.Value.Year == requiredYear

                                     ).ToList();
                    break;

                default:
                    winners = _encourageDatabaseContext.Query <Shortlist>()
                              .Where(w =>
                                     w.IsWinner == true &&
                                     w.WinningDate.Value.Month == requiredMonth &&
                                     w.Nomination.AwardId == requiredAwardId &&
                                     w.WinningDate.Value.Year == requiredYear
                                     ).ToList();
                    break;
                }

                foreach (var winner in winners)
                {
                    var nomination = _encourageDatabaseContext.Query <Nomination>().FirstOrDefault(n => n.Id == winner.NominationId);
                    var nominee    = _commonDbContext.Query <User>().FirstOrDefault(u => u.ID == nomination.UserId);
                    var employeeId = nominee != null ? nominee.EmployeeID : string.Empty;

                    var winnerName     = _nominationService.GetNomineeNameOfCurrentNomination(winner.NominationId);
                    var awardMonthYear = _nominationService.GetAwardMonthAndYear(winner.NominationId);
                    var awardName      = _nominationService.GetAwardName(winner.NominationId);
                    var awardComment   = winner.WinningComment;

                    listOfWinners.Add(new NominationListViewModel()
                    {
                        DisplayName    = winnerName,
                        NominationTime = awardMonthYear,
                        AwardName      = awardName,
                        AwardComment   = awardComment,
                        EmployeeId     = employeeId
                    });
                }
            }

            return(listOfWinners);
        }
Ejemplo n.º 5
0
        public List <Engagement> GetProjectsUnderCurrentUserAsManager(string email)
        {
            var currentUser             = _CommonDbContext.Query <User>().SingleOrDefault(user => user.EmailAddress.Equals(email));
            var projectUnderCurrentUser = new List <Engagement>();
            var closedProject           = ConfigurationManager.AppSettings["ClosedEngagementStage"];
            var distinctClientIdsUnderCurrentManager = _CommonDbContext.Query <Engagement>().Where(engagement => engagement.PrimaryProjectManagerID == currentUser.ID).GroupBy(engagement => engagement.ClientID).ToList();

            foreach (var clientid in distinctClientIdsUnderCurrentManager)
            {
                var data           = _CommonDbContext.Query <Engagement>().FirstOrDefault(engagement => engagement.PrimaryProjectManagerID == currentUser.ID && engagement.ClientID == clientid.Key && engagement.Stage != closedProject);
                var firstOrDefault = _CommonDbContext.Query <Client>().FirstOrDefault(client => client.ID == clientid.Key);
                if (firstOrDefault != null && data != null)
                {
                    data.Name = firstOrDefault.Code;
                    projectUnderCurrentUser.Add(data);
                }
            }
            return(projectUnderCurrentUser);
        }