Beispiel #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);
        }
        public EmailTemplate SaveEmailTemplate(string templateName, string template)
        {
            EmailTemplate newTemplate = new EmailTemplate();

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

            return(_encourageDatabaseContext.Add(newTemplate));
        }
Beispiel #3
0
 public bool AddNomination(Nomination nomination)
 {
     try
     {
         _encourageDbcontext.Add <Nomination>(nomination);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Beispiel #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);
        }
Beispiel #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);
 }
 public void AddReviewForCurrentNomination(Review review)
 {
     _encourageDatabaseContext.Add(review);
     _encourageDatabaseContext.SaveChanges();
 }