Ejemplo n.º 1
0
        public override bool IsTheFirstEntryForUser(long userId)
        {
            GenericError error;
            List <QuestionnaireAnswers> entries = YearlyQuestionnaireAnswersRepository.GetEntities(out error, d => d.UserId == userId);

            return(entries == null || entries.Count == 0);
        }
Ejemplo n.º 2
0
        public override QuestionnaireAnswers GetLattestRecord(long userId)
        {
            GenericError error;
            var          records = YearlyQuestionnaireAnswersRepository.GetEntities(out error, d => d.UserId == userId);


            if (records.Any())
            {
                records.Sort((d1, d2) => DateTime.Compare(d1.Date, d2.Date));
                return(records.Last());
            }
            return(new QuestionnaireAnswers());
        }
Ejemplo n.º 3
0
        public override bool AddNewRecordToDataBase(QuestionnaireAnswers energyLevel)
        {
            GenericError error = null;

            try
            {
                YearlyQuestionnaireAnswersRepository.InsertEntity(out error, energyLevel);
                if (error != null)
                {
                    return(false);
                }
                return(true);
            }
            catch (Exception ex)
            {
                Logger.Controller.LogError(ex);
                error = ErrorClasses.Controller.GetUnknownError();
                return(false);
            }
        }