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

92 lines
3.0 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.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace VRS.Management.ZHC
{
public partial class Fault_Tree_Edit : BasePage
{
DataService.BLL.zhc_fault_tree bll = new DataService.BLL.zhc_fault_tree();
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)
{
BindDeviceType("7", dp_logic, "");
string Id = Request.Params["Id"];
var model = bll.GetModel(Id);
if (string.IsNullOrEmpty(model.parent_id))
{
title.Text = "修改故障树";
span_name.InnerText = "故障树名称";
tr_parent.Visible = false;
}
else
{
title.Text = "修改节点";
span_name.InnerText = "节点名称";
tr_parent.Visible = true;
parent_full_name.InnerText = model.full_name;
}
DataLoad();
}
}
protected void DataLoad()
{
string Id = Request.Params["Id"];
if (!string.IsNullOrWhiteSpace(Id))
{
var model = bll.GetModel(Id);
name.Text = model.name;
dsc.Text = model.dsc;
position.Text = model.position.ToString();
dp_logic.SelectedValue = model.logic_gate;
dp_state.SelectedValue = model.state.ToString();
}
else
{
OnError(null);
}
}
protected void btnSure_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(name.Text))
{
RadAjaxManager1.Alert("故障树名称不能为空!");
return;
}
int position_value = 0;
if (!int.TryParse(position.Text, out position_value))
{
RadAjaxManager1.Alert("排序号不能为空或非整数!");
return;
}
DataService.Model.zhc_fault_tree model = bll.GetModel(Request.Params["Id"]);
model.name = name.Text.Trim();
model.dsc = dsc.Text.Trim();
model.position = position_value;
model.logic_gate = dp_logic.SelectedValue;
model.state = int.Parse(dp_state.SelectedValue);
if (bll.Update(model))
{
bll.UpdateFullName(model.tree_id);
log.write_log("修改故障树成功。" + "故障节点名称:" + name.Text.Trim() + "节点ID" + model.tree_id);
RadAjaxManager1.ResponseScripts.Add("alert('修改成功!');CloseAndRebind();");
}
else
RadAjaxManager1.Alert("修改失败!");
}
}
}