📄 admin_polladd.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class admin_pollAdd : sp.pagebase
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
{
add_qusetion();
}
protected void Wizard1_next_Click1(object sender, WizardNavigationEventArgs e)
{
addentxxt();
}
void addentxxt()
{
if (this.DropDownList1.SelectedValue == "1")
{
//TextBox tx = new TextBox();
//tx.TextMode = TextBoxMode.MultiLine;
//tx.Width = 240;
//tx.Height = 180;
//tx.ID = "tx";
//PlaceHolder1.Controls.Add(tx);
Label1.Text = "en";
//this.txtanswer_cn.Text = this.txtv_css.Text;
TextBox_answer_cn.Visible = true;
}
}
void add_qusetion()
{
string v_title = this.title.Text;
int v_language = int.Parse(this.DropDownList1.SelectedValue);
string v_css = this.txtv_css.Text;
string multiple = this.multiple.SelectedValue;
sp.Model.sp_question model = new sp.Model.sp_question();
model.v_title = v_title;
model.v_language = v_language;
model.v_css = v_css;
model.multiple = bool.Parse(multiple);
sp.SQLServerDAL.sp_question sq = new sp.SQLServerDAL.sp_question();
sq.Add(model);
sp.SQLServerDAL.sp_answer sa = new sp.SQLServerDAL.sp_answer();
string answer_cn = this.txtanswer_cn.Text;
string answer_en = string.Empty;
if (v_language == 1)
{
TextBox txtanswer_en = new TextBox();
txtanswer_en = (TextBox)this.PlaceHolder1.FindControl("Wizard1$tx");
answer_en = TextBox_answer_cn.Text;
}
int amount = 0;
int for_question = sq.GetMaxId();
sp.Model.sp_answer samodel = new sp.Model.sp_answer();
string[] answercn = answer_cn.Split('\n');
string[] answeren = answer_cn.Split('\n');
for (int i = 0; i < answercn.Length; i++)
{
samodel.answer_cn = answercn[i];
if (v_language == 1)
{ samodel.answer_en = answeren[i]; }
else
{ samodel.answer_en = answer_en; }
samodel.amount = amount;
samodel.for_question = for_question;
sa.Add(samodel);
}
sp.MessageBox.Show(this.Page,"添加成功!");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -