Ejemplo n.º 1
0
        /// <summary>
        /// Reschedule the instance of the chosen SurveyAnswer.
        /// </summary>
        public void Reschedule()
        {
            ScheduleController.reschedule(chosenSurvey);
            string rescheduled = JSonTranslator.Serialize(chosenSurvey);

            IOController.SaveFile(rescheduled, chosenSurvey.Survey.SurveyName + "_" + chosenSurvey.Survey.SurveyId.ToString().Substring(0, 4), Constants.toFillFolder);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Mockup class simulating actual connection for the new surveys.
        /// </summary>
        public void DownloadNewSurveys()
        {
            // this part is actually faking the connection to the Internet
            Assembly assembly = GetType().GetTypeInfo().Assembly;
            string   resource = "Surveys.SerializedSurveys.MedicalSurvey.json";
            string   ss;

            using (Stream stream = assembly.GetManifestResourceStream(resource))
            {
                using (StreamReader reader = new StreamReader(stream))
                {
                    var stringTask = reader.ReadToEndAsync();
                    ss = stringTask.Result;
                }
            }

            // process and save in the desired directory
            Survey s = JSonTranslator.Deserialize <Survey> (ss);

            IOController.SaveFile(ss, s.SurveyName, Constants.schemasFolder);
        }