Ejemplo n.º 1
0
        public static bool Update(int surveyId, SurveyFieldInfo info)
        {
            int num = -1;
            IList <SurveyFieldInfo> fieldList = GetFieldList(surveyId);

            for (int i = 0; i < fieldList.Count; i++)
            {
                if (fieldList[i].QuestionId == info.QuestionId)
                {
                    num = i;
                    break;
                }
            }
            if (num == -1)
            {
                return(false);
            }
            fieldList[num] = info;
            if (info.Settings != null)
            {
                SurveyVote.Delete(surveyId, info.QuestionId);
                SurveyVote.Add(surveyId, info.QuestionId, info.Settings.Count);
            }
            return(dal.Update(surveyId, SerializeFieldList(fieldList)));
        }
Ejemplo n.º 2
0
        public static bool Add(int surveyId, SurveyFieldInfo info)
        {
            IList <SurveyFieldInfo> fieldList = GetFieldList(surveyId);

            info.QuestionId = SurveyManager.GetSurveyById(surveyId).QuestionMaxId + 1;
            fieldList.Add(info);
            if (info.Settings != null)
            {
                SurveyVote.Add(surveyId, info.QuestionId, info.Settings.Count);
            }
            return(dal.Add(surveyId, SerializeFieldList(fieldList)));
        }