70 lines
2.2 KiB
C#
70 lines
2.2 KiB
C#
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 SubjectManage_Add : BasePage
|
||
{
|
||
DataService.BLL.pro_subject bll = new DataService.BLL.pro_subject();
|
||
DataService.BLL.admin_log log = new DataService.BLL.admin_log();
|
||
protected override void Page_Load(object sender, EventArgs e)
|
||
{
|
||
base.Page_Load(sender, e);
|
||
if (!IsPostBack)
|
||
{
|
||
BindFaultType(dp_fault, "");
|
||
BindSceneType(dp_scene, "");
|
||
}
|
||
}
|
||
protected void btnSure_Click(object sender, EventArgs e)
|
||
{
|
||
if (string.IsNullOrEmpty(subject_name.Text))
|
||
{
|
||
RadAjaxManager1.Alert("科目名称不能为空!");
|
||
return;
|
||
}
|
||
|
||
|
||
if (string.IsNullOrEmpty(dp_scene.SelectedValue))
|
||
{
|
||
RadAjaxManager1.Alert("场景不能为空!");
|
||
return;
|
||
}
|
||
|
||
|
||
if (bll.GetRecordCount(string.Format(" subject_name = '{0}' ", subject_name.Text.Trim())) > 0)
|
||
{
|
||
RadAjaxManager1.Alert("科目名称禁止重复!");
|
||
return;
|
||
}
|
||
|
||
DataService.Model.pro_subject model = new DataService.Model.pro_subject();
|
||
model.subject_id = bll.GetNewId();
|
||
model.subject_name = subject_name.Text.Trim();
|
||
model.dsc = dsc.Text.Trim();
|
||
model.scene_id = dp_scene.SelectedValue;
|
||
model.fault_id = dp_fault.SelectedValue;
|
||
model.create_time = DateTime.Now;
|
||
model.start_time = start_time.SelectedDate;
|
||
model.r1 = r1.Text;
|
||
|
||
|
||
if (bll.Add(model))
|
||
{
|
||
log.write_log("添加科目成功。" + "科目名称:" + subject_name.Text.Trim() + ",科目ID:" + model.subject_id);
|
||
RadAjaxManager1.ResponseScripts.Add("alert('添加成功!');CloseAndRebind();");
|
||
}
|
||
else
|
||
{
|
||
RadAjaxManager1.Alert("添加失败!");
|
||
|
||
}
|
||
}
|
||
}
|
||
} |