2025-03-27 15:05:14 +08:00

168 lines
6.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SuperMap.RealEstate.Web.Utility;
using HWSB = SuperMap.RealEstate.HighWay.Storage.Business;
using SuperMap.RealEstate.CoreFrameWork.Dictionary.Business;
using Business = SuperMap.RealEstate.Personnel.Storage.Business;
using System.Data;
using SuperMap.RealEstate.FrameWork.Business;
using SuperMap.RealEstate.CoreFrameWork;
using System.Configuration;
using SuperMap.RealEstate.Personnel.Storage.Business;
namespace SuperMap.RealEstate.Personnel.Compents.Train
{
public partial class StaffTree : SuperMap.RealEstate.Web.UI.PageValid
{
#region -> Id
string FieldExplain_ID
{
get
{
FieldExplain _FieldExplain = new FieldExplain(Transaction);
_FieldExplain.AddSearchParameter("FieldExplain_Field", "DIVISION_CODE");
if (_FieldExplain.Search())
{
return _FieldExplain.FieldExplain_ID.ToString();
}
else
{
throw new Exception("未配置对应的服务区数据!");
}
}
}
#endregion
#region ->
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
try
{
//设置树双击事件
this.FixTreeViewDoubleClick(MyTreeView, true);
//绑定部门树
TreeViewBinding(true);
//设置回车焦点按钮
SetControlClientAction(ButtonSearch);
SetControlClientAction(ButtonSave);
//注册遮罩式窗口关闭脚本
SetControlClosePopDialog(ButtonClose);
}
catch (Exception ex)
{
throw ex;
}
finally
{
}
}
#endregion
#region ->
private void TreeViewBinding(bool withChildNodes)
{
MyTreeView.Nodes.Clear();
//递归效率太低,员工表新增是否是领导的字段
//string sqlWhere = @" AND EXISTS (
// SELECT 1 FROM PERSONNEL_STORAGE.T_RANK B WHERE T_STAFF.CURRENT_POSITION = B.RANK_ID
// START WITH B.RANK_ID = 2
// CONNECT BY PRIOR B.RANK_ID = B.RANK_PID)";
string sqlWhere = " AND ISLEAD = 0";//非领导班子
//查询员工列表
Business.STAFF _STAFF = new Business.STAFF();
DataTable StaffTable = _STAFF.GetBindingDataSource_Staff(null, sqlWhere);
CommonHelper.BindingServerpartTreeView_Enum(this.Transaction, FieldExplain_ID, "-1", MyTreeView.Nodes, this.TextBoxSearch.Text,
true, "1234", " NVL(STATISTIC_TYPE,1000) IN (1000,3000) ", null, StaffTable, false, "SalaryList.aspx", "", "", true, sqlWhere);
//MyTreeView.ExpandAll();
if (MyTreeView.Nodes.Count > 0)
MyTreeView.Nodes[0].Expand();//展开第一级
}
#endregion
#region ->
protected void MyTreeView_TreeNodePopulate(object sender, TreeNodeEventArgs e)
{
//string sqlWhere = @" EXISTS (
// SELECT 1 FROM PERSONNEL_STORAGE.T_RANK B WHERE A.CURRENT_POSITION = B.RANK_ID
// START WITH B.RANK_ID = 2
// CONNECT BY PRIOR B.RANK_ID = B.RANK_PID)";
//CommonHelper.BindingServerpartTreeView_Enum(this.Transaction, FieldExplain_ID, e.Node.Value, e.Node.ChildNodes, this.TextBoxSearch.Text,
// true, "1234", " NVL(STATISTIC_TYPE,1000) IN (1000,3000) ", null, null, false, "STAFFSALARYList.aspx", "", "", true, sqlWhere);
}
#endregion
#region ->
protected void ButtonSearch_Click(object sender, EventArgs e)
{
TreeViewBinding(true);
}
#endregion
#region -> /
protected void Expand_Click(object sender, EventArgs e)
{
if (Expand.Text == "收起↑")
{
foreach (TreeNode _TreeNode in MyTreeView.Nodes)
{
_TreeNode.Expanded = false;
}
Expand.Text = "展开↓";
}
else if (Expand.Text == "展开↓")
{
MyTreeView.ExpandAll();
Expand.Text = "收起↑";
}
}
#endregion
protected void ButtonSave_Click(object sender, EventArgs e)
{
//人员内码
string TRAIN_STAFFIDS = "";
foreach (TreeNode item in MyTreeView.CheckedNodes)
{
if (item.ImageToolTip == "STAFF_NAME")
{
TRAIN_STAFFIDS += item.Value.ToDecrypt() + ",";
}
}
TRAIN_STAFFIDS = TRAIN_STAFFIDS.Trim(',');
if (!string.IsNullOrEmpty(TRAIN_STAFFIDS))
{
//业务流程
string RequestUrl = "/WorkFlow/Transact/Common/ProcessPage.aspx?NowActInst_ID=" + Request["NowActInst_ID"] +
"&ProInst_ID=" + Request["ProInst_ID"] + "&TRAIN_STAFFIDS=" + TRAIN_STAFFIDS.ToEncrypt() +
"&PopDialogPageName=F_R_GridPageEx1&PopDialogName=WorkFlowWorkPlatform&r=0.8500934960320592";
if (!string.IsNullOrWhiteSpace(Request["Module_ID"]))
{
RequestUrl += "&Module_ID=" + Request["Module_ID"];
}
ExecClientScript("$('#pop-dialog-frame-WorkFlowWorkPlatform',parent.parent.document).attr('src', '" + RequestUrl + "')");
Alert("添加成功!");
}
else
{
Alert("请选择要添加的员工!");
}
}
protected void ButtonClose_Click(object sender, EventArgs e)
{
}
}
}