129 lines
4.8 KiB
C#
129 lines
4.8 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.ZHC
|
|
{
|
|
public partial class Fault_Tree : BasePage
|
|
{
|
|
|
|
DataService.BLL.admin_log log = new DataService.BLL.admin_log();
|
|
DataService.BLL.zhc_fault_tree bll_fault_tree = new DataService.BLL.zhc_fault_tree();
|
|
protected override void Page_Load(object sender, EventArgs e)
|
|
{
|
|
base.Page_Load(sender, e);
|
|
if (!IsPostBack)
|
|
{
|
|
VerifyPermissions("10004");
|
|
RadTreeList1.ExpandedIndexes.Add(new TreeListHierarchyIndex { LevelIndex = 0, NestedLevel = 0 });
|
|
RadTreeList1.ExpandedIndexes.Add(new TreeListHierarchyIndex { LevelIndex = 1, NestedLevel = 0 });
|
|
RadTreeList1.ExpandedIndexes.Add(new TreeListHierarchyIndex { LevelIndex = 2, NestedLevel = 0 });
|
|
RadTreeList1.ExpandedIndexes.Add(new TreeListHierarchyIndex { LevelIndex = 3, NestedLevel = 0 });
|
|
BindFaultList(dp_fault_list, "");
|
|
DataLoad();
|
|
}
|
|
}
|
|
|
|
protected void DataLoad()
|
|
{
|
|
//var list = bll_fault_tree.GetModelList("");
|
|
//RadTreeList1.DataSource = list;
|
|
var query = "";
|
|
if (!string.IsNullOrEmpty(dp_fault_list.SelectedValue))
|
|
{
|
|
query = string.Format(" fault_list_id='{0}' ", dp_fault_list.SelectedValue);
|
|
}
|
|
var dt = bll_fault_tree.GetListWithFault(query).Tables[0];
|
|
RadTreeList1.DataSource = dt;
|
|
}
|
|
|
|
protected void DataLoad_1()
|
|
{
|
|
StringBuilder query = new StringBuilder(" 1 = 1 ");
|
|
RadTreeList1.DataSource = MyData.GetData();
|
|
}
|
|
|
|
protected void RadTreeList1_NeedDataSource(object sender, TreeListNeedDataSourceEventArgs e)
|
|
{
|
|
DataLoad();
|
|
}
|
|
|
|
#region
|
|
|
|
#endregion
|
|
protected void AjaxManager_AjaxRequest(object sender, AjaxRequestEventArgs e)
|
|
{
|
|
DataLoad();
|
|
}
|
|
|
|
protected void btnSelect_Click(object sender, EventArgs e)
|
|
{
|
|
DataLoad();
|
|
}
|
|
|
|
protected void btnDelete_Click(object sender, EventArgs e)
|
|
{
|
|
var count = bll_fault_tree.GetRecordCount(" parent_id = " + IdInput.Value);
|
|
if (count > 0)
|
|
{
|
|
RadAjaxManager1.Alert("有子节点无法删除!");
|
|
return;
|
|
}
|
|
var model = bll_fault_tree.GetModel(IdInput.Value);
|
|
if (bll_fault_tree.Delete(IdInput.Value))
|
|
{
|
|
log.write_log("故障树节点删除成功。" + "故障名称:" + model.name + ",当前节点:" + model.tree_id + ",父节点:" + model.parent_id);
|
|
}
|
|
DataLoad();
|
|
}
|
|
|
|
protected void dp_fault_list_SelectedIndexChanged(object sender, DropDownListEventArgs e)
|
|
{
|
|
DataLoad();
|
|
}
|
|
}
|
|
|
|
public class MyData
|
|
{
|
|
public static List<MyItem> GetData()
|
|
{
|
|
List<MyItem> list = new List<MyItem>();
|
|
list.Add(new MyItem("A", "Appetizers", "", null, true, ""));
|
|
list.Add(new MyItem("B", "Beverages", "", null, true, ""));
|
|
list.Add(new MyItem("C", "Cheese", "", null, false, ""));
|
|
list.Add(new MyItem("A1", "Southwestern Twisted Chips", "150 gr.", 6.79m, false, "A"));
|
|
list.Add(new MyItem("A2", "Top Shelf Combo Appetizer", "300 gr.", 9.49m, true, "A"));
|
|
list.Add(new MyItem("B1", "Sangria", "90 ml.", 6.49m, true, "B"));
|
|
list.Add(new MyItem("B2", "Margarita", "60 ml.", 7.39m, false, "B"));
|
|
list.Add(new MyItem("B3", "Red Cherry Boost", "200 ml.", 6.99m, false, "B"));
|
|
list.Add(new MyItem("B4", "Mojito", "180 ml.", 7.59m, true, "B"));
|
|
list.Add(new MyItem("C1", "Blue Cheese and Hazelnut Shortbread", "220 gr.", 10.69m, false, "C"));
|
|
list.Add(new MyItem("C2", "Avocado Feta Salsa", "240 gr.", 7.19m, false, "C"));
|
|
return list;
|
|
}
|
|
}
|
|
public class MyItem
|
|
{
|
|
public string ID { get; set; }
|
|
public string ProductName { get; set; }
|
|
public string Quantity { get; set; }
|
|
public decimal? Price { get; set; }
|
|
public bool InStock { get; set; }
|
|
public string ParentID { get; set; }
|
|
public MyItem(string id, string productName, string quantity, decimal? price, bool inStock, string parentID)
|
|
{
|
|
ID = id;
|
|
ProductName = productName;
|
|
Quantity = quantity;
|
|
Price = price;
|
|
InStock = inStock;
|
|
ParentID = parentID;
|
|
}
|
|
}
|
|
}
|