public QuestionnaireWithSelectedAnswersForUser(QuestionnaireWithSelectedAnswers questionniare, UserPurchase user)
        {
            this.Questionnaire = questionniare;

            UserData = new UserData();
            UserData.Email = user.Email;
            UserData.Name = user.Name;
            UserData.FacilityName = user.FacilityName;

            DemographicData = new DemographicDataContainer();
            DemographicData.SizeOfFacility = user.SizeOfFacility;
            DemographicData.IndustrialClassification = user.IndustrialClassification;
            DemographicData.AdditionalProductClassification = user.AdditionalProductClassification;
            DemographicData.AnotherProductClassification = user.AnotherProductClassification;

            SubmittedStatusForUser status = _context.SubmittedeStatusForUsers.SingleOrDefault(x => x.UserId == user.Id);
            WasEverSubmitted = (status != null);
            if (status != null)
            {
                lastSubmitted = status.SubmitedDate;
            }
        }
 public QuestionnaireFormCollectionParser(FormCollection formCollection)
 {
     QuestionAnswerMapping = new Dictionary<int, int>();
     DemographicData = new DemographicDataContainer();
     foreach (string _formData in formCollection.AllKeys)
     {
         try
         {
             int questionId = int.Parse(_formData);
             int answerId = int.Parse(formCollection[_formData]);
             QuestionAnswerMapping.Add(questionId, answerId);
         }
         catch
         {
             string value = formCollection[_formData];
             switch (_formData)
             {
                 case "DemographicData.SizeOfFacility":
                     DemographicData.SizeOfFacility =
                         EnumHelper.ParseEnum<FacilitySize?>(value);
                     break;
                 case "DemographicData.IndustrialClassification":
                     DemographicData.IndustrialClassification =
                         EnumHelper.ParseEnum<IndustrialClassification?>(value);
                     break;
                 case "DemographicData.AnotherProductClassification":
                     DemographicData.AnotherProductClassification =
                         EnumHelper.ParseEnum<AnotherProductClassification?>(value);
                     break;
                 case "DemographicData.AdditionalProductClassification":
                     DemographicData.AdditionalProductClassification =
                         EnumHelper.ParseEnum<AdditionalProductClassification?>(value);
                     break;
             }
         }
     }
 }