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

91 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 Menu_Tree_Edit : BasePage
{
DataService.BLL.zhc_menu_tree bll = new DataService.BLL.zhc_menu_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)
{
string Id = Request.Params["Id"];
var model = bll.GetModel(Id);
if (string.IsNullOrEmpty(model.parentId))
{
tr_parent.Visible = false;
}
else
{
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;
type.Text = model.type;
position.Text = model.position.ToString();
dp_state.SelectedValue = model.state;
info.Text = model.info;
stakeNo.Text = model.stakeNo;
component.Text = model.component;
equipment.Text = model.equipment;
}
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_menu_tree model = bll.GetModel(Request.Params["Id"]);
model.name = name.Text.Trim();
model.type = type.Text.Trim();
model.position = position_value;
model.state = dp_state.SelectedValue;
model.info = info.Text.Trim();
model.stakeNo = stakeNo.Text.Trim();
model.component = component.Text.Trim();
model.equipment = equipment.Text.Trim();
if (bll.Update(model))
{
bll.UpdateFullName(model.id);
log.write_log("修改菜单树成功。" + "菜单节点名称:" + name.Text.Trim() + "节点ID" + model.id);
RadAjaxManager1.ResponseScripts.Add("alert('修改成功!');CloseAndRebind();");
}
else
RadAjaxManager1.Alert("修改失败!");
}
}
}