public void InitCurrentSurvey()
 {
     _pos                 = -1;
     CurrentReply         = new Reply();
     CurrentReply.Survey  = CurrentSurvey.Uuid;
     CurrentReply.Type    = CurrentSurvey.Type;
     CurrentReply.Answers = new List <Answer>();
 }
        public void Init(Survey survey)
        {
            _pos = -1;

            CurrentSurvey = survey;

            Questions = JsonConvert.DeserializeObject <List <Question> >(survey.Questions);

            Count = Questions.Count;

            CurrentReply         = new Reply();
            CurrentReply.Survey  = CurrentSurvey.Uuid;
            CurrentReply.Type    = CurrentSurvey.Type;
            CurrentReply.Answers = new List <Answer>();
        }
Exemplo n.º 3
0
        public async Task AddReplyAsync(Reply reply)
        {
            var realm = Realm.GetInstance(config);

            await realm.WriteAsync(r =>
            {
                var _r = new RealmObjects.Reply()
                {
                    SurveyId  = reply.Survey,
                    Date      = DateTimeOffset.Now,
                    Uploading = false,
                    Answer    = JsonConvert.SerializeObject(reply)
                };
                r.Add(_r);
            });
        }