日期:2014-05-16 浏览次数:20838 次
protected void CheckPagerName_Click(object sender, EventArgs e)
{
AjaxCommond ac = new AjaxCommond();
SqlDataReader read = ExceRead("select * from Papermr where PaperName='" + this.txtPaperName.Text + "'");
read.Read();
if (read.HasRows)
{
if (this.txtPaperName.Text == read["PaperName"].ToString())
{
//弹出AJAX环境中的对话框
ac.OpenDialogForButton((Button)sender, "很遗憾!该试卷名称已经存在!!!");
}
}
else
{
//弹出AJAX环境中的对话框
ac.OpenDialogForButton((Button)sender, "恭喜您!该试卷名称可以添加!!!");
}
read.Close();
}
//将生成试卷保存到数据库
protected void imgBtnSave_Click(object sender, EventArgs e)
{
DataBase database = new DataBase();//实例化公共类DataBase
AjaxCommond ac = new AjaxCommond();//实例化公共类AjaxCommond
string insertExamPage = "insert into Papermr(CourseID,PaperName,PaperState) values(" + int.Parse(MyddlCourse.SelectedValue) + ",'" + txtPaperName.Text + "',1) SELECT @@IDENTITY as id";
int autopageID = GetIDInsert(insertExamPage);//保存试卷,并返回自动生成的试卷编号
if (autopageID > 0)
{
.....
.....
}
//弹出ajax环境中的提示对话框
ac.OpenDialogForButton((Button)sender, "数据保存成功!");
//跳转到试卷维护页
Response.Redirect("PaperLists.aspx");
}