OrganzationTree.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:4k
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using com.etong.DAL.FC;
- public partial class OrganzationTree : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- int rows = 0, i = 0, prentID = 0, OrgLevel = 0, OrgID = 0;
- DataView dv = new DataView();
- EtongFlyChou EFly = new EtongFlyChou();
- string PrentID, OrgName, StrOrgID, StrPath;
- Array OrgArr;
- int PrentIndex, TwoIndex = 0;
- //Array ThreeIndex;
- dv = EFly.ReadOrgData();
- rows = dv.Count;
- int[] ThreeIndex = new int[rows];
- for (i = 0; i < rows; i++)
- {
- OrgArr = dv.Table.Rows[i].ItemArray;
- PrentID = Convert.ToString(OrgArr.GetValue(1));
- OrgName = Convert.ToString(OrgArr.GetValue(2));
- OrgLevel = Convert.ToInt32(OrgArr.GetValue(5));
- StrOrgID = Convert.ToString(OrgArr.GetValue(0));
- OrgID = Convert.ToInt32(OrgArr.GetValue(0));
- StrPath = Convert.ToString(OrgArr.GetValue(8));
- if (PrentID != "" && PrentID != null)
- {
- prentID = Convert.ToInt32(PrentID);
- TreeNode trnode = new TreeNode();
- if (prentID == -1)
- {
- trnode.Text = OrgName;
- trnode.Value = StrOrgID;
- trnode.ToolTip = OrgName;
- TOrganzation.Nodes.Add(trnode);
- }
- else
- {
- trnode.Text = OrgName;
- trnode.Value = StrOrgID;
- trnode.ToolTip = OrgName;
- if (OrgLevel == 2)
- {
- trnode.ImageToolTip = Convert.ToString(TwoIndex);
- TOrganzation.Nodes[0].ChildNodes.Add(trnode);
- TwoIndex++;
- }
- if (OrgLevel == 3)
- {
- PrentIndex = Convert.ToInt32(TOrganzation.FindNode(EFly.GetParentNode(PrentID)).ImageToolTip);
- ThreeIndex[PrentIndex]++;
- trnode.ImageToolTip = Convert.ToString(ThreeIndex[PrentIndex] - 1);
- //ThreeIndex.SetValue( Convert.ToInt32( ThreeIndex.GetValue(PrentIndex))+1,PrentIndex);
- //PrentIndex = TOrganzation.Nodes[0].ChildNodes.IndexOf(ParentNode);
- TOrganzation.Nodes[0].ChildNodes[PrentIndex].ChildNodes.Add(trnode);
- }
- }
- }
- TOrganzation.CollapseAll();
- TOrganzation.Nodes[0].Expand();
- }
- }
- }
- protected void TOrganzation_SelectedNodeChanged(object sender, EventArgs e)
- {
- int iEmpID,iOrgID;
- iEmpID = Convert.ToInt32(Request.QueryString["StrValue"]);
- iOrgID = Convert.ToInt32(TOrganzation.SelectedNode.Value);
- EtongFlyChou EFly = new EtongFlyChou();
- if (EFly.UpEmpParent(iEmpID, iOrgID) == true)
- {
- Response.Write("<script>alert('系统提示:职工信息转移成功!');window.close();</script>");
- }
- else
- {
- Response.Write("<script>alert('系统提示:职工信息转移失败!');window.close();</script>");
- }
-
- return;
- }
- }