66 lines
2.1 KiB
C#
66 lines
2.1 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
|
||
namespace VRS.Management.VSAT
|
||
{
|
||
public partial class Fault_Edit : BasePage
|
||
{
|
||
DataService.BLL.pro_fault bll = new DataService.BLL.pro_fault();
|
||
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)
|
||
{
|
||
|
||
DataLoad();
|
||
}
|
||
}
|
||
|
||
protected void DataLoad()
|
||
{
|
||
string Id = Request.Params["Id"];
|
||
if (!string.IsNullOrWhiteSpace(Id))
|
||
{
|
||
var model = bll.GetModel(Id);
|
||
name.Text = model.fault_name;
|
||
code.Text = model.fault_code;
|
||
r1.Text = model.r1;
|
||
}
|
||
else
|
||
{
|
||
OnError(null);
|
||
}
|
||
}
|
||
|
||
protected void btnSure_Click(object sender, EventArgs e)
|
||
{
|
||
var id = Request.Params["Id"];
|
||
if (string.IsNullOrEmpty(name.Text.Trim()))
|
||
{
|
||
RadAjaxManager1.Alert("故障名称不能为空!");
|
||
return;
|
||
}
|
||
if (bll.GetRecordCount(string.Format(" fault_name = '{0}' and fault_id != {1}", name.Text.Trim(), id)) > 0)
|
||
{
|
||
RadAjaxManager1.Alert("故障名称禁止重复!");
|
||
return;
|
||
}
|
||
DataService.Model.pro_fault model = bll.GetModel(id);
|
||
model.fault_name = name.Text.Trim();
|
||
model.fault_code = code.Text.Trim();
|
||
model.r1 = r1.Text.Trim();
|
||
if (bll.Update(model))
|
||
{
|
||
log.write_log("修改故障成功。" + "名称:" + model.fault_name + ",id:" + model.fault_id);
|
||
RadAjaxManager1.ResponseScripts.Add("alert('修改成功!');CloseAndRebind();");
|
||
}
|
||
else
|
||
RadAjaxManager1.Alert("修改失败!");
|
||
}
|
||
}
|
||
} |