Exemple #1
0
        private void BindOrgTree()
        {
            OrganizationBLL organizationBLL = new OrganizationBLL();

            if (PrjPub.CurrentLoginUser.SuitRange == 1)
            {
                IList <RailExam.Model.Organization> organizationList = organizationBLL.GetOrganizations();

                Pub.BuildComponentArtTreeView(tvOrg, (IList)organizationList, "OrganizationId",
                                              "ParentId", "ShortName", "FullName", "OrganizationId", null, null, null);
            }
            else
            {
                int stationID = organizationBLL.GetStationOrgID(Convert.ToInt32(SessionSet.OrganizationID));
                IList <RailExam.Model.Organization> organizationList =
                    organizationBLL.GetOrganizations(stationID);

                if (organizationList.Count > 0)
                {
                    TreeViewNode tvn = null;

                    foreach (RailExam.Model.Organization organization in organizationList)
                    {
                        tvn         = new TreeViewNode();
                        tvn.ID      = organization.OrganizationId.ToString();
                        tvn.Value   = organization.IdPath.ToString();
                        tvn.Text    = organization.ShortName;
                        tvn.ToolTip = organization.FullName;

                        if (organization.ParentId == 1)
                        {
                            tvOrg.Nodes.Add(tvn);
                        }
                        else
                        {
                            try
                            {
                                tvOrg.FindNodeById(organization.ParentId.ToString()).Nodes.Add(tvn);
                            }
                            catch
                            {
                                tvOrg.Nodes.Clear();
                                SessionSet.PageMessage = "数据错误!";
                                return;
                            }
                        }
                    }
                }

                tvOrg.DataBind();
            }

            if (tvOrg.Nodes.Count > 0)
            {
                tvOrg.SelectedNode      = tvOrg.Nodes[0];
                tvOrg.Nodes[0].Expanded = true;
            }
        }
        private void BindOrganizationTree()
        {
            OrganizationBLL organizationBLL = new OrganizationBLL();
            IList <RailExam.Model.Organization> organizationList = organizationBLL.GetOrganizations(0, 0, "", 0, 0,
                                                                                                    "", "", "", "", "", "",
                                                                                                    "", "", "", "", 0, 40,
                                                                                                    "LevelNum,OrganizationId ASC");

            string strID = Request.QueryString["id"];

            string[] strIDS = { };
            if (!string.IsNullOrEmpty(strID))
            {
                strIDS = strID.Split(',');
            }

            if (organizationList.Count > 0)
            {
                TreeViewNode tvn = null;

                foreach (Organization organization in organizationList)
                {
                    tvn              = new TreeViewNode();
                    tvn.ID           = organization.OrganizationId.ToString();
                    tvn.Value        = organization.OrganizationId.ToString();
                    tvn.Text         = organization.ShortName;
                    tvn.ToolTip      = organization.FullName;
                    tvn.ShowCheckBox = true;

                    foreach (string strOrgID in strIDS)
                    {
                        if (strOrgID == organization.OrganizationId.ToString())
                        {
                            tvn.Checked = true;
                        }
                    }

                    if (organization.ParentId == 0)
                    {
                        tvOrg.Nodes.Add(tvn);
                    }
                    else
                    {
                        try
                        {
                            tvOrg.FindNodeById(organization.ParentId.ToString()).Nodes.Add(tvn);
                        }
                        catch
                        {
                            tvOrg.Nodes.Clear();
                            SessionSet.PageMessage = "数据错误!";
                            return;
                        }
                    }
                }
            }

            tvOrg.DataBind();
            tvOrg.ExpandAll();
        }
        private void BindOrgTree()
        {
            OrganizationBLL organizationBLL = new OrganizationBLL();
            IList <RailExam.Model.Organization> organizationList = organizationBLL.GetOrganizations(0, 0, "", 0, 0,
                                                                                                    "", "", "", "", "", "",
                                                                                                    "", "", "", "", 0, 100,
                                                                                                    "LevelNum,OrderIndex ASC");

            Pub.BuildComponentArtTreeView(tvOrg, (IList)organizationList, "OrganizationId",
                                          "ParentId", "ShortName", "FullName", "OrganizationId", null, null, null);
        }
Exemple #4
0
        private void BindOrganizationTree(ArrayList orgidAL)
        {
            OrganizationBLL      organizationBLL  = new OrganizationBLL();
            IList <Organization> organizationList = organizationBLL.GetOrganizations();

            if (organizationList.Count > 0)
            {
                TreeViewNode tvn = null;

                foreach (Organization organization in organizationList)
                {
                    tvn              = new TreeViewNode();
                    tvn.ID           = organization.OrganizationId.ToString();
                    tvn.Value        = organization.OrganizationId.ToString();
                    tvn.Text         = organization.ShortName;
                    tvn.ToolTip      = organization.FullName;
                    tvn.ShowCheckBox = true;

                    if (orgidAL.Count > 0)
                    {
                        if (orgidAL.IndexOf(organization.OrganizationId) != -1)
                        {
                            tvn.Checked = true;
                        }
                    }

                    if (organization.ParentId == 0)
                    {
                        tvOrg.Nodes.Add(tvn);
                    }
                    else
                    {
                        try
                        {
                            tvOrg.FindNodeById(organization.ParentId.ToString()).Nodes.Add(tvn);
                        }
                        catch
                        {
                            tvOrg.Nodes.Clear();
                            SessionSet.PageMessage = "数据错误!";
                            return;
                        }
                    }
                }
            }

            tvOrg.DataBind();
            //tvOrg.ExpandAll();
            if (tvOrg.Nodes.Count > 0)
            {
                tvOrg.Nodes[0].Expanded = true;
            }
        }
        //站段树绑定
        private void BindTree()
        {
            int railSystemID = PrjPub.GetRailSystemId();

            OrganizationBLL organizationsBLL = new OrganizationBLL();

            if (PrjPub.CurrentLoginUser.SuitRange == 1)
            {
                string strOwnIDs = string.Empty;
                if (railSystemID != 0)
                {
                    IList <RailExam.Model.Organization> organizationList1 = organizationsBLL.GetOrganizations(PrjPub.CurrentLoginUser.StationOrgID);
                    foreach (RailExam.Model.Organization organization in organizationList1)
                    {
                        strOwnIDs += strOwnIDs == string.Empty
                                         ? organization.OrganizationId.ToString()
                                         : "," + organization.OrganizationId;
                    }
                }

                IList <RailExam.Model.Organization> organizations = organizationsBLL.GetOrganizationsByLevel(2);

                foreach (RailExam.Model.Organization organization in organizations)
                {
                    if (organization.LevelNum == 1)
                    {
                        continue;
                    }

                    if ((organization.IdPath + "/").IndexOf("/1/") >= 0 && organization.LevelNum != 1 && railSystemID != 0 && railSystemID != organization.RailSystemID)
                    {
                        continue;
                    }

                    if (organization.LevelNum != 1 && strOwnIDs != string.Empty && (organization.IdPath + "/").IndexOf("/1/") < 0 && ("," + strOwnIDs + ",").IndexOf("," + organization.OrganizationId + ",") < 0)
                    {
                        continue;
                    }

                    TreeViewNode tvNode = new TreeViewNode();
                    tvNode.ID   = organization.OrganizationId.ToString();
                    tvNode.Text = organization.ShortName;
                    tvView.Nodes.Add(tvNode);
                }
            }
            else
            {
                TreeViewNode tvNode = new TreeViewNode();
                tvNode.ID   = PrjPub.CurrentLoginUser.StationOrgID.ToString();
                tvNode.Text = organizationsBLL.GetOrganization(PrjPub.CurrentLoginUser.StationOrgID).ShortName;
                tvView.Nodes.Add(tvNode);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                listTType.SelectedIndex = 0;

                string strId = Request.QueryString.Get("id");

                if (strId != null && strId != "")
                {
                    if (strId.Substring(0, 1) != "请")
                    {
                        ViewState["ChooseId"] = strId;
                    }
                    else
                    {
                        ViewState["ChooseId"] = "";
                    }
                }
                else
                {
                    ViewState["ChooseId"] = "";
                }

                BindChoosedGrid(ViewState["ChooseId"].ToString());

                OrganizationBLL psBLL = new OrganizationBLL();
                IList <RailExam.Model.Organization> Organizations = psBLL.GetOrganizations();

                if (Organizations != null)
                {
                    for (int i = 0; i < Organizations.Count; i++)
                    {
                        Organization paperSubject = Organizations[i];
                        ListItem     Li           = new ListItem();
                        Li.Value = paperSubject.OrganizationId.ToString();
                        if (paperSubject.OrganizationId == 1)
                        {
                            Li.Text = paperSubject.ShortName;
                        }
                        else
                        {
                            Li.Text = "----" + paperSubject.ShortName;
                        }

                        listTType.Items.Add(Li);
                    }
                    listTType.SelectedIndex = 0;
                    BindGrid();
                }
            }
        }
Exemple #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lbOrgType.SelectedIndex = 0;

                string strIDS = Request.QueryString["id"];

                if (!string.IsNullOrEmpty(strIDS))
                {
                    ViewState["ChooseID"] = strIDS;
                }
                else
                {
                    ViewState["ChooseID"] = "";
                }

                BindChoosedGrid(ViewState["ChooseID"].ToString());

                OrganizationBLL organizationBLL = new OrganizationBLL();
                IList <RailExam.Model.Organization> organizations = organizationBLL.GetOrganizations();

                if (organizations != null)
                {
                    foreach (Organization organization in organizations)
                    {
                        ListItem Li = new ListItem();
                        Li.Value = organization.OrganizationId.ToString();
                        if (organization.OrganizationId == 1)
                        {
                            Li.Text = organization.ShortName;
                        }
                        else
                        {
                            Li.Text = "--" + organization.ShortName;
                        }

                        lbOrgType.Items.Add(Li);
                    }
                    lbOrgType.SelectedIndex = 0;
                    BindGrid();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                PostBLL PostBLL = new PostBLL();
                IList <RailExam.Model.Post> posts = PostBLL.GetPosts("POST_NEW");

                Pub.BuildComponentArtTreeView(tvPost, (IList)posts, "PostId", "ParentId", "PostName",
                                              "PostName", "PostId", null, null, null);

                OrganizationBLL organizationBLL = new OrganizationBLL();
                IList <RailExam.Model.Organization> organizationList =
                    organizationBLL.GetOrganizations("ORG_NEW");

                Pub.BuildComponentArtTreeView(tvOrganization, (IList)organizationList, "OrganizationId",
                                              "ParentId", "ShortName", "FullName", "OrganizationId", null, null, null);
                if (tvOrganization.Nodes.Count > 0)
                {
                    tvOrganization.Nodes[0].Expanded = true;
                }
            }
        }
Exemple #9
0
        public ActionResult OrganizationsList()
        {
            List <Organizations> organizations = organizationBLL.GetOrganizations();

            return(View(organizations));
        }
        private void BindOrgTree()
        {
            OrganizationBLL organizationBLL = new OrganizationBLL();

            int railSystemID = PrjPub.GetRailSystemId();

            if ((PrjPub.CurrentLoginUser.SuitRange == 1 || railSystemID != 0) && PrjPub.IsServerCenter)
            {
                IList <RailExam.Model.Organization> organizationList = organizationBLL.GetOrganizationsByLevel(2);

                string strOwnIDs = string.Empty;
                if (railSystemID != 0)
                {
                    IList <RailExam.Model.Organization> organizationList1 = organizationBLL.GetOrganizations(PrjPub.CurrentLoginUser.StationOrgID);
                    foreach (RailExam.Model.Organization organization in organizationList1)
                    {
                        strOwnIDs += strOwnIDs == string.Empty
                                         ? organization.OrganizationId.ToString()
                                         : "," + organization.OrganizationId;
                    }
                }

                if (organizationList.Count > 0)
                {
                    TreeViewNode tvn = null;

                    foreach (Organization organization in organizationList)
                    {
                        if ((organization.IdPath + "/").IndexOf("/1/") >= 0 && organization.LevelNum != 1 && railSystemID != 0 && railSystemID != organization.RailSystemID)
                        {
                            continue;
                        }

                        if (organization.LevelNum != 1 && strOwnIDs != string.Empty && (organization.IdPath + "/").IndexOf("/1/") < 0 && ("," + strOwnIDs + ",").IndexOf("," + organization.OrganizationId + ",") < 0)
                        {
                            continue;
                        }

                        tvn         = new TreeViewNode();
                        tvn.ID      = organization.OrganizationId.ToString();
                        tvn.Value   = organization.OrganizationId.ToString();
                        tvn.Text    = organization.ShortName;
                        tvn.ToolTip = organization.FullName;

                        if (organization.ParentId == 0)
                        {
                            tvView.Nodes.Add(tvn);
                        }
                        else
                        {
                            try
                            {
                                tvView.FindNodeById(organization.ParentId.ToString()).Nodes.Add(tvn);
                            }
                            catch
                            {
                                tvView.Nodes.Clear();
                                SessionSet.PageMessage = "Êý¾Ý´íÎó£¡";
                                return;
                            }
                        }
                    }
                }
                if (tvView.Nodes.Count > 0)
                {
                    tvView.Nodes[0].Expanded = true;
                }
            }
            else
            {
                string strOrgID;
                if (PrjPub.IsServerCenter)
                {
                    strOrgID = PrjPub.CurrentLoginUser.StationOrgID.ToString();
                }
                else
                {
                    strOrgID = ConfigurationManager.AppSettings["StationID"].ToString();
                }
                int stationID = organizationBLL.GetStationOrgID(Convert.ToInt32(strOrgID));
                RailExam.Model.Organization organization = organizationBLL.GetOrganization(stationID);
                TreeViewNode tvn = null;

                tvn         = new TreeViewNode();
                tvn.ID      = organization.OrganizationId.ToString();
                tvn.Value   = organization.IdPath.ToString();
                tvn.Text    = organization.ShortName;
                tvn.ToolTip = organization.FullName;
                tvView.Nodes.Add(tvn);
            }

            tvView.DataBind();
        }
        private void BindOrganizationTree()
        {
            OrganizationBLL organizationBLL = new OrganizationBLL();

            IList <RailExam.Model.Organization> organizationList = new List <RailExam.Model.Organization>();

            int railSystemID = 0;

            if (PrjPub.IsServerCenter)
            {
                SystemRoleBLL roleBll = new SystemRoleBLL();
                SystemRole    role    = roleBll.GetRole(PrjPub.CurrentLoginUser.RoleID);
                railSystemID = role.RailSystemID;
            }

            if (PrjPub.IsServerCenter && (PrjPub.CurrentLoginUser.SuitRange == 1 || railSystemID != 0))
            {
                SystemRoleBLL roleBll = new SystemRoleBLL();
                SystemRole    role    = roleBll.GetRole(PrjPub.CurrentLoginUser.RoleID);

                organizationList = organizationBLL.GetOrganizations();

                string strOwnIDs = string.Empty;
                if (railSystemID != 0)
                {
                    IList <RailExam.Model.Organization> organizationList1 = organizationBLL.GetOrganizations(PrjPub.CurrentLoginUser.StationOrgID);
                    foreach (RailExam.Model.Organization organization in organizationList1)
                    {
                        strOwnIDs += strOwnIDs == string.Empty
                                         ? organization.OrganizationId.ToString()
                                         : "," + organization.OrganizationId;
                    }
                }

                if (organizationList.Count > 0)
                {
                    TreeViewNode tvn = null;
                    tvn = new TreeViewNode();
                    //tvn.ID = "0";
                    //tvn.Value = "0";
                    //tvn.Text = PrjPub.GetRailNameBao();
                    //tvn.ToolTip = PrjPub.GetRailNameBao();
                    //tvOrganization.Nodes.Add(tvn);

                    foreach (RailExam.Model.Organization organization in organizationList)
                    {
                        if ((organization.IdPath + "/").IndexOf("/1/") >= 0 && organization.LevelNum != 1 && railSystemID != 0 && railSystemID != organization.RailSystemID)
                        {
                            continue;
                        }

                        if (organization.LevelNum != 1 && strOwnIDs != string.Empty && (organization.IdPath + "/").IndexOf("/1/") < 0 && ("," + strOwnIDs + ",").IndexOf("," + organization.OrganizationId + ",") < 0)
                        {
                            continue;
                        }

                        tvn         = new TreeViewNode();
                        tvn.ID      = organization.OrganizationId.ToString();
                        tvn.Value   = organization.OrganizationId.ToString();
                        tvn.Text    = organization.ShortName;
                        tvn.ToolTip = organization.FullName;



                        try
                        {
                            if (organization.ParentId == 0)
                            {
                                tvn.Expanded = true;
                                tvOrganization.Nodes.Add(tvn);
                            }
                            else
                            {
                                tvOrganization.FindNodeById(organization.ParentId.ToString()).Nodes.Add(tvn);
                            }
                        }
                        catch
                        {
                            tvOrganization.Nodes.Clear();
                            SessionSet.PageMessage = "数据错误!";
                            return;
                        }
                    }
                }

                //Pub.BuildComponentArtTreeView(tvOrganization, (IList)organizationList, "OrganizationId",
                //    "ParentId", "ShortName", "FullName", "OrganizationId", null, null, null);
            }
            else
            {
                string strOrgID;
                if (PrjPub.IsServerCenter)
                {
                    strOrgID = PrjPub.CurrentLoginUser.StationOrgID.ToString();
                }
                else
                {
                    strOrgID = ConfigurationManager.AppSettings["StationID"].ToString();
                }
                int stationID = organizationBLL.GetStationOrgID(Convert.ToInt32(strOrgID));

                organizationList =
                    organizationBLL.GetOrganizations(stationID);

                if (organizationList.Count > 0)
                {
                    TreeViewNode tvn = null;
                    tvn         = new TreeViewNode();
                    tvn.ID      = "0";
                    tvn.Value   = "0";
                    tvn.Text    = PrjPub.GetRailNameBao();
                    tvn.ToolTip = PrjPub.GetRailNameBao();
                    tvOrganization.Nodes.Add(tvn);

                    foreach (RailExam.Model.Organization organization in organizationList)
                    {
                        tvn         = new TreeViewNode();
                        tvn.ID      = organization.OrganizationId.ToString();
                        tvn.Value   = organization.OrganizationId.ToString();
                        tvn.Text    = organization.ShortName;
                        tvn.ToolTip = organization.FullName;

                        if (organization.LevelNum == 2)
                        {
                            tvn.Expanded = true;
                        }

                        try
                        {
                            if (organization.LevelNum == 2)
                            {
                                tvOrganization.FindNodeById("0").Nodes.Add(tvn);
                            }
                            else
                            {
                                tvOrganization.FindNodeById(organization.ParentId.ToString()).Nodes.Add(tvn);
                            }
                        }
                        catch
                        {
                            tvOrganization.Nodes.Clear();
                            SessionSet.PageMessage = "数据错误!";
                            return;
                        }
                    }
                }
            }



            tvOrganization.DataBind();

            if (tvOrganization.Nodes.Count > 0)
            {
                tvOrganization.Nodes[0].Expanded = true;
            }
        }
Exemple #12
0
        // GET: Organization
        public ActionResult organizationpage()
        {
            List <Organization> organization = organizationBLL.GetOrganizations();

            return(View(organization));
        }
Exemple #13
0
        private void BindItemCategoryTree()
        {
            OrganizationBLL organizationsBLL = new OrganizationBLL();

            int    railSystemID = 0;
            string strOwnIDs    = string.Empty;

            if (PrjPub.CurrentLoginUser != null || PrjPub.CurrentStudent != null)
            {
                railSystemID = PrjPub.GetRailSystemId();
                if (railSystemID != 0)
                {
                    IList <RailExam.Model.Organization> organizationList1 =
                        organizationsBLL.GetOrganizations(PrjPub.CurrentLoginUser.StationOrgID);
                    foreach (RailExam.Model.Organization organization in organizationList1)
                    {
                        strOwnIDs += strOwnIDs == string.Empty
                                         ? organization.OrganizationId.ToString()
                                         : "," + organization.OrganizationId;
                    }
                }
            }

            if (Request.QueryString.Get("Type") == "Station")
            {
                IList <RailExam.Model.Organization> organizations = organizationsBLL.GetOrganizationsByLevel(2);

                foreach (RailExam.Model.Organization organization in organizations)
                {
                    if (!organization.IsEffect)
                    {
                        continue;
                    }

                    if (organization.LevelNum == 1)
                    {
                        continue;
                    }

                    if ((organization.IdPath + "/").IndexOf("/1/") >= 0 && organization.LevelNum != 1 && railSystemID != 0 && railSystemID != organization.RailSystemID)
                    {
                        continue;
                    }

                    if (organization.LevelNum != 1 && strOwnIDs != string.Empty && (organization.IdPath + "/").IndexOf("/1/") < 0 && ("," + strOwnIDs + ",").IndexOf("," + organization.OrganizationId + ",") < 0)
                    {
                        continue;
                    }

                    TreeViewNode tvNode = new TreeViewNode();
                    tvNode.ID   = organization.OrganizationId.ToString();
                    tvNode.Text = organization.ShortName;
                    tvOrganization.Nodes.Add(tvNode);
                }
            }
            else if (Request.QueryString.Get("Type") == "Online")
            {
                IList <RailExam.Model.Organization> organizations = organizationsBLL.GetOrganizations();

                IList <RailExam.Model.Organization> organizationList = new List <Organization>();

                foreach (Organization organization in organizations)
                {
                    if (!organization.IsEffect)
                    {
                        continue;
                    }

                    organizationList.Add(organization);
                }

                Pub.BuildComponentArtTreeView(tvOrganization, (IList)organizationList, "OrganizationId",
                                              "ParentId", "ShortName", "FullName", "OrganizationId", null, null, null);
            }
            else
            {
                if (PrjPub.IsServerCenter && PrjPub.CurrentLoginUser.SuitRange == 1)
                {
                    IList <RailExam.Model.Organization> organizations = organizationsBLL.GetOrganizations();

                    foreach (RailExam.Model.Organization organization in organizations)
                    {
                        if (!organization.IsEffect)
                        {
                            continue;
                        }

                        if (organization.LevelNum != 1)
                        {
                            if ((organization.IdPath + "/").IndexOf("/1/") >= 0 && railSystemID != 0 && railSystemID != organization.RailSystemID)
                            {
                                continue;
                            }

                            if (strOwnIDs != string.Empty && (organization.IdPath + "/").IndexOf("/1/") < 0 && ("," + strOwnIDs + ",").IndexOf("," + organization.OrganizationId + ",") < 0)
                            {
                                continue;
                            }
                        }

                        TreeViewNode tvn = new TreeViewNode();
                        tvn.ID      = organization.OrganizationId.ToString();
                        tvn.Value   = organization.OrganizationId.ToString();
                        tvn.Text    = organization.ShortName;
                        tvn.ToolTip = organization.FullName;

                        if (organization.ParentId == 0)
                        {
                            tvn.Expanded = true;
                            tvOrganization.Nodes.Add(tvn);
                            continue;
                        }

                        try
                        {
                            tvOrganization.FindNodeById(organization.ParentId.ToString()).Nodes.Add(tvn);
                        }
                        catch
                        {
                            tvOrganization.Nodes.Clear();
                            SessionSet.PageMessage = "数据错误!";
                            return;
                        }
                    }
                }
                else
                {
                    string strOrgID;
                    if (PrjPub.IsServerCenter)
                    {
                        if (!string.IsNullOrEmpty(Request.QueryString.Get("OrgID")))
                        {
                            strOrgID = Request.QueryString.Get("OrgID");
                        }
                        else
                        {
                            strOrgID = PrjPub.CurrentLoginUser.StationOrgID.ToString();
                        }
                    }
                    else
                    {
                        strOrgID = ConfigurationManager.AppSettings["StationID"].ToString();
                    }
                    int stationID = organizationsBLL.GetStationOrgID(Convert.ToInt32(strOrgID));
                    IList <RailExam.Model.Organization> organizationList =
                        organizationsBLL.GetOrganizations(stationID);

                    if (organizationList.Count > 0)
                    {
                        TreeViewNode tvn = null;

                        foreach (RailExam.Model.Organization organization in organizationList)
                        {
                            if (!organization.IsEffect)
                            {
                                continue;
                            }

                            tvn         = new TreeViewNode();
                            tvn.ID      = organization.OrganizationId.ToString();
                            tvn.Value   = organization.IdPath.ToString();
                            tvn.Text    = organization.ShortName;
                            tvn.ToolTip = organization.FullName;

                            if (organization.ParentId == 1)
                            {
                                tvOrganization.Nodes.Add(tvn);
                            }
                            else
                            {
                                try
                                {
                                    tvOrganization.FindNodeById(organization.ParentId.ToString()).Nodes.Add(tvn);
                                }
                                catch
                                {
                                    tvOrganization.Nodes.Clear();
                                    SessionSet.PageMessage = "数据错误!";
                                    return;
                                }
                            }
                        }
                    }

                    tvOrganization.DataBind();
                }

                if (tvOrganization.Nodes.Count > 0)
                {
                    tvOrganization.Nodes[0].Expanded = true;
                }
            }

            if (tvOrganization.Nodes.Count > 0)
            {
                tvOrganization.Nodes[0].Expanded = true;
            }
        }