Exemplo n.º 1
0
        public void ShortlistNomination(int nominationId, int adminId)
        {
            var shortlistedNomination = new Shortlist()
            {
                IsWinner         = false,
                NominationId     = nominationId,
                HrAdminsFeedback = string.Empty,
                AdminId          = adminId
            };

            _encourageDatabaseContext.Add <Shortlist>(shortlistedNomination);
        }
Exemplo n.º 2
0
        public EmailTemplate SaveEmailTemplate(string templateName, string template)
        {
            EmailTemplate newTemplate = new EmailTemplate();

            newTemplate.TemplateName = templateName;
            newTemplate.Template     = template;

            return(_encourageDatabaseContext.Add(newTemplate));
        }
Exemplo n.º 3
0
 public bool AddNomination(Nomination nomination)
 {
     try
     {
         _encourageDbcontext.Add <Nomination>(nomination);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 4
0
        public bool SetCustomDate(int awardId, int month, int year, bool isApplicable)
        {
            var customDatesForAward = _encourageDbcontext.Query <CustomDate>().FirstOrDefault(x => x.AwardId == awardId);

            if (customDatesForAward != null)
            {
                if (month > 0)
                {
                    customDatesForAward.Month        = month;
                    customDatesForAward.Year         = year;
                    customDatesForAward.IsApplicable = isApplicable;
                    _encourageDbcontext.Update(customDatesForAward);
                    return(true);
                }
                else if (year > 0)
                {
                    customDatesForAward.Year         = year;
                    customDatesForAward.IsApplicable = isApplicable;
                    _encourageDbcontext.Update(customDatesForAward);
                    return(true);
                }
            }

            if (month > 0)
            {
                _encourageDbcontext.Add(new CustomDate {
                    AwardId = awardId, Month = month, Year = year, IsApplicable = isApplicable
                });
                return(true);
            }
            else if (year > 0)
            {
                _encourageDbcontext.Add(new CustomDate {
                    AwardId = awardId, Month = DateTime.Today.Month, Year = year, IsApplicable = isApplicable
                });
                return(true);
            }
            return(false);
        }
Exemplo n.º 5
0
 public bool AddReviewer(int userId)
 {
     try
     {
         if (!_encourageDatabaseContext.Query <Reviewer>().Any(r => r.UserId == userId))
         {
             _encourageDatabaseContext.Add <Reviewer>(new Reviewer
             {
                 UserId = userId
             });
             _encourageDatabaseContext.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
     return(false);
 }
Exemplo n.º 6
0
 public void AddReviewForCurrentNomination(Review review)
 {
     _encourageDatabaseContext.Add(review);
     _encourageDatabaseContext.SaveChanges();
 }