📄 surveycreate.cs
字号:
builder.Append(" {\r\n");
builder.Append(" Response.Redirect(\"../User/Login.aspx?ReturnUrl=\" + HttpUtility.UrlEncode(url));\r\n");
builder.Append(" }\r\n");
builder.Append(" }\r\n");
builder.Append(" }\r\n");
builder.Append("</script>\r\n");
createContent = createContent + "\r\n" + builder.ToString();
return createContent;
}
private static string GetSurveyContent(IList<SurveyFieldInfo> infoList)
{
int num = 1;
StringBuilder builder = new StringBuilder();
foreach (SurveyFieldInfo info in infoList)
{
int num2;
int num3;
int num4;
int num5;
switch (info.QuestionType)
{
case 0:
builder.Append(num + "、" + info.QuestionContent);
builder.Append(string.Concat(new object[] { "<input type='text' MaxLength='", info.ContentLength, "' name='Q", info.QuestionId, "'><br /><br />\n" }));
goto Label_0713;
case 1:
builder.Append(num + "、" + info.QuestionContent);
builder.Append("<br /> <textarea name='Q" + info.QuestionId + "' cols='50' rows='5'></textarea><br /><br />\n");
goto Label_0713;
case 2:
builder.Append(string.Concat(new object[] { num, "、", info.QuestionContent, "<br />" }));
num2 = 0;
goto Label_01B4;
case 3:
builder.Append(string.Concat(new object[] { num, "、", info.QuestionContent, "<br />\n" }));
num3 = 0;
goto Label_0314;
case 4:
builder.Append(string.Concat(new object[] { num, "、", info.QuestionContent, ":\n" }));
builder.Append("<select name='Q" + info.QuestionId + "'>\n");
num4 = 0;
goto Label_047E;
case 5:
builder.Append(string.Concat(new object[] { num, "、", info.QuestionContent, ":" }));
builder.Append("<br /> \n<select multiple name='Q" + info.QuestionId + "'>\n");
num5 = 0;
goto Label_0553;
case 6:
builder.Append(num + "、" + info.QuestionContent);
builder.Append("<input type='text' name='Q" + info.QuestionId + "'><br /><br />\n");
goto Label_0713;
case 7:
builder.Append(string.Concat(new object[] { num, "、", info.QuestionContent, ":\n" }));
builder.Append(" <input name='Q" + info.QuestionId + "' type='radio' value='1'>是\n");
builder.Append(" <input name='Q" + info.QuestionId + "' type='radio' value='0'>否<br /><br />\n");
goto Label_0713;
case 8:
builder.Append(num + "、" + info.QuestionContent);
builder.Append(string.Concat(new object[] { "<input type='text' MaxLength='", info.ContentLength, "' name='Q", info.QuestionId, "'><br /><br />\n" }));
goto Label_0713;
case 9:
builder.Append(num + "、" + info.QuestionContent);
builder.Append(string.Concat(new object[] { "<input type='text' MaxLength='", info.ContentLength, "' name='Q", info.QuestionId, "'><br /><br />\n" }));
goto Label_0713;
default:
goto Label_0713;
}
Label_014D:;
builder.Append(string.Concat(new object[] { " <input name='Q", info.QuestionId, "' type='radio' value='", num2, "'>", info.Settings[num2], "<br />\n" }));
num2++;
Label_01B4:
if (num2 != info.Settings.Count)
{
goto Label_014D;
}
switch (info.InputType)
{
case 1:
builder.Append(string.Concat(new object[] { " <input type='text' name='Q", info.QuestionId, "Input' MaxLength='", info.ContentLength, "'><br /><br />\n" }));
goto Label_0713;
case 2:
builder.Append(" <textarea name='Q" + info.QuestionId + "Input' cols='50' rows='5'></textarea><br /><br />\n");
goto Label_0713;
default:
builder.Append("<br />");
goto Label_0713;
}
Label_02A9:;
builder.Append(string.Concat(new object[] { " <input name='Q", info.QuestionId, "' type='checkbox' value='", num3, "'>", info.Settings[num3], "<br />\n" }));
num3++;
Label_0314:
if (num3 != info.Settings.Count)
{
goto Label_02A9;
}
switch (info.InputType)
{
case 1:
builder.Append(string.Concat(new object[] { " <input type='text' name='Q", info.QuestionId, "Input' MaxLength='", info.ContentLength, "'><br /><br />\n" }));
goto Label_0713;
case 2:
builder.Append(" <textarea name='Q" + info.QuestionId + "Input' cols='50' rows='5'></textarea><br /><br />\n");
goto Label_0713;
default:
builder.Append("<br />");
goto Label_0713;
}
Label_042B:;
builder.Append(string.Concat(new object[] { " <option value='", num4, "'>", info.Settings[num4], "</option>\n" }));
num4++;
Label_047E:
if (num4 != info.Settings.Count)
{
goto Label_042B;
}
builder.Append("</select><br /><br />\n");
goto Label_0713;
Label_0500:;
builder.Append(string.Concat(new object[] { " <option value='", num5, "'>", info.Settings[num5], "</option>\n" }));
num5++;
Label_0553:
if (num5 != info.Settings.Count)
{
goto Label_0500;
}
builder.Append("</select><br /><br />\n");
Label_0713:
num++;
}
return builder.ToString();
}
public static string GetSurveyTemplate(SurveyInfo info)
{
StringBuilder builder = new StringBuilder(0x80);
IList<SurveyFieldInfo> fieldList = SurveyField.GetFieldList(info.SurveyId);
builder.AppendLine("<form name='myform' method='post' action='../Survey/SurveySave.aspx' onSubmit='return CheckForm();'>\n");
builder.AppendLine("<TABLE cellSpacing=0 cellPadding=0 width=100% border=0>");
builder.AppendLine("<TBODY>");
builder.AppendLine("<TR>");
builder.AppendLine("<TD vAlign=top height=500>");
builder.AppendLine("<P align=center>" + info.SurveyName + "</P>");
if (!string.IsNullOrEmpty(info.SetPassword))
{
builder.AppendLine("请输入问卷密码:<input type='password' name='SurveyPassword'><br /><br />");
}
builder.AppendLine(GetSurveyContent(fieldList));
builder.AppendLine("<input name='SurveyID' type='hidden' id='SurveyID' value='" + info.SurveyId + "'>");
builder.AppendLine("</TD>");
builder.AppendLine("</TR>");
builder.AppendLine("</TBODY>");
builder.AppendLine("</TABLE>");
builder.AppendLine("<P align=center>");
builder.AppendLine(" <INPUT type=submit value=提交问卷 name=Submit>");
builder.AppendLine("</P></form>\n");
string templateContent = GetTemplateContent(info.Template);
StringBuilder builder2 = new StringBuilder();
builder2.Append("<script language='javascript'>\n");
builder2.Append("function CheckForm(){\n");
builder2.Append("flag=true;\n");
foreach (SurveyFieldInfo info2 in fieldList)
{
builder2.Append("\n" + GetFormJS(info2) + "");
}
builder2.Append("return flag }\n");
builder2.Append("</script>\n");
return templateContent.Replace("{PE.SurveyJS/}", builder2.ToString()).Replace("{PE.SurveyName/}", info.SurveyName).Replace("{PE.GetSurveyForm/}", builder.ToString());
}
private static string GetTemplateContent(string templatePath)
{
TemplateInfo templateInfo = new TemplateInfo();
templateInfo.QueryList = HttpContext.Current.Request.QueryString;
templateInfo.PageName = "SurveyFormCreate.aspx";
templateInfo.TemplateContent = Template.GetTemplateContent(templatePath);
templateInfo.RootPath = HttpContext.Current.Request.PhysicalApplicationPath;
templateInfo.CurrentPage = DataConverter.CLng(HttpContext.Current.Request.QueryString["page"], 1);
return TemplateTransform.GetHtml(templateInfo).TemplateContent;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -