149 lines
5.0 KiB
C#
149 lines
5.0 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using Telerik.Web.UI;
|
||
|
||
namespace VRS.Management.Exam
|
||
{
|
||
public partial class MatchScene_Edit : 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.admin_school bll_school = new DataService.BLL.admin_school();
|
||
|
||
DataService.BLL.pro_scene_open bll_open = new DataService.BLL.pro_scene_open();
|
||
protected override void Page_Load(object sender, EventArgs e)
|
||
{
|
||
base.Page_Load(sender, e);
|
||
if (!IsPostBack)
|
||
{
|
||
BindSceneBase(dp_scene, "");
|
||
DataLoad();
|
||
}
|
||
}
|
||
|
||
|
||
|
||
protected void DataLoad()
|
||
{
|
||
string Id = Request.Params["Id"];
|
||
if (!string.IsNullOrWhiteSpace(Id))
|
||
{
|
||
//BindExam(dp_exam, "");
|
||
|
||
var model = bll_open.GetModel(Id);
|
||
|
||
//var model = bll.GetModel(Id);
|
||
batch_name.Text = model.open_name;
|
||
|
||
//state.SelectedValue = model.state.ToString();
|
||
ks_minute.Text = model.span.ToString();
|
||
|
||
if (!string.IsNullOrWhiteSpace(model.school_id))
|
||
{
|
||
var school = bll_school.GetModel(model.school_id);
|
||
span_school.InnerText = school.school;
|
||
}
|
||
|
||
// BindSchoolGrade(model.school_id, dp_schoolgrade, "");
|
||
// dp_schoolgrade.SelectedValue = model.grade;
|
||
|
||
var value = model.school_id;
|
||
BindSchoolGrade(value, cbx_schoolgrade);
|
||
|
||
var grade = model.grade;
|
||
if (!string.IsNullOrEmpty(grade))
|
||
{
|
||
var sub = grade.Split(new char[] {','},StringSplitOptions.RemoveEmptyEntries);
|
||
foreach(RadComboBoxItem item in cbx_schoolgrade.Items)
|
||
{
|
||
if (sub.Contains(item.Text))
|
||
{
|
||
item.Checked = true;
|
||
}
|
||
}
|
||
//cbx_schoolgrade.Text = grade;
|
||
}
|
||
|
||
|
||
//dp_exam.SelectedValue = model.exam_id;
|
||
|
||
ddp_state.SelectedValue = model.state.ToString();
|
||
if (model.start_time.HasValue)
|
||
{
|
||
start_time.Value = model.start_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
||
}
|
||
if (model.end_time.HasValue)
|
||
{
|
||
end_time.Value = model.end_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
||
}
|
||
dp_scene.SelectedValue = model.scene_id;
|
||
}
|
||
else
|
||
{
|
||
OnError(null);
|
||
}
|
||
}
|
||
|
||
protected void btnSure_Click(object sender, EventArgs e)
|
||
{
|
||
if (string.IsNullOrEmpty(dp_scene.SelectedValue))
|
||
{
|
||
RadAjaxManager1.Alert("场景不能为空!");
|
||
return;
|
||
}
|
||
|
||
var model = bll_open.GetModel(Request.Params["Id"]);
|
||
|
||
var id = Request.Params["Id"];
|
||
|
||
|
||
/*
|
||
if (string.IsNullOrWhiteSpace(dp_schoolgrade.SelectedValue))
|
||
{
|
||
RadAjaxManager1.Alert("请选择班级!");
|
||
return;
|
||
}
|
||
model.grade = dp_schoolgrade.SelectedValue;
|
||
*/
|
||
if (!string.IsNullOrWhiteSpace(start_time.Value))
|
||
{
|
||
model.start_time = DateTime.Parse(start_time.Value);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(end_time.Value))
|
||
{
|
||
model.end_time = DateTime.Parse(end_time.Value);
|
||
}
|
||
|
||
|
||
var ts = model.end_time.Value.Subtract(model.start_time.Value).TotalSeconds;
|
||
int minute = (int)ts / 60;
|
||
|
||
model.span = minute;
|
||
//model.open_name = batch_name.Text.Trim();
|
||
|
||
model.scene_name = dp_scene.SelectedText;
|
||
model.scene_id = dp_scene.SelectedValue;
|
||
|
||
var list = cbx_schoolgrade.CheckedItems.ToList();
|
||
string grade = string.Join(",", list.Select(s => s.Text).ToArray());
|
||
model.grade = grade;
|
||
|
||
// model.exam_id = dp_exam.SelectedValue;
|
||
model.state = int.Parse(ddp_state.SelectedValue); //单独修改
|
||
|
||
if (bll_open.Update(model))
|
||
{
|
||
log.write_log("修改场景成功。" + "场景名称:" + batch_name.Text.Trim() + ",场景id:" + model.open_id);
|
||
RadAjaxManager1.ResponseScripts.Add("alert('修改成功!');CloseAndRebind();");
|
||
}
|
||
else
|
||
RadAjaxManager1.Alert("修改失败!");
|
||
}
|
||
}
|
||
} |