加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Mark.aspx.cs 2.40 KB
一键复制 编辑 原始数据 按行查看 历史
mby 提交于 2013-10-07 19:50 . jQuery validation 修改
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using cn.edu.jnmc.pb;
public partial class Mark : System.Web.UI.Page
{
private const int ARTICLE_NUM = 6;
//private string[] articleTitles;
private OleDbConnection conn;
protected void Page_Load(object sender, EventArgs e)
{
conn = DatabaseService.DBopen();
if (!IsPostBack)
{
}
if (!string.IsNullOrEmpty(Request.Form["mark"]))
{
saveScore();
}
}
private void saveScore()
{
string[] studentScores = new string[6]; //= Request.Form["stuscore"].Split(',');
string[] teacherScores = new string[6]; //= Request.Form["tchscore"].Split(',');
string insertSql = "insert into article_score (article_id, name, student_score, teacher_score) values({0},'{1}',{2},{3});";
bool founderr = false;
string msg = "";
double fen;
for (int i = 0; i < ARTICLE_NUM; i++)
{
string studentScore = Request.Form["stuscore" + (i + 1)];
string teacherScore = Request.Form["tchscore" + (i + 1)]; ;
if (!double.TryParse(studentScore, out fen) || !double.TryParse(teacherScore, out fen))
{
founderr = true; break;
}
studentScores[i] = studentScore;
teacherScores[i] = teacherScore;
}
if (founderr)
{
ClientScript.RegisterStartupScript(this.GetType(), "ss", "alert('数据填写出错,请完整填写后重新提交!');", true);
return;
}
for (int i = 0; i < ARTICLE_NUM; i++)
{
DatabaseService.executeCommendSQL(string.Format(insertSql,(i+1),"",double.Parse(studentScores[i]),double.Parse(teacherScores[i])), conn);
}
Response.Redirect("Default.aspx");
}
private void initList()
{
//articleTitles = new string[ARTICLE_NUM]
//{
// "GSZ 英语翻译竞赛参评译文",
// "GZG 英语翻译竞赛参评译文",
// "LLM 英语翻译竞赛参评译文",
// "LXM 英语翻译竞赛参评译文",
// "LYF 英语翻译竞赛参评译文",
// "XS 英语翻译竞赛参评译文"
//};
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化