Exemplo n.º 1
0
        public static bool Delete(int surveyId, int questionId)
        {
            SurveyFieldInfo fieldInfoById = new SurveyFieldInfo();

            fieldInfoById = GetFieldInfoById(surveyId, questionId);
            XmlManage manage = XmlManage.Instance(GetXmlFieldBySurveyId(surveyId), XmlType.Content);

            manage.Remove(GetNodePath(questionId));
            bool flag = dal.Delete(surveyId, manage.Xml);

            if (flag)
            {
                SurveyVote.Delete(surveyId, questionId);
                DeleteColumn(questionId, surveyId);
                if ((fieldInfoById.QuestionType != 2) && (fieldInfoById.QuestionType != 3))
                {
                    return(flag);
                }
                if (fieldInfoById.InputType != 0)
                {
                    DeleteInputColumn(questionId, surveyId);
                }
            }
            return(flag);
        }
Exemplo n.º 2
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)));
        }
Exemplo n.º 3
0
        public static bool BatchDelete(int surveyId, string questionIds)
        {
            bool flag = false;

            if (!string.IsNullOrEmpty(questionIds))
            {
                XmlManage manage   = XmlManage.Instance(GetXmlFieldBySurveyId(surveyId), XmlType.Content);
                string[]  strArray = questionIds.Split(new char[] { ',' });
                for (int i = 0; i < strArray.Length; i++)
                {
                    SurveyFieldInfo fieldInfoById = new SurveyFieldInfo();
                    fieldInfoById = GetFieldInfoById(surveyId, DataConverter.CLng(strArray[i]));
                    manage.Remove(GetNodePath(DataConverter.CLng(strArray[i])));
                    DeleteColumn(DataConverter.CLng(strArray[i]), surveyId);
                    if (((fieldInfoById.QuestionType == 2) || (fieldInfoById.QuestionType == 3)) && (fieldInfoById.InputType != 0))
                    {
                        DeleteInputColumn(DataConverter.CLng(strArray[i]), surveyId);
                    }
                }
                flag = dal.Update(surveyId, manage.Xml);
                if (flag)
                {
                    SurveyVote.Delete(surveyId, questionIds);
                }
            }
            return(flag);
        }
Exemplo n.º 4
0
        public static bool Delete(string surveyId)
        {
            bool flag = false;

            if (!string.IsNullOrEmpty(surveyId) && DataValidator.IsValidId(surveyId))
            {
                flag = dal.Delete(surveyId);
                if (!flag)
                {
                    return(flag);
                }
                SurveyVote.Delete(surveyId);
                foreach (string str in surveyId.Split(new char[] { ',' }))
                {
                    SurveyRecord.DeleteTable(DataConverter.CLng(str));
                }
            }
            return(flag);
        }