protected void CheckInsert() { M_Survey info = surBll.GetSurveyBySid(Sid); //判断是否登录 DateTime SubmitDate = DateTime.Now; string SIP = Request.UserHostAddress; int UserID = GetUserID(info); //判断是否已参与了该问卷 if (B_Survey.HasAnswerBySID(Sid, UserID)) { function.WriteErrMsg("您已提交过该问卷!"); } if (info.IPRepeat > 0) { if (B_Survey.HasAnswerCountIP(Sid, SIP) >= info.IPRepeat) { function.WriteErrMsg("于IP:" + SIP + " 提交的问卷次数已达到限定次数:" + info.IPRepeat.ToString() + "次!"); } } IList <M_Question> list = new List <M_Question>(); list = B_Survey.GetQueList(Sid); for (int i = 0; i < list.Count; i++) { M_Answer ans = new M_Answer(); string re = Request.Form["vote_" + i]; string[] OptionValue = list[i].QuestionContent.Split(new char[] { '|' }); if (string.IsNullOrEmpty(re)) { re = ""; } if (list[i].TypeID == 1) { if (list[i].IsNull && string.IsNullOrEmpty(Request.Form["vote_" + i])) { function.WriteErrMsg(list[i].QuestionTitle + ":为必填选项"); } //ans.AnswerID = 0; ans.AnswerContent = DataConvert.CStr(re); ans.AnswerScore = surBll.GetScoreByContent(list[i].QuestionContent, re); ans.QuestionID = list[i].QuestionID; ans.SurveyID = Sid; ans.SubmitIP = SIP; ans.SubmitDate = SubmitDate; ans.UserID = UserID; B_Survey.AddAnswer(ans); } else { string[] ReArr = re.Split(new char[] { ',' }); for (int s = 0; s < ReArr.Length; s++) { //ans.AnswerID = 0; ans.AnswerContent = DataConvert.CStr(ReArr[s]); ans.QuestionID = list[i].QuestionID; ans.SurveyID = Sid; ans.SubmitIP = SIP; ans.SubmitDate = SubmitDate; ans.UserID = UserID; B_Survey.AddAnswer(ans); } } } }