gyhlw_dotnet/网站项目/VRS/Management/VSAT/Examination_Add.aspx.cs

129 lines
4.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
namespace VRS.Management.VSAT
{
public partial class Examination_Add : BasePage
{
DataService.BLL.pro_exam_batch bll = new DataService.BLL.pro_exam_batch();
DataService.BLL.admin_log log = new DataService.BLL.admin_log();
DataService.BLL.admin_user bll_user = new DataService.BLL.admin_user();
DataService.BLL.pro_theory_base bll_theory_base = new DataService.BLL.pro_theory_base();
DataService.BLL.pro_examination bll_examination = new DataService.BLL.pro_examination();
DataService.BLL.pro_exam_theory bll_exam_theory = new DataService.BLL.pro_exam_theory();
protected override void Page_Load(object sender, EventArgs e)
{
base.Page_Load(sender, e);
if (!IsPostBack)
{
//var user = DataService.BLL.admin_user.load_login();
//var user_login = bll_user.GetModel(user.user_id);
DataLoad();
}
}
protected void DataLoad()
{
StringBuilder query = new StringBuilder(" 1 = 1 ");
var qry = query.ToString();
var list = bll_theory_base.GetModelList(qry);
dataList.DataSource = list;
dataList.Rebind();
}
protected void GridList_PageIndexChanged(object sender, GridPageChangedEventArgs e)
{
DataLoad();
}
protected void GridList_PageSizeChanged(object sender, GridPageSizeChangedEventArgs e)
{
DataLoad();
}
protected void GridList_SortCommand(object sender, GridSortCommandEventArgs e)
{
DataLoad();
}
protected void btnDelete_Click(object sender, EventArgs e)
{
if (bll_exam_theory.Delete(IdInput.Value))
{
DataLoad();
}
}
protected void btnSure_Click(object sender, EventArgs e)
{
DataService.Model.pro_examination model = new DataService.Model.pro_examination();
var user = DataService.BLL.admin_user.load_login();
if (string.IsNullOrEmpty(dp_exam_type.SelectedValue))
{
RadAjaxManager1.Alert("试卷类型不能为空!");
return;
}
/*
if (string.IsNullOrEmpty(question_name.Text.Trim()))
{
RadAjaxManager1.Alert("题干不能为空!");
return;
}
*/
/*
if (bll.GetRecordCount(string.Format(" batch_name = '{0}' and school_id='{1}' ", batch_name.Text.Trim(), model.school_id)) > 0)
{
RadAjaxManager1.Alert("考场名称禁止重复!");
return;
}
*/
model.id = BasePage.GetId();
model.exam_name = exam_name.Text;
//model.exam_code = exam_code.Text;
//model.exam_code = model.id;
model.exam_code = BasePage.GetTimeId();
model.exam_type = dp_exam_type.SelectedValue;
//限时
//model.limit_time = limit_time.Value.HasValue ? (int)limit_time.Value.Value : 60;
//model.exam_status = int.Parse(dp_exam_status.SelectedValue);
model.exam_status =1; //未发布
model.total_score = total_score.Value.HasValue ? total_score.Value.ToString() : "100";
model.pass_score = (decimal?)pass_score.Value;
model.r1 = r1.Text.Trim();
model.create_time = DateTime.Now;
model.create_by = user.user_id;
if (bll_examination.Add(model))
{
log.write_log("添加考试成功。" + "名称:" + model.exam_name + "id" + model.id);
RadAjaxManager1.ResponseScripts.Add("alert('添加成功!');CloseAndRebind();");
}
else
{
RadAjaxManager1.Alert("添加失败!");
}
}
//answer.Text = option_a.Text + "," + option_b.Text;
}
}