gyhlw_dotnet/网站项目/VRS/Management/ZHC/Dev_Edit.aspx.cs

66 lines
2.0 KiB
C#
Raw Permalink 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.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace VRS.Management.ZHC
{
public partial class Dev_Edit : BasePage
{
DataService.BLL.zhc_dev bll = new DataService.BLL.zhc_dev();
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.name;
info.Text = model.info;
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(" name = '{0}' and id != {1}", name.Text.Trim(), id)) > 0)
{
RadAjaxManager1.Alert("设备名称禁止重复!");
return;
}
DataService.Model.zhc_dev model = bll.GetModel(id);
model.name = name.Text.Trim();
model.info = info.Text.Trim();
model.r1 = r1.Text.Trim();
if (bll.Update(model))
{
log.write_log("修改设备名称成功。" + "名称:" + model.name + "ID" + model.id);
RadAjaxManager1.ResponseScripts.Add("alert('修改成功!');CloseAndRebind();");
}
else
RadAjaxManager1.Alert("修改失败!");
}
}
}