protected void BtnOrderId_Click(object sender, EventArgs e) { IList <SurveyFieldInfo> fieldList = SurveyField.GetFieldList(this.surveyId); Dictionary <int, SurveyFieldInfo> temdic = new Dictionary <int, SurveyFieldInfo>(); int count = fieldList.Count; int num2 = 0; foreach (GridViewRow row in this.EgvQuestion.Rows) { if (row.RowType == DataControlRowType.DataRow) { int key = DataConverter.CLng(((DropDownList)row.FindControl("DropOrderId")).SelectedValue); temdic.Add(key, fieldList[num2]); num2++; } } if (SurveyField.Update(this.surveyId, this.Sort(temdic, count))) { AdminPage.WriteSuccessMsg("保存排序成功!", "QuestionManage.aspx?SurveyID=" + this.surveyId); } else { AdminPage.WriteErrMsg("保存排序失败!"); } }
protected void BtnSubmit_Click(object sender, EventArgs e) { if (this.Page.IsValid) { bool flag = false; SurveyFieldInfo info = new SurveyFieldInfo(); int num = DataConverter.CLng(this.RadlQuestionType.SelectedValue); switch (num) { case 2: case 3: case 4: case 5: { string[] settings = this.TxtSettings.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); info.CopyToSettings(settings); break; } case 7: info.CopyToSettings(new string[] { "0", "1" }); break; default: info.CopyToSettings(new string[] { "" }); break; } info.QuestionContent = this.TxtQuestionContent.Text; info.QuestionType = num; info.EnableNull = DataConverter.CBoolean(this.RadlEnableNull.SelectedValue); info.InputType = DataConverter.CLng(this.RadlInputType.SelectedValue); info.ContentLength = DataConverter.CLng(this.TxtContentLength.Text); if (this.m_Action == "modify") { info.QuestionId = DataConverter.CLng(this.HdnQuestionId.Value); flag = SurveyField.Update(this.m_SurveyId, info); } else { flag = SurveyField.Add(this.m_SurveyId, info); if (DataConverter.CLng(this.HdnIsOpen.Value) == 2) { string tableName = "PE_SurveyRecord" + this.m_SurveyId; flag = flag && SurveyField.AddFieldToTable(info, tableName); } } if (flag) { AdminPage.WriteSuccessMsg("保存题目信息成功!", "QuestionManage.aspx?SurveyID=" + this.m_SurveyId); } else { AdminPage.WriteErrMsg("<li>保存题目信息失败!</li>"); } } }