private TreeViewNode GetNodeByCat(SellerItemCat cat)
 {
     TreeViewNode node = new TreeViewNode();
     node.Value = cat.Cid;
     node.Text = cat.Name;
     return node;
 }
        public IList<TreeViewNode> GetAllTreeViewNodes()
        {
            var sqlConnection = new SqlConnection(ConnectionString);
            var sqlCommand = new SqlCommand("dbo.GetTreeViewData", sqlConnection)
            {
                CommandType = CommandType.StoredProcedure,
            };

            var resultList = new List<TreeViewNode>();

            try
            {
                sqlConnection.Open();
                using (SqlDataReader reader = sqlCommand.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var item = new TreeViewNode();

                        item.Id = int.Parse(reader["Id"].ToString());
                        item.ParentId = reader["ParentId"].TryParseToInt();
                        item.NodeName = reader["NodeName"].ToString();

                        resultList.Add(item);
                    }
                }
            }

            finally
            {
                sqlConnection.Close();
            }

            return resultList;
        }
예제 #3
0
 public void each (doToNodeWithParent oper, TreeViewNode parentNode)
 {
     foreach (TreeViewNode st in this.children)
     {
         st.each(oper, this);
     }
     oper(this, parentNode);
 }
예제 #4
0
 private void buildgeoTree (TreeViewNode node0, Geography g)
 {
     foreach (Geography cg in g.Children)
     {
         childnr++;
         TreeViewNode node = new TreeViewNode(cg.Name, "" + cg.Identity);
         node0.AddChild(node);
         buildgeoTree(node, cg);
     }
 }
        private void AddLoadingNode(TreeViewNode node)
        {
            TreeViewNode empty = new TreeViewNode();
            empty.Text = "加载中...";
            empty.Value = "loading";
            empty.ImageUrl = "folder.gif";
            node.Nodes.Add(empty);

            node.AutoPostBackOnExpand = true;
        }
 private void BindTree(List<SellerItemCat> catList, TreeViewNode parentNode)
 {
     List<SellerItemCat> chilren = GetCatListByParent(catList, parentNode.Value);
     foreach (SellerItemCat cat in chilren)
     {
         TreeViewNode node = GetNodeByCat(cat);
         parentNode.Nodes.Add(node);
         BindTree(catList, node);
     }
 }
        private void AddNoneNode(TreeViewNode node)
        {
            TreeViewNode empty = new TreeViewNode();
            empty.Text = "更新中...";
            empty.Value = "none";
            empty.ImageUrl = "journal.gif";
            node.Nodes.Add(empty);

            node.AutoPostBackOnExpand = true;
        }
예제 #8
0
		private TreeView GenerateTreeview()
		{
			// We'll use a TreeView instance to generate the appropriate XML structure 
			ComponentArt.Web.UI.TreeView tv = new ComponentArt.Web.UI.TreeView();

			string handlerPath = String.Format(CultureInfo.CurrentCulture, "{0}/handler/gettreeviewxml.ashx", WebsiteController.GetAppRootPathUrl());

			IAlbum parentAlbum = Factory.LoadAlbumInstance(this._albumId, true);

			string securityActionParm = String.Empty;
			if (SecurityActionEnumHelper.IsValidSecurityAction(this._securityAction))
			{
				securityActionParm = String.Format(CultureInfo.CurrentCulture, "&secaction={0}", (int)this._securityAction);
			}

			foreach (IAlbum childAlbum in parentAlbum.GetChildGalleryObjects(GalleryObjectType.Album, true))
			{
				TreeViewNode node = new TreeViewNode();
				node.Text = WebsiteController.RemoveHtmlTags(childAlbum.Title);
				node.Value = childAlbum.Id.ToString(CultureInfo.InvariantCulture);
				node.ID = childAlbum.Id.ToString(CultureInfo.InvariantCulture);

				bool isUserAuthorized = true;
				if (SecurityActionEnumHelper.IsValidSecurityAction(this._securityAction))
				{
					isUserAuthorized = WebsiteController.IsUserAuthorized(_securityAction, WebsiteController.GetRolesForUser(), childAlbum.Id, childAlbum.IsPrivate);
				}
				node.ShowCheckBox = isUserAuthorized;
				node.Selectable = isUserAuthorized;
				if (!isUserAuthorized) node.HoverCssClass = String.Empty;

				if (childAlbum.GetChildGalleryObjects(GalleryObjectType.Album).Count > 0)
				{
					node.ContentCallbackUrl = String.Format(CultureInfo.CurrentCulture, "{0}?aid={1}{2}", handlerPath, childAlbum.Id.ToString(CultureInfo.InvariantCulture), securityActionParm);
				}

				tv.Nodes.Add(node);
			}

			return tv;
		}
예제 #9
0
    // Use this for initialization
    void Start()
    {
        RootNode.ShowSelf(true);
        // 构建树状结构
        // 一级菜单
        for (int i = 0; i < 2; ++i)
        {
            string       str   = "一级:" + i;
            Color        color = new Color(0, 0, 0);
            TreeViewNode node1 = InitNode(str, color);
            // 添加子节点
            RootNode.AddChildNode(node1);
            // 子节点的消隐
            node1.ShowSelf(true);
            // 节点的点击操作,这边用的是Toggle
            node1.gameObject.GetComponent <Toggle>().onValueChanged.AddListener((bool bValue) =>
            {
                node1.ShowChild(bValue);
            });

            // 二级菜单
            for (int j = 0; j < 3; ++j)
            {
                str   = "一级:" + i + "/二级:" + j;
                color = new Color(0.5f, 0.5f, 0.5f);
                TreeViewNode node2 = InitNode(str, color);
                node1.AddChildNode(node2);
                node2.ShowSelf(false);
                node2.gameObject.GetComponent <Toggle>().onValueChanged.AddListener((bool bValue) =>
                {
                    node2.ShowChild(bValue);
                });

                // 三级菜单
                for (int k = 0; k < 4; ++k)
                {
                    str   = "一级:" + i + "/二级:" + j + "/三级:" + k;
                    color = new Color(1.0f, 1.0f, 1.0f);
                    TreeViewNode node3 = InitNode(str, color);
                    node3.ShowSelf(false);

                    node2.AddChildNode(node3);
                }

                node2.ShowChild(false);
            }
        }

        // 对树状结构进行深度遍历,然后将其展开成数组
        List <TreeViewNode> listNodes = new List <TreeViewNode>();

        // 展开成数组
        RootNode.SortTreeIntoList(listNodes);
        listNodes.Remove(RootNode);

        /*
         *  设置UI中的父子关系,首先清除掉父子关系
         *  不清除掉的话,重新设置父子关系无法重新排布顺序
         *  因为原先都是属于RootNode的子物体
         */
        foreach (TreeViewNode node in listNodes)
        {
            node.gameObject.transform.SetParent(null);
        }

        foreach (TreeViewNode node in listNodes)
        {
            node.gameObject.transform.SetParent(RootNode.gameObject.transform);
        }
    }
예제 #10
0
        /// <summary>
        /// A helper function for creating a node description object for the specified model.
        /// </summary>
        /// <param name="model">The model</param>
        /// <returns>The description</returns>
        public TreeViewNode GetNodeDescription(IModel model)
        {
            TreeViewNode description = new TreeViewNode();

            description.Name = model.Name;

            // We need to find an icon for this model. If the model is a ModelCollectionFromResource, we attempt to find
            // an image with the same name as the model.
            // Otherwise, we attempt to find an icon with the same name as the model's type.
            // e.g. A Graph called Biomass should use an icon called Graph.png
            // e.g. A Plant called Wheat should use an icon called Wheat.png

            if (model is ModelCollectionFromResource)
            {
                description.ResourceNameForImage = "ApsimNG.Resources.TreeViewImages." + model.Name + ".png";
            }
            else
            {
                string modelNamespace = model.GetType().FullName.Split('.')[1] + ".";
                description.ResourceNameForImage = "ApsimNG.Resources.TreeViewImages." + modelNamespace + model.GetType().Name + ".png";

                if (!MainView.MasterView.HasResource(description.ResourceNameForImage))
                {
                    description.ResourceNameForImage = "ApsimNG.Resources.TreeViewImages." + model.GetType().Name + ".png";
                }
            }


            //Check to see if you can find the image in the resource for this project.
            ManifestResourceInfo info = Assembly.GetExecutingAssembly().GetManifestResourceInfo(description.ResourceNameForImage);

            if (info == null)
            {
                // Try the opposite.
                if (model is ModelCollectionFromResource)
                {
                    description.ResourceNameForImage = "ApsimNG.Resources.TreeViewImages." + model.GetType().Name + ".png";
                }
                else
                {
                    description.ResourceNameForImage = "ApsimNG.Resources.TreeViewImages." + model.Name + ".png";
                }
            }

            description.ToolTip = model.GetType().Name;

            description.Children = new List <TreeViewNode>();
            foreach (Model child in model.Children)
            {
                if (!child.IsHidden)
                {
                    description.Children.Add(this.GetNodeDescription(child));
                }
            }
            description.Strikethrough = !model.Enabled;
            description.Checked       = model.IncludeInDocumentation && showDocumentationStatus;
            description.Colour        = System.Drawing.Color.Empty;

            /*
             * // Set the colour here
             * System.Drawing.Color colour = model.Enabled ? System.Drawing.Color.Black : System.Drawing.Color.Red;
             * description.Colour = colour;
             */
            return(description);
        }
예제 #11
0
		/// <summary>
		/// Add the collection of albums to the specified treeview node.
		/// </summary>
		/// <param name="albums">The collection of albums to add the the treeview node.</param>
		/// <param name="parentNode">The treeview node that will receive child nodes representing the specified albums.</param>
		/// <param name="expandNode">Specifies whether the nodes should be expanded.</param>
		private void bindAlbumToTreeview(IGalleryObjectCollection albums, TreeViewNode parentNode, bool expandNode)
		{
			string handlerPath = ResolveUrl("~/handler/gettreeviewxml.ashx");

			foreach (IAlbum album in albums)
			{
				TreeViewNode node = new TreeViewNode();
				node.Text = WebsiteController.RemoveHtmlTags(album.Title);
				node.Value = album.Id.ToString(CultureInfo.InvariantCulture);
				node.ID = album.Id.ToString(CultureInfo.InvariantCulture);
				node.Expanded = expandNode;

				bool isUserAuthorized = (IsSecurityPermissionRequested() ? this.PageBase.IsUserAuthorized(this.RequiredSecurityPermissions, album) : true);
				node.ShowCheckBox = isUserAuthorized;
				node.Selectable = isUserAuthorized;
				if (!isUserAuthorized) node.HoverCssClass = String.Empty;

				if (album.GetChildGalleryObjects(GalleryObjectType.Album).Count > 0)
				{
					node.ContentCallbackUrl = String.Format(CultureInfo.CurrentCulture, "{0}?aid={1}{2}", handlerPath, album.Id.ToString(CultureInfo.InvariantCulture), this.SecurityPermissionQueryStringParm);
				}

				// Select and check this node if needed.
				if ((this._albumToSelect != null) && (album.Id == this._albumToSelect.Id))
				{
					tv.SelectedNode = node;
					node.Checked = true;
					node.Expanded = true;
					// Expand the child of the selected album.
					bindAlbumToTreeview(album.GetChildGalleryObjects(GalleryObjectType.Album), node, false);
				}
				
				// Check this node if needed.
				if (this._albumIdsToCheck.Contains(album.Id))
				{
					node.Checked = true;
				}

				parentNode.Nodes.Add(node);
			}
		}
        /// <summary>
        /// Render the treeview with the first two levels of albums that are viewable to the logged on user.
        /// </summary>
        private void DataBindTreeView()
        {
            #region Validation

            //if (!this.AllowMultiSelect && this.AlbumIdsToCheck.Count > 1)
            //{
            //  throw new InvalidOperationException("The property AllowMultiSelect must be false when multiple album IDs have been assigned to the property AlbumIdsToCheck.");
            //}

            if (!this.AllowMultiCheck && this.AlbumIdsToCheck.Count > 1)
            {
                throw new InvalidOperationException("The property AllowMultiCheck must be false when multiple album IDs have been assigned to the property AlbumIdsToCheck.");
            }

            if (!SecurityActionEnumHelper.IsValidSecurityAction(this.RequiredSecurityPermissions))
            {
                throw new InvalidOperationException("The property GalleryServerPro.Web.Controls.albumtreeview.RequiredSecurityPermissions must be assigned before the TreeView can be rendered.");
            }

            #endregion

            tv.Nodes.Clear();

            foreach (IAlbum rootAlbum in GetRootAlbums())
            {
                // Add root node.
                TreeViewNode rootNode = new TreeViewNode();

                string albumTitle = GetRootAlbumTitle(rootAlbum);
                rootNode.Text = albumTitle;
                rootNode.ToolTip = albumTitle;
                rootNode.Value = rootAlbum.Id.ToString(CultureInfo.InvariantCulture);
                rootNode.ID = rootAlbum.Id.ToString(CultureInfo.InvariantCulture);
                rootNode.Expanded = true;

                if (!String.IsNullOrEmpty(NavigateUrl))
                {
                    rootNode.NavigateUrl = Utils.AddQueryStringParameter(NavigateUrl, String.Concat("aid=", rootAlbum.Id.ToString(CultureInfo.InvariantCulture)));
                    rootNode.HoverCssClass = "tv0HoverTreeNodeLink";
                }

                bool isAlbumSelectable = !rootAlbum.IsVirtualAlbum;
                rootNode.ShowCheckBox = isAlbumSelectable && ShowCheckbox;
                rootNode.Selectable = isAlbumSelectable;
                if (!isAlbumSelectable) rootNode.HoverCssClass = String.Empty;

                // Select and check this node if needed.
                if (isAlbumSelectable && (this._albumToSelect != null) && (rootAlbum.Id == _albumToSelect.Id))
                {
                    tv.SelectedNode = rootNode;
                    rootNode.Checked = true;
                }

                // Check this node if needed.
                if (this._albumIdsToCheck.Contains(rootAlbum.Id))
                {
                    rootNode.Checked = true;
                }

                tv.Nodes.Add(rootNode);

                // Add the first level of albums below the root album.
                BindAlbumToTreeview(rootAlbum.GetChildGalleryObjects(GalleryObjectType.Album, true, this.GalleryPage.IsAnonymousUser), rootNode, false);

                // Only display the root node if it is selectable or we added any children to it; otherwise, remove it.
                if (!rootNode.Selectable && rootNode.Nodes.Count == 0)
                {
                    tv.Nodes.Remove(rootNode);
                }
            }

            if ((this._albumToSelect != null) && (tv.SelectedNode == null))
            {
                // We have an album we are supposed to select, but we haven't encountered it in the first two levels,
                // so expand the treeview as needed to include this album.
                BindSpecificAlbumToTreeview(this._albumToSelect);
            }

            // Make sure all specified albums are visible and checked.
            foreach (int albumId in this._albumIdsToCheck)
            {
                IAlbum album = AlbumController.LoadAlbumInstance(albumId, false);
                if (this.GalleryPage.IsUserAuthorized(RequiredSecurityPermissions, album))
                {
                    BindSpecificAlbumToTreeview(album);
                }
            }
        }
        //private bool nodeclicked = false;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CheckAuthority();

                //set management flow authority signal
                Session["ManagementFlowAuthorityCtl"] = "0";

                TreeViewNode tvn2 = new TreeViewNode("浙能集团");
                TreeViewNode tvn = new TreeViewNode("温州电厂");

                TreeViewNode tvn_icemsgroup = new TreeViewNode("环保工况信息管理流");
                TreeViewNode tvn_minimum = new TreeViewNode("环保超低排放管理");
                TreeViewNode tvn_fgdscr = new TreeViewNode("脱硫脱硝工况分析");
                TreeViewNode tvn_epasync = new TreeViewNode("EPA数据上传更新");
                TreeViewNode tvn_sourcedata = new TreeViewNode("源数据分析");

                TreeViewNode tvn_overlimits = new TreeViewNode("月超限值明细分析");

                TreeViewNode tvn_reports_instrumentrunning = new TreeViewNode("环保设施运行报表");
                TreeViewNode tvn_reports_inout = new TreeViewNode("环保设施投撤记录表");
                TreeViewNode tvn_reports_abnormalrunning = new TreeViewNode("环保非正常运行记录表");

                tvn_overlimits.Nodes.Add("脱硝月明细", "OverLimits_Nox", null, "~/OverLimits_Nox_Month.aspx");
                tvn_overlimits.Nodes.Add("脱硫月明细", "OverLimits_So2", null, "~/OverLimits_So2_Month.aspx");
                tvn_overlimits.Nodes.Add("除尘月明细", "OverLimits_Dust", null, "~/OverLimits_Dust_Month.aspx");

                tvn_fgdscr.Nodes.Add("脱硝工况分析", "scr_startstop_ab", null, "~/scr_startstop_ab.aspx");
                tvn_fgdscr.Nodes.Add("脱硫工况分析", "machine_startstop", null, "~/machine_startstop.aspx");

                tvn.Nodes.Add("环保数据异常统计", "EnvStatisticYQ", null, "~/Reports2.aspx");
                tvn.Nodes.Add("仪表标定及支撑材料", "EnvCalibSpanYQ", null, "~/CalibSpan.aspx");

                tvn.Nodes.Add(tvn_fgdscr);

                #region not used
                //tvn.Nodes.Add("环保规则值查询", "EnvRuleValueYQ", null, "~/CalibValue.aspx");
                //tvn.Nodes.Add("排放均值数据横向对比", "EnvRuleValueYQ", null, "~/ComprehensiveData.aspx");
                //tvn.Nodes.Add("异常分类及支撑材料", "groupYQ", null, "~/Reports.aspx");
                #endregion

                tvn.Nodes.Add("DAS/PI数据图形对比", "das_pi_chart_YQ", null, "~/daspi_watchdog.aspx");
                tvn.Nodes.Add("环保信息管理", "unitcomparisionYQ", null, "~/unitcomparision.aspx");
                tvn.Nodes.Add("历史数据追溯", "das_hisYQ", null, "~/dashis.aspx");

                if ((string)Session["authority"] == "1")
                {
                    tvn_icemsgroup.Nodes.Add("二期集控", "terriority1", null, "~/GroupRuleLogInfo_1.aspx");
                    tvn_icemsgroup.Nodes.Add("三期集控", "terriority2", null, "~/GroupRuleLogInfo_2.aspx");
                    tvn_icemsgroup.Nodes.Add("灰硫控制室", "terriority3", null, "~/GroupRuleLogInfo_3.aspx");
                    tvn_icemsgroup.Nodes.Add("脱硝运行专工", "fieldinfoYQ_SCR", null, "~/GroupRuleLogInfo.aspx");
                    tvn_icemsgroup.Nodes.Add("脱硫运行专工", "fieldinfoYQ_FGD", null, "~/GroupRuleLogInfo_FGD.aspx");
                    tvn_icemsgroup.Nodes.Add("环保专工(环保排污核查)", "exceptioninfoYQ", null, "~/ExceptionInfo.aspx");
                    tvn_icemsgroup.Nodes.Add("仪控专工(DAS/PI双重校验)", "das_piYQ", null, "~/PiDasComparisions.aspx");
                    tvn_icemsgroup.Nodes.Add("SCR非同步原因分析", "scr_startstop_des", null, "~/scr_startstop_ab_description.aspx");
                    tvn_icemsgroup.Nodes.Add("机组启停原因分析", "machine_startstop_des", null, "~/machine_startstop_ab_description.aspx");
                }
                if ((string)Session["authority"] == "2")
                {
                    tvn_icemsgroup.Nodes.Add("二期集控", "terriority1", null, "~/GroupRuleLogInfo_1.aspx");
                    tvn_icemsgroup.Nodes.Add("三期集控", "terriority2", null, "~/GroupRuleLogInfo_2.aspx");
                    tvn_icemsgroup.Nodes.Add("灰硫控制室", "terriority3", null, "~/GroupRuleLogInfo_3.aspx");
                    tvn_icemsgroup.Nodes.Add("脱硝运行专工", "fieldinfoYQ_SCR", null, "~/GroupRuleLogInfo.aspx");
                    tvn_icemsgroup.Nodes.Add("脱硫运行专工", "fieldinfoYQ_FGD", null, "~/GroupRuleLogInfo_FGD.aspx");
                    tvn_icemsgroup.Nodes.Add("环保专工(环保排污核查)", "exceptioninfoYQ", null, "~/ExceptionInfo.aspx");
                    tvn_icemsgroup.Nodes.Add("仪控专工(DAS/PI双重校验)", "das_piYQ", null, "~/PiDasComparisions.aspx");
                    tvn_icemsgroup.Nodes.Add("SCR非同步原因分析", "scr_startstop_des", null, "~/scr_startstop_ab_description.aspx");
                    tvn_icemsgroup.Nodes.Add("机组启停原因分析", "machine_startstop_des", null, "~/machine_startstop_ab_description.aspx");
                }
                if ((string)Session["authority"] == "3")
                {
                    tvn_icemsgroup.Nodes.Add("二期集控", "terriority1", null, "~/GroupRuleLogInfo_1.aspx");
                    tvn_icemsgroup.Nodes.Add("三期集控", "terriority2", null, "~/GroupRuleLogInfo_2.aspx");
                    tvn_icemsgroup.Nodes.Add("灰硫控制室", "terriority3", null, "~/GroupRuleLogInfo_3.aspx");
                    tvn_icemsgroup.Nodes.Add("脱硝运行专工", "fieldinfoYQ_SCR", null, "~/GroupRuleLogInfo.aspx");
                    tvn_icemsgroup.Nodes.Add("脱硫运行专工", "fieldinfoYQ_FGD", null, "~/GroupRuleLogInfo_FGD.aspx");
                    tvn_icemsgroup.Nodes.Add("环保专工(环保排污核查)", "exceptioninfoYQ", null, "~/ExceptionInfo.aspx");
                    tvn_icemsgroup.Nodes.Add("仪控专工(DAS/PI双重校验)", "das_piYQ", null, "~/PiDasComparisions.aspx");
                    tvn_icemsgroup.Nodes.Add("SCR非同步原因分析", "scr_startstop_des", null, "~/scr_startstop_ab_description.aspx");
                    tvn_icemsgroup.Nodes.Add("机组启停原因分析", "machine_startstop_des", null, "~/machine_startstop_ab_description.aspx");
                }
                if ((string)Session["authority"] == "4")
                {
                    tvn_icemsgroup.Nodes.Add("二期集控", "terriority1", null, "~/GroupRuleLogInfo_1.aspx");
                    tvn_icemsgroup.Nodes.Add("三期集控", "terriority2", null, "~/GroupRuleLogInfo_2.aspx");
                    tvn_icemsgroup.Nodes.Add("灰硫控制室", "terriority3", null, "~/GroupRuleLogInfo_3.aspx");
                    tvn_icemsgroup.Nodes.Add("值长审核", "GroupRuleLogInfo_Total", null, "~/GroupRuleLogInfo_Total.aspx");
                    tvn_icemsgroup.Nodes.Add("脱硝运行专工", "fieldinfoYQ_SCR", null, "~/GroupRuleLogInfo.aspx");
                    tvn_icemsgroup.Nodes.Add("脱硫运行专工", "fieldinfoYQ_FGD", null, "~/GroupRuleLogInfo_FGD.aspx");
                    tvn_icemsgroup.Nodes.Add("环保专工(环保排污核查)", "exceptioninfoYQ", null, "~/ExceptionInfo.aspx");
                    tvn_icemsgroup.Nodes.Add("仪控专工(DAS/PI双重校验)", "das_piYQ", null, "~/PiDasComparisions.aspx");
                    tvn_icemsgroup.Nodes.Add("SCR非同步原因分析", "scr_startstop_des", null, "~/scr_startstop_ab_description.aspx");
                    tvn_icemsgroup.Nodes.Add("机组启停原因分析", "machine_startstop_des", null, "~/machine_startstop_ab_description.aspx");
                }
                if ((string)Session["authority"] == "5")
                {
                    tvn_icemsgroup.Nodes.Add("二期集控", "terriority1", null, "~/GroupRuleLogInfo_1.aspx");
                    tvn_icemsgroup.Nodes.Add("三期集控", "terriority2", null, "~/GroupRuleLogInfo_2.aspx");
                    tvn_icemsgroup.Nodes.Add("灰硫控制室", "terriority3", null, "~/GroupRuleLogInfo_3.aspx");
                    tvn_icemsgroup.Nodes.Add("值长审核", "GroupRuleLogInfo_Total", null, "~/GroupRuleLogInfo_Total.aspx");
                    tvn_icemsgroup.Nodes.Add("脱硝运行专工", "fieldinfoYQ_SCR", null, "~/GroupRuleLogInfo.aspx");
                    tvn_icemsgroup.Nodes.Add("脱硫运行专工", "fieldinfoYQ_FGD", null, "~/GroupRuleLogInfo_FGD.aspx");
                    tvn_icemsgroup.Nodes.Add("环保专工(环保排污核查)", "exceptioninfoYQ", null, "~/ExceptionInfo.aspx");
                    tvn_icemsgroup.Nodes.Add("仪控专工(DAS/PI双重校验)", "das_piYQ", null, "~/PiDasComparisions.aspx");
                    tvn_icemsgroup.Nodes.Add("SCR非同步原因分析", "scr_startstop_des", null, "~/scr_startstop_ab_description.aspx");
                    tvn_icemsgroup.Nodes.Add("机组启停原因分析", "machine_startstop_des", null, "~/machine_startstop_ab_description.aspx");
                }
                if ((string)Session["authority"] == "6")
                {
                    tvn_icemsgroup.Nodes.Add("二期集控", "terriority1", null, "~/GroupRuleLogInfo_1.aspx");
                    tvn_icemsgroup.Nodes.Add("三期集控", "terriority2", null, "~/GroupRuleLogInfo_2.aspx");
                    tvn_icemsgroup.Nodes.Add("灰硫控制室", "terriority3", null, "~/GroupRuleLogInfo_3.aspx");
                    tvn_icemsgroup.Nodes.Add("值长审核", "GroupRuleLogInfo_Total", null, "~/GroupRuleLogInfo_Total.aspx");
                    tvn_icemsgroup.Nodes.Add("脱硝运行专工", "fieldinfoYQ_SCR", null, "~/GroupRuleLogInfo.aspx");
                    tvn_icemsgroup.Nodes.Add("脱硫运行专工", "fieldinfoYQ_FGD", null, "~/GroupRuleLogInfo_FGD.aspx");
                    tvn_icemsgroup.Nodes.Add("环保专工(环保排污核查)", "exceptioninfoYQ", null, "~/ExceptionInfo.aspx");
                    tvn_icemsgroup.Nodes.Add("仪控专工(DAS/PI双重校验)", "das_piYQ", null, "~/PiDasComparisions.aspx");
                    tvn_icemsgroup.Nodes.Add("SCR非同步原因分析", "scr_startstop_des", null, "~/scr_startstop_ab_description.aspx");
                    tvn_icemsgroup.Nodes.Add("机组启停原因分析", "machine_startstop_des", null, "~/machine_startstop_ab_description.aspx");
                }
                if ((string)Session["authority"] == "7")
                {
                    tvn_icemsgroup.Nodes.Add("二期集控", "terriority1", null, "~/GroupRuleLogInfo_1.aspx");
                    tvn_icemsgroup.Nodes.Add("三期集控", "terriority2", null, "~/GroupRuleLogInfo_2.aspx");
                    tvn_icemsgroup.Nodes.Add("灰硫控制室", "terriority3", null, "~/GroupRuleLogInfo_3.aspx");
                    tvn_icemsgroup.Nodes.Add("值长审核", "GroupRuleLogInfo_Total", null, "~/GroupRuleLogInfo_Total.aspx");
                    tvn_icemsgroup.Nodes.Add("脱硝运行专工", "fieldinfoYQ_SCR", null, "~/GroupRuleLogInfo.aspx");
                    tvn_icemsgroup.Nodes.Add("脱硫运行专工", "fieldinfoYQ_FGD", null, "~/GroupRuleLogInfo_FGD.aspx");
                    tvn_icemsgroup.Nodes.Add("环保专工(环保排污核查)", "exceptioninfoYQ", null, "~/ExceptionInfo.aspx");
                    tvn_icemsgroup.Nodes.Add("仪控专工(DAS/PI双重校验)", "das_piYQ", null, "~/PiDasComparisions.aspx");
                    tvn_icemsgroup.Nodes.Add("SCR非同步原因分析", "scr_startstop_des", null, "~/scr_startstop_ab_description.aspx");
                    tvn_icemsgroup.Nodes.Add("机组启停原因分析", "machine_startstop_des", null, "~/machine_startstop_ab_description.aspx");
                }
                if ((string)Session["authority"] == "8")
                {
                    tvn_icemsgroup.Nodes.Add("二期集控", "terriority1", null, "~/GroupRuleLogInfo_1.aspx");
                    tvn_icemsgroup.Nodes.Add("三期集控", "terriority2", null, "~/GroupRuleLogInfo_2.aspx");
                    tvn_icemsgroup.Nodes.Add("灰硫控制室", "terriority3", null, "~/GroupRuleLogInfo_3.aspx");
                    tvn_icemsgroup.Nodes.Add("值长审核", "GroupRuleLogInfo_Total", null, "~/GroupRuleLogInfo_Total.aspx");
                    tvn_icemsgroup.Nodes.Add("脱硝运行专工", "fieldinfoYQ_SCR", null, "~/GroupRuleLogInfo.aspx");
                    tvn_icemsgroup.Nodes.Add("脱硫运行专工", "fieldinfoYQ_FGD", null, "~/GroupRuleLogInfo_FGD.aspx");
                    tvn_icemsgroup.Nodes.Add("环保专工(环保排污核查)", "exceptioninfoYQ", null, "~/ExceptionInfo.aspx");
                    tvn_icemsgroup.Nodes.Add("仪控专工(DAS/PI双重校验)", "das_piYQ", null, "~/PiDasComparisions.aspx");
                    tvn_icemsgroup.Nodes.Add("SCR非同步原因分析", "scr_startstop_des", null, "~/scr_startstop_ab_description.aspx");
                    tvn_icemsgroup.Nodes.Add("机组启停原因分析", "machine_startstop_des", null, "~/machine_startstop_ab_description.aspx");
                }

                tvn_minimum.Nodes.Add("超低排放PI指标日数据统计", "minimumYQ_PI", null, "~/MinimumRelease_pi.aspx");
                tvn_minimum.Nodes.Add("超低排放PI指标月数据统计", "minimumYQ_PI_Month", null, "~/MinimumRelease_pi_month.aspx");
                tvn_minimum.Nodes.Add("超低排放DAS指标统计", "minimumYQ", null, "~/MinimumRelease.aspx");

                tvn_reports_instrumentrunning.Nodes.Add("基本情况", "instrumentrunning_basic", null, "~/instrumentrunning_basic.aspx");
                tvn_reports_instrumentrunning.Nodes.Add("脱硝设施", "instrumentrunning_nox", null, "~/instrumentrunning_nox.aspx");
                tvn_reports_instrumentrunning.Nodes.Add("脱硫设施", "instrumentrunning_so2", null, "~/instrumentrunning_so2.aspx");
                tvn_reports_instrumentrunning.Nodes.Add("除尘设施", "instrumentrunning_dust", null, "~/instrumentrunning_dust.aspx");

                tvn_reports_inout.Nodes.Add("月机组启停记录", "machine_startstop_rd", null, "~/machine_startstop_rd_month.aspx");
                tvn_reports_inout.Nodes.Add("月非同步运行记录", "scr_startstop_async", null, "~/scr_startstop_sync_month.aspx");
                tvn_reports_inout.Nodes.Add("机组启停记录", "machine_startstop_rd", null, "~/machine_startstop_rd.aspx");
                tvn_reports_inout.Nodes.Add("非同步运行记录", "scr_startstop_async", null, "~/scr_startstop_sync.aspx");

                tvn_reports_abnormalrunning.Nodes.Add("脱硝非正常运行", "abnormalrunning_nox", null, "~/abnormalrunning_nox.aspx");
                tvn_reports_abnormalrunning.Nodes.Add("脱硫非正常运行", "abnormalrunning_so2", null, "~/abnormalrunning_so2.aspx");
                tvn_reports_abnormalrunning.Nodes.Add("除尘非正常运行", "abnormalrunning_dust", null, "~/abnormalrunning_dust.aspx");

                tvn.Nodes.Add(tvn_minimum);
                tvn.Nodes.Add(tvn_icemsgroup);

                if ((string)Session["authority"] == "6")
                {
                    tvn_epasync.Nodes.Add("异常分组EPA上传更新", "ExceptionDataGroup_Sync", null, "~/ExceptionDataGroupSyncRpt.aspx");
                    tvn_epasync.Nodes.Add("标定均值EPA上传更新", "CalibValue_Sync", null, "~/CalibValueSyncRpt.aspx");
                    tvn.Nodes.Add(tvn_epasync);
                }

                tvn_sourcedata.Nodes.Add("DAS/WEB/PI源数据对比", "MonitorDataCom", null, "~/MonitorDataComparision.aspx");
                tvn_sourcedata.Nodes.Add("分组指标源数据状态", "GroupMonDataStatus", null, "~/GroupMonitorDataStatus.aspx");
                tvn.Nodes.Add(tvn_sourcedata);

                tvn.Nodes.Add(tvn_reports_instrumentrunning);
                tvn.Nodes.Add(tvn_reports_inout);
                tvn.Nodes.Add(tvn_reports_abnormalrunning);
                tvn.Nodes.Add(tvn_overlimits);

                tvn2.Nodes.Add(tvn);
                ASPxTreeView1.Nodes.Add(tvn2);

                string currentnodename = (string)Session["CurrentNode"];
                if (currentnodename == null)
                {
                    if ((string)Session["authority"] == "1")
                    {
                        currentnodename = "terriority1";
                    }
                    if ((string)Session["authority"] == "2")
                    {
                        currentnodename = "terriority2";
                    }
                    if ((string)Session["authority"] == "3")
                    {
                        currentnodename = "terriority3";
                    }
                    if ((string)Session["authority"] == "4")
                    {
                        currentnodename = "fieldinfoYQ_SCR";
                    }
                    if ((string)Session["authority"] == "5")
                    {
                        currentnodename = "fieldinfoYQ_FGD";
                    }
                    if ((string)Session["authority"] == "6")
                    {
                        currentnodename = "exceptioninfoYQ";
                    }
                    if ((string)Session["authority"] == "7")
                    {
                        currentnodename = "das_piYQ";
                    }
                    //TreeViewNodeEventArgs tvnea = new TreeViewNodeEventArgs(tvn.Nodes[3]);
                    //ASPxTreeView1_NodeClick(null, tvnea);
                }
                NodesExpand(currentnodename, ASPxTreeView1.Nodes);
                //try
                //{
                //    headtext.InnerText = ASPxTreeView1.SelectedNode.Text;
                //}
                //catch(Exception ex)
                //{ }
            }
        }
    private void GetChildDataAccessLevels_MultiLevelsDataAccessLevels(DataAccessLevelsType Dalt, DataAccessParts DataAccessLevelKey, DataAccessLevelOperationType?Dalot, decimal UserID, UserSearchKeys?SearchKey, string UserSearchTerm, TreeViewNode parentDalNode, DataAccessProxy parentDal, string SearchItem)
    {
        bool HasChildDals = false;
        IList <DataAccessProxy> DalList = null;

        UserID = this.GetUserID_MultiLevelsDataAccessLevels(Dalot, UserID, SearchKey, UserSearchTerm);

        switch (DataAccessLevelKey)
        {
        case DataAccessParts.Department:
            switch (Dalt)
            {
            case DataAccessLevelsType.Source:
                if (SearchItem != string.Empty)
                {
                    DalList = this.MultiLevelsDataAccessLevelesBusiness.GetDepartmentChilds(parentDal.ID, SearchItem);
                }
                else
                {
                    DalList = this.MultiLevelsDataAccessLevelesBusiness.GetDepartmentChilds(parentDal.ID);
                }
                break;

            case DataAccessLevelsType.Target:
                DalList = this.MultiLevelsDataAccessLevelesBusiness.GetDepartmentsOfUser(UserID, parentDal.ID, SearchItem);
                break;
            }
            break;

        case DataAccessParts.OrganizationUnit:
            switch (Dalt)
            {
            case DataAccessLevelsType.Source:
                if (SearchItem != string.Empty)
                {
                    DalList = this.MultiLevelsDataAccessLevelesBusiness.GetOrganizationChilds(parentDal.ID, SearchItem);
                }
                else
                {
                    DalList = this.MultiLevelsDataAccessLevelesBusiness.GetOrganizationChilds(parentDal.ID);
                }
                break;

            case DataAccessLevelsType.Target:
                DalList = this.MultiLevelsDataAccessLevelesBusiness.GetOrganizationOfUser(UserID, parentDal.ID, SearchItem);
                break;
            }
            break;

        case DataAccessParts.Report:
            switch (Dalt)
            {
            case DataAccessLevelsType.Source:
                if (SearchItem != string.Empty)
                {
                    DalList = this.MultiLevelsDataAccessLevelesBusiness.GetReportChilds(parentDal.ID, SearchItem);
                }
                else
                {
                    DalList = this.MultiLevelsDataAccessLevelesBusiness.GetReportChilds(parentDal.ID);
                }
                break;

            case DataAccessLevelsType.Target:
                DalList = this.MultiLevelsDataAccessLevelesBusiness.GetReportOfUser(UserID, parentDal.ID, SearchItem);
                break;
            }
            break;

        case DataAccessParts.RuleGroup:
            switch (Dalt)
            {
            case DataAccessLevelsType.Source:
                if (SearchItem != string.Empty)
                {
                    DalList = this.MultiLevelsDataAccessLevelesBusiness.GetRuleChilds(parentDal.ID, SearchItem);
                }
                else
                {
                    DalList = this.MultiLevelsDataAccessLevelesBusiness.GetRuleChilds(parentDal.ID);
                }
                break;

            case DataAccessLevelsType.Target:
                DalList = this.MultiLevelsDataAccessLevelesBusiness.GetRuleOfUser(UserID, parentDal.ID, SearchItem);
                break;
            }
            break;

        case DataAccessParts.Role:

            switch (Dalt)
            {
            case DataAccessLevelsType.Source:
                if (SearchItem != string.Empty)
                {
                    DalList = this.MultiLevelsDataAccessLevelesBusiness.GetRoleChilds(parentDal.ID, SearchItem);
                }
                else
                {
                    DalList = this.MultiLevelsDataAccessLevelesBusiness.GetRoleChilds(parentDal.ID, SearchItem);
                }
                break;

            case DataAccessLevelsType.Target:
                DalList = this.MultiLevelsDataAccessLevelesBusiness.GetRoleOfUser(UserID, parentDal.ID, SearchItem);
                break;
            }
            break;
        }

        foreach (DataAccessProxy childDal in DalList)
        {
            TreeViewNode childDalNode = new TreeViewNode();
            childDalNode.ID    = childDal.ID.ToString();
            childDalNode.Text  = childDal.Name;
            childDalNode.Value = childDal.DeleteEnable.ToString().ToLower();
            //if (DataAccessLevelKey == DataAccessParts.OrganizationUnit && SearchItem == string.Empty)
            //{
            //    childDalNode.ContentCallbackUrl = "XmlMultiLevelsDataAccessLevels.aspx?Dalt=" + Dalt.ToString() + "&Dalk=" + DataAccessLevelKey.ToString() + "&UserID=" + UserID.ToString() + "&ParentDalID=" + childDalNode.ID + "&LangID=" + this.LangProv.GetCurrentLanguage();
            //    if (this.MultiLevelsDataAccessLevelesBusiness.GetOrganizationChilds(childDal.ID).Count > 0)
            //        childDalNode.Nodes.Add(new TreeViewNode());
            //}
            string ImagePath = string.Empty;
            string ImageUrl  = string.Empty;
            if (childDal.DeleteEnable)
            {
                if (DataAccessLevelKey != DataAccessParts.Report)
                {
                    ImagePath = "\\Images\\TreeView\\folder_blue.gif";
                    ImageUrl  = "Images/TreeView/folder_blue.gif";
                }
                else
                {
                    if (childDal.IsReport)
                    {
                        ImagePath = "\\Images\\TreeView\\report.png";
                        ImageUrl  = "Images/TreeView/report.png";
                    }
                    else
                    {
                        ImagePath = "\\Images\\TreeView\\group.png";
                        ImageUrl  = "Images/TreeView/group.png";
                    }
                }
            }
            else
            {
                if (DataAccessLevelKey != DataAccessParts.Report)
                {
                    ImagePath = "\\Images\\TreeView\\folder.gif";
                    ImageUrl  = "Images/TreeView/folder.gif";
                }
                else
                {
                    if (childDal.IsReport)
                    {
                        ImagePath = "\\Images\\TreeView\\report_silver.png";
                        ImageUrl  = "Images/TreeView/report_silver.png";
                    }
                    else
                    {
                        ImagePath = "\\Images\\TreeView\\group_silver.png";
                        ImageUrl  = "Images/TreeView/group_silver.png";
                    }
                }
            }
            if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImagePath))
            {
                childDalNode.ImageUrl = ImageUrl;
            }
            parentDalNode.Nodes.Add(childDalNode);
            try
            {
                if (parentDalNode.Parent.Parent == null)
                {
                    parentDalNode.Expanded = true;
                }
            }
            catch
            { }
            switch (DataAccessLevelKey)
            {
            case DataAccessParts.Department:
                if (this.MultiLevelsDataAccessLevelesBusiness.GetDepartmentChilds(childDal.ID).Count > 0)
                {
                    HasChildDals = true;
                }
                break;

            case DataAccessParts.Report:
                if (this.MultiLevelsDataAccessLevelesBusiness.GetReportChilds(childDal.ID).Count > 0)
                {
                    HasChildDals = true;
                }
                break;

            case DataAccessParts.OrganizationUnit:
                //if (SearchItem != string.Empty)
                //{
                if (this.MultiLevelsDataAccessLevelesBusiness.GetOrganizationChilds(childDal.ID).Count > 0)
                {
                    HasChildDals = true;
                }
                break;
                //}
                break;

            case DataAccessParts.RuleGroup:
                break;
            }
            if (HasChildDals)
            {
                this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, Dalot, UserID, SearchKey, UserSearchTerm, childDalNode, childDal, string.Empty);
            }
        }
    }
    private void GetDataAccessLevelsRoot_MultiLevelsDataAccessLevels(ComponentArt.Web.UI.TreeView trvDataAccessLevels, DataAccessLevelsType Dalt, DataAccessParts DataAccessLevelKey, DataAccessLevelOperationType?Dalot, DataAccessLevelOperationState?Dalos, decimal UserID, UserSearchKeys?SearchKey, string UserSearchTerm, LoadSttate Ls, string SearchItem)
    {
        DataAccessProxy rootDals         = null;
        string          rootDalsNodeText = string.Empty;

        if (Dalot == DataAccessLevelOperationType.Group && Dalos == DataAccessLevelOperationState.After)
        {
            UserID = BUser.CurrentUser.ID;
        }
        switch (DataAccessLevelKey)
        {
        case DataAccessParts.Department:
            rootDals = this.MultiLevelsDataAccessLevelesBusiness.GetDepartmentRoot(Dalt, UserID);
            if (GetLocalResourceObject("OrgNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels") != null)
            {
                rootDalsNodeText = GetLocalResourceObject("OrgNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels").ToString();
            }
            else
            {
                rootDalsNodeText = rootDals.Name;
            }
            break;

        case DataAccessParts.OrganizationUnit:
            rootDals = this.MultiLevelsDataAccessLevelesBusiness.GetOrganizationRoot(Dalt, UserID);
            if (GetLocalResourceObject("OrgNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels") != null)
            {
                rootDalsNodeText = GetLocalResourceObject("OrgNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels").ToString();
            }
            else
            {
                rootDalsNodeText = rootDals.Name;
            }
            break;

        case DataAccessParts.Report:
            rootDals = this.MultiLevelsDataAccessLevelesBusiness.GetReportRoot(Dalt, UserID);
            if (GetLocalResourceObject("ReportsNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels") != null)
            {
                rootDalsNodeText = GetLocalResourceObject("ReportsNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels").ToString();
            }
            else
            {
                rootDalsNodeText = rootDals.Name;
            }
            break;

        case DataAccessParts.RuleGroup:
            rootDals = this.MultiLevelsDataAccessLevelesBusiness.GetRuleRoot(Dalt, UserID);
            if (GetLocalResourceObject("RulesGroupsNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels") != null)
            {
                rootDalsNodeText = GetLocalResourceObject("RulesGroupsNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels").ToString();
            }
            else
            {
                rootDalsNodeText = rootDals.Name;
            }
            break;

        case DataAccessParts.Role:
            rootDals = this.MultiLevelsDataAccessLevelesBusiness.GetRoleRoot(Dalt, UserID);
            if (GetLocalResourceObject("RolesNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels") != null)
            {
                rootDalsNodeText = GetLocalResourceObject("RolesNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels").ToString();
            }
            else
            {
                rootDalsNodeText = rootDals.Name;
            }
            break;
        }
        TreeViewNode rootDalsNode = new TreeViewNode();

        rootDalsNode.ID    = rootDals.ID.ToString();
        rootDalsNode.Text  = rootDalsNodeText;
        rootDalsNode.Value = rootDals.DeleteEnable.ToString().ToLower();
        string ImagePath = string.Empty;
        string ImageUrl  = string.Empty;

        if (rootDals.DeleteEnable)
        {
            if (DataAccessLevelKey != DataAccessParts.Report)
            {
                ImagePath = PathHelper.GetModulePath_Nuke() + "\\Images\\TreeView\\folder_blue.gif";
                ImageUrl  = PathHelper.GetModuleUrl_Nuke() + "Images/TreeView/folder_blue.gif";
            }
            else
            {
                ImagePath = PathHelper.GetModulePath_Nuke() + "\\Images\\TreeView\\group.png";
                ImageUrl  = PathHelper.GetModuleUrl_Nuke() + "Images/TreeView/group.png";
            }
        }
        else
        {
            if (DataAccessLevelKey != DataAccessParts.Report)
            {
                ImagePath = PathHelper.GetModulePath_Nuke() + "\\Images\\TreeView\\folder.gif";
                ImageUrl  = PathHelper.GetModuleUrl_Nuke() + "Images/TreeView/folder.gif";
            }
            else
            {
                ImagePath = PathHelper.GetModulePath_Nuke() + "\\Images\\TreeView\\group_silver.png";
                ImageUrl  = PathHelper.GetModuleUrl_Nuke() + "Images/TreeView/group_silver.png";
            }
        }
        if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImagePath))
        {
            rootDalsNode.ImageUrl = ImageUrl;
        }
        trvDataAccessLevels.Nodes.Add(rootDalsNode);
        rootDalsNode.Expanded = true;
        switch (Ls)
        {
        case LoadSttate.Search:
            switch (Dalot)
            {
            case DataAccessLevelOperationType.Single:
                this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, null, UserID, SearchKey, string.Empty, rootDalsNode, rootDals, SearchItem);
                break;

            case DataAccessLevelOperationType.Group:
                switch (Dalos)
                {
                case DataAccessLevelOperationState.Before:
                    break;

                case DataAccessLevelOperationState.After:
                    this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, Dalot, UserID, SearchKey, UserSearchTerm, rootDalsNode, rootDals, SearchItem);
                    break;
                }
                break;

            default:
                if (Dalt == DataAccessLevelsType.Source)
                {
                    this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, Dalot, UserID, SearchKey, UserSearchTerm, rootDalsNode, rootDals, SearchItem);
                }
                break;
            }
            break;

        case LoadSttate.Normal:
            switch (Dalot)
            {
            case DataAccessLevelOperationType.Single:
                this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, null, UserID, SearchKey, string.Empty, rootDalsNode, rootDals);
                break;

            case DataAccessLevelOperationType.Group:
                switch (Dalos)
                {
                case DataAccessLevelOperationState.Before:
                    break;

                case DataAccessLevelOperationState.After:
                    this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, Dalot, UserID, SearchKey, UserSearchTerm, rootDalsNode, rootDals);
                    break;
                }
                break;

            default:
                if (Dalt == DataAccessLevelsType.Source)
                {
                    this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, Dalot, UserID, SearchKey, UserSearchTerm, rootDalsNode, rootDals);
                }
                break;
            }
            break;
        }
    }
 public static void EmptyTreeNode(TreeViewNode node)
 {
     node.Children.Clear();
     node.HasUnrealizedChildren = true;
 }
    static void AddAssetToResourceTreeView(U3DAssetInfo assetInfo)
    {
        TreeViewCtrl resTreeList = s_root.FindControl("_ResTreeList") as TreeViewCtrl;

        if (resTreeList == null)
        {
            return;
        }

        bool expandTreeNode = false;

        if ((ResourceManageToolModel.GetInstance().CurrFilter as NullTypeFilter) == null)
        {//非过滤器为全部文件则节点都展开
            expandTreeNode = true;
        }

        string assetPath = assetInfo.path;
        string currPath  = assetPath;
        List <TreeViewNode> currLevelNodeList = resTreeList.Roots;
        TreeViewNode        parentNode        = null;
        int len = 0;

        while (currPath != "")
        {
            int i = currPath.IndexOf('/');
            if (i < 0)
            {
                i = currPath.Length;
            }
            len += i + 1;
            string pathNodeName     = currPath.Substring(0, i);
            string currNodeFullPath = assetPath.Substring(0, len - 1);
            if (i + 1 < currPath.Length)
            {
                currPath = currPath.Substring(i + 1);
            }
            else
            {
                currPath = "";
            }


            bool findNode = false;
            foreach (var treeNode in currLevelNodeList)
            {
                if (treeNode.name == pathNodeName)
                {
                    findNode          = true;
                    parentNode        = treeNode;
                    currLevelNodeList = treeNode.children;
                    break;
                }
            }

            if (!findNode)
            {
                U3DAssetInfo info    = null;
                TreeViewNode newNode = new TreeViewNode();
                newNode.name = pathNodeName;
                ResourceManageToolModel.GetInstance().Find(currNodeFullPath, out info);
                newNode.image          = info.icon;
                newNode.userObject     = info.guid;
                newNode.state.IsExpand = expandTreeNode;

                if (parentNode == null)
                {//说明需要作为根节点插入树视图中
                    currLevelNodeList.Add(newNode);
                }
                else
                {
                    parentNode.Add(newNode);
                }

                parentNode        = newNode;
                currLevelNodeList = newNode.children;
            }
        }
    }
예제 #18
0
        private static void AddTreeNodeIfDoesntExist(Apsim.ModelDescription modelThatCanBeAdded, TreeViewNode parent)
        {
            List <string> namespaceWords;

            // Remove the first namespace word ('Models')
            bool resourceIsInSubDirectory = false;

            if (modelThatCanBeAdded.ResourceString != null)
            {
                // Need to determine if the resource name is in a sub directory of Models.Resources e.g. Models.Resources.GrazPlan.Cattle.Angus.json
                var subDirectory = modelThatCanBeAdded.ResourceString.Replace("Models.Resources.", "").Replace(".json", "");
                resourceIsInSubDirectory = subDirectory.Contains('.');
            }
            if (resourceIsInSubDirectory)
            {
                var path = modelThatCanBeAdded.ResourceString.Replace("Models.Resources.", "");
                namespaceWords = path.Split(".".ToCharArray()).ToList();
                namespaceWords.Remove(namespaceWords.Last());  // remove the "json" word at the end.
                namespaceWords.Remove(namespaceWords.Last());  // remove the model name at the end.
            }
            else
            {
                namespaceWords = modelThatCanBeAdded.ModelType.Namespace.Split(".".ToCharArray()).ToList();
                namespaceWords.Remove(namespaceWords.First());
                modelThatCanBeAdded.ResourceString = modelThatCanBeAdded.ModelName;
            }

            foreach (var namespaceWord in namespaceWords.Where(word => word != "Models"))
            {
                var node = parent.Children.Find(n => n.Name == namespaceWord);
                if (node == null)
                {
                    node = new TreeViewNode()
                    {
                        Name = namespaceWord,
                        ResourceNameForImage = ExplorerPresenter.GetIconResourceName(typeof(Folder), null, null)
                    };
                    parent.Children.Add(node);
                }
                parent = node;
            }

            // Add the last model
            var description = new TreeViewNode()
            {
                Name = modelThatCanBeAdded.ModelName,
                ResourceNameForImage = ExplorerPresenter.GetIconResourceName(modelThatCanBeAdded.ModelType, modelThatCanBeAdded.ModelName, modelThatCanBeAdded.ResourceString)
            };

            parent.Children.Add(description);
        }
예제 #19
0
        public static void BuildComponentArtTreeView(ComponentArt.Web.UI.TreeView tvTargetTree, IList list,
                                                     string strIdProperty, string strParentIdProperty,
                                                     string strTextProperty, string strTooltipProperty, string strValueProperty,
                                                     string strNavigateUrlProperty, string strImageUrlProperty, string strTarget)
        {
            ComponentArt.Web.UI.TreeViewNode node = null;

            if (list.Count > 0)
            {
                Type   objType     = list[0].GetType();
                string strParentId = string.Empty;

                foreach (object o in list)
                {
                    node = new TreeViewNode();

                    // ID
                    if (string.IsNullOrEmpty(strIdProperty))
                    {
                        throw new Exception("树节点ID属性不能为空!");
                    }
                    node.ID = objType.GetProperty(strIdProperty).GetValue(o, null).ToString();

                    // ParentId
                    if (string.IsNullOrEmpty(strParentIdProperty))
                    {
                        throw new Exception("树节点父ID属性不能为空!");
                    }
                    strParentId = objType.GetProperty(strParentIdProperty).GetValue(o, null).ToString();

                    // Text
                    if (string.IsNullOrEmpty(strTextProperty))
                    {
                        throw new Exception("树节点Text属性不能为空!");
                    }
                    node.Text = objType.GetProperty(strTextProperty).GetValue(o, null).ToString();

                    // Tooltip
                    if (!string.IsNullOrEmpty(strTooltipProperty))
                    {
                        node.ToolTip = objType.GetProperty(strTooltipProperty).GetValue(o, null).ToString();
                    }

                    // Value
                    if (!string.IsNullOrEmpty(strValueProperty))
                    {
                        node.Value = objType.GetProperty(strValueProperty).GetValue(o, null).ToString();
                    }
                    else
                    {
                        node.Value = objType.GetProperty(strValueProperty).GetValue(o, null).ToString();
                    }

                    // NavigateUrl
                    if (!string.IsNullOrEmpty(strNavigateUrlProperty))
                    {
                        node.NavigateUrl = objType.GetProperty(strNavigateUrlProperty).GetValue(o, null).ToString();
                    }

                    // ImageUrl
                    if (!string.IsNullOrEmpty(strImageUrlProperty))
                    {
                        node.ImageUrl = objType.GetProperty(strImageUrlProperty).GetValue(o, null).ToString();
                    }

                    // Target
                    if (!string.IsNullOrEmpty(strTarget))
                    {
                        node.Target = objType.GetProperty(strTarget).GetValue(o, null).ToString();
                    }

                    // Append node
                    if (strParentId == "0")
                    {// Root node
                        tvTargetTree.Nodes.Add(node);
                    }
                    else
                    {
                        tvTargetTree.FindNodeById(strParentId).Nodes.Add(node);
                    }
                }
            }
        }
        private TreeView GenerateTreeview()
        {
            // We'll use a TreeView instance to generate the appropriate XML structure
            ComponentArt.Web.UI.TreeView tv = new ComponentArt.Web.UI.TreeView();

            string handlerPath = String.Concat(Utils.GalleryRoot, "/handler/gettreeviewxml.ashx");

            IAlbum parentAlbum = AlbumController.LoadAlbumInstance(this._albumId, true);

            string securityActionParm = String.Empty;
            if (SecurityActionEnumHelper.IsValidSecurityAction(this._securityAction))
            {
                securityActionParm = String.Format(CultureInfo.CurrentCulture, "&secaction={0}", (int)this._securityAction);
            }

            foreach (IAlbum childAlbum in parentAlbum.GetChildGalleryObjects(GalleryObjectType.Album, true, !Utils.IsAuthenticated))
            {
                TreeViewNode node = new TreeViewNode();
                node.Text = Utils.RemoveHtmlTags(childAlbum.Title);
                node.Value = childAlbum.Id.ToString(CultureInfo.InvariantCulture);
                node.ID = childAlbum.Id.ToString(CultureInfo.InvariantCulture);

                if (!String.IsNullOrEmpty(_navigateUrl))
                {
                    node.NavigateUrl = Utils.AddQueryStringParameter(_navigateUrl, String.Concat("aid=", childAlbum.Id.ToString(CultureInfo.InvariantCulture)));
                    node.HoverCssClass = "tv0HoverTreeNodeLink";
                }

                bool isUserAuthorized = true;
                if (SecurityActionEnumHelper.IsValidSecurityAction(this._securityAction))
                {
                    isUserAuthorized = Utils.IsUserAuthorized(_securityAction, RoleController.GetGalleryServerRolesForUser(), childAlbum.Id, childAlbum.GalleryId, childAlbum.IsPrivate);
                }
                node.ShowCheckBox = isUserAuthorized && _showCheckbox;
                node.Selectable = isUserAuthorized;
                if (!isUserAuthorized) node.HoverCssClass = String.Empty;

                if (childAlbum.GetChildGalleryObjects(GalleryObjectType.Album).Count > 0)
                {
                    string handlerPathWithAlbumId = Utils.AddQueryStringParameter(handlerPath, String.Concat("aid=", childAlbum.Id.ToString(CultureInfo.InvariantCulture)));
                    node.ContentCallbackUrl = String.Format(CultureInfo.CurrentCulture, "{0}{1}&sc={2}&nurl={3}", handlerPathWithAlbumId, securityActionParm, node.ShowCheckBox, Utils.UrlEncode(_navigateUrl));
                }

                tv.Nodes.Add(node);
            }

            return tv;
        }
예제 #21
0
    public void LoadTree (ITreeNodeObject root)
    {
        TreeViewNode node0 = new TreeViewNode(root.Name, "" + root.Identity);

        buildTree(node0, root);
        this.SetContent(node0);
    }
예제 #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string  strKnowledgeId = Request.QueryString.Get("id");
            ItemBLL objItemBll     = new ItemBLL();
            string  strItemTypeID  = Request.QueryString.Get("itemTypeID");

            if (!string.IsNullOrEmpty(strKnowledgeId))
            {
                ComponentArt.Web.UI.TreeView tvBookBook = new ComponentArt.Web.UI.TreeView();
                string  strflag = Request.QueryString.Get("flag");
                BookBLL bookBLL = new BookBLL();
                IList <RailExam.Model.Book> bookList = null;

                if (strflag != null && strflag == "2")
                {
                    int trainTypeID = Convert.ToInt32(strKnowledgeId);
                    int postID      = Convert.ToInt32(Request.QueryString.Get("PostID"));
                    int orgID       = Convert.ToInt32(Request.QueryString.Get("OrgID"));
                    int leader      = Convert.ToInt32(Request.QueryString.Get("Leader"));
                    int techID      = Convert.ToInt32(Request.QueryString.Get("Tech"));
                    bookList = bookBLL.GetEmployeeStudyBookInfoByTrainTypeID(trainTypeID, orgID, postID, leader, techID, 0);
                }
                else
                {
                    bookList = bookBLL.GetBookByTrainTypeIDPath(strKnowledgeId);
                }


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

                    foreach (RailExam.Model.Book book in bookList)
                    {
                        tvn       = new TreeViewNode();
                        tvn.ID    = book.bookId.ToString();
                        tvn.Value = book.bookId.ToString();
                        if (Request.QueryString.Get("item") != null && Request.QueryString.Get("item") == "no")
                        {
                            tvn.Text = book.bookName;
                        }
                        else
                        {
                            int n = objItemBll.GetItemsByBookID(book.bookId, Convert.ToInt32(strItemTypeID));
                            if (n > 0)
                            {
                                tvn.Text = book.bookName + "(" + n + ")";
                            }
                            else
                            {
                                tvn.Text = book.bookName;
                            }
                        }

                        tvn.ToolTip = book.bookName;
                        tvn.Attributes.Add("isBook", "true");
                        tvn.ImageUrl = "~/App_Themes/" + StyleSheetTheme + "/Images/TreeView/Book.gif";

                        if (strflag != null && (strflag == "2" || strflag == "3"))
                        {
                            tvn.ShowCheckBox = true;
                        }
                        if (Request.QueryString.Get("item") != null && Request.QueryString.Get("item") == "no")
                        {
                            if (strflag != null)
                            {
                                if (strflag != "3")
                                {
                                    tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?item=no&flag=" + strflag + "&id=" +
                                                             book.bookId;
                                }
                            }
                            else
                            {
                                tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?item=no&id=" + book.bookId;
                            }
                        }
                        else
                        {
                            if (strflag != null)
                            {
                                if (strflag != "3")
                                {
                                    tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?itemTypeID=" + strItemTypeID + "&flag=" + strflag + "&id=" +
                                                             book.bookId;
                                }
                            }
                            else
                            {
                                tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?itemTypeID=" + strItemTypeID + "&id=" + book.bookId;
                            }
                        }

                        tvBookBook.Nodes.Add(tvn);
                    }
                }

                Response.Clear();
                Response.ClearHeaders();
                Response.ContentType = "text/xml";
                Response.Cache.SetNoStore();

                string strXmlEncoding = string.Empty;
                try
                {
                    strXmlEncoding = System.Configuration.ConfigurationManager.AppSettings["CallbackEncoding"];
                }
                catch
                {
                    strXmlEncoding = "gb2312";
#if DEBUG
                    System.Diagnostics.Debug.WriteLine("Error Accessing Web.Config File!\r\n"
                                                       + "Using \"gb2312\"!");
#endif
                }
                if (string.IsNullOrEmpty(strXmlEncoding))
                {
                    strXmlEncoding = "gb2312";
#if DEBUG
                    System.Diagnostics.Debug.WriteLine("CallbackEncoding Empty in Web.Config File!\r\n"
                                                       + "Using \"gb2312\"!");
#endif
                }
                else
                {
                    try
                    {
                        System.Text.Encoding enc = System.Text.Encoding.GetEncoding(strXmlEncoding);
                    }
                    catch
                    {
#if DEBUG
                        System.Diagnostics.Debug.WriteLine("Invalid Encoding in Web.Config File!\r\n"
                                                           + "Using \"gb2312\"!");
#endif
                        strXmlEncoding = "gb2312";
                    }
                }

                Response.Write("<?xml version=\"1.0\" encoding=\"" + strXmlEncoding + "\" standalone=\"yes\" ?>\r\n"
                               + tvBookBook.GetXml());
                Response.Flush();
                Response.End();
            }
        }
예제 #23
0
 protected void Page_PreRender (object sender, EventArgs e)
 {
     TreeViewNode tempRoot = new TreeViewNode("", "");
     tempRoot.children.Add(Content);
     tempRoot.refreshChildSelectionCount();
     treeView.InnerHtml = RenderContent(tempRoot.children, tempRoot);
     PreviousSelectedValue = SelectedValue;
 }
 private void GetChildMissionLocation_trvMissionLocation_HourlyRequestOnAbsence(TreeViewNode parentDutyPlaceNode, DutyPlace parentDutyPlace)
 {
     foreach (DutyPlace childDutyPlace in this.RequestBusiness.GetAllDutyPlaceChild(parentDutyPlace.ID))
     {
         TreeViewNode trvNodeChildDutyPlace = new TreeViewNode();
         trvNodeChildDutyPlace.Text = childDutyPlace.Name;
         trvNodeChildDutyPlace.ID   = childDutyPlace.ID.ToString();
         if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\Images\\TreeView\\folder.gif"))
         {
             trvNodeChildDutyPlace.ImageUrl = "Images/TreeView/folder.gif";
         }
         parentDutyPlaceNode.Nodes.Add(trvNodeChildDutyPlace);
         if (this.RequestBusiness.GetAllDutyPlaceChild(childDutyPlace.ID).Count > 0)
         {
             this.GetChildMissionLocation_trvMissionLocation_HourlyRequestOnAbsence(trvNodeChildDutyPlace, childDutyPlace);
         }
     }
 }
예제 #25
0
        /// <summary>
        /// Binds the ListFolder tree.
        /// </summary>
        private void BindTree()
        {
            int iFolderId = -1;
            switch (rbList.SelectedValue)
            {
                case "1":
                    iFolderId = ListManager.GetPublicRoot().PrimaryKeyId.Value;
                    break;
                case "2":
                    int prjId = ucProject.ObjectId;
                    if (prjId > 0)
                        iFolderId = ListManager.GetProjectRoot(prjId).PrimaryKeyId.Value;
                    break;
                default:
                    iFolderId = ListManager.GetPrivateRoot(Mediachase.IBN.Business.Security.CurrentUser.UserID).PrimaryKeyId.Value;
                    break;
            }

            int selFolderId = iFolderId;
            if(!String.IsNullOrEmpty(destFolderId.Value))
                selFolderId = int.Parse(destFolderId.Value);

            MoveTree.Nodes.Clear();
            MoveTree.ClientSideOnNodeSelect = "onNodeClick";
            if (iFolderId > 0)
            {
                TreeViewNode node;
                ListFolder folder = new ListFolder(iFolderId);
                node = new TreeViewNode();
                if (folder.FolderType == ListFolderType.Private)
                {
                    node.Text = CHelper.GetResFileString("{IbnFramework.ListInfo:tPrivateLists}");
                    node.ID = "listfolder" + iFolderId.ToString() + "private";
                }
                else if (folder.FolderType == ListFolderType.Public)
                {
                    node.Text = CHelper.GetResFileString("{IbnFramework.ListInfo:tPublicLists}");
                    node.ID = "listfolder" + iFolderId.ToString();
                }
                else if (folder.FolderType == ListFolderType.Project)
                {
                    node.Text = Task.GetProjectTitle(folder.ProjectId.Value);
                    node.ID = "listfolder" + iFolderId.ToString() + "project";
                }
                node.Value = iFolderId.ToString();
                if (folder.HasChildren)
                    BindSubNodes(node, folder, selFolderId);
                MoveTree.Nodes.Add(node);
                if(iFolderId == selFolderId)
                    MoveTree.SelectedNode = node;
                destFolderId.Value = selFolderId.ToString();
                if (rbUpdList.Checked)
                    BindLists(selFolderId);
            }
        }
예제 #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string  strKnowledgeId = Request.QueryString.Get("id");
            string  strflag        = Request.QueryString.Get("flag");
            string  strItemTypeID  = Request.QueryString.Get("itemTypeID");
            ItemBLL objItemBll     = new ItemBLL();
            string  strBook        = "";

            if (!string.IsNullOrEmpty(strKnowledgeId))
            {
                ComponentArt.Web.UI.TreeView tvBookBook = new ComponentArt.Web.UI.TreeView();

                BookBLL bookBLL = new BookBLL();
                IList <RailExam.Model.Book> bookList = null;
                if (strflag != null && strflag == "2")
                {
                    int knowledgeID = Convert.ToInt32(strKnowledgeId);
                    int postID      = Convert.ToInt32(Request.QueryString.Get("PostID"));
                    int orgID       = Convert.ToInt32(Request.QueryString.Get("OrgID"));
                    int leader      = Convert.ToInt32(Request.QueryString.Get("Leader"));
                    int techID      = Convert.ToInt32(Request.QueryString.Get("Tech"));
                    bookList = bookBLL.GetEmployeeStudyBookInfoByKnowledgeID(knowledgeID, orgID, postID, leader, techID, 0);
                }
                else
                {
                    if (PrjPub.CurrentLoginUser.SuitRange == 0 && Request.QueryString.Get("source") == "itemlist")
                    {
                        bookList = bookBLL.GetBookByKnowledgeIDPath(strKnowledgeId, PrjPub.CurrentLoginUser.StationOrgID);

                        if (!string.IsNullOrEmpty(Request.QueryString.Get("postId")))
                        {
                            string       postID = Request.QueryString.Get("postId");
                            OracleAccess oa     = new OracleAccess();

                            string sql = String.Format(
                                @"select book_id from BOOK_RANGE_POST t 
                            where 
                            post_id = {0} 
                            or 
                            post_id in 
                                (select post_id from POST t where parent_id = {0})",
                                postID
                                );

                            IList <RailExam.Model.Book> booksViaPosts = new List <RailExam.Model.Book>();
                            DataSet dsBookIDs = oa.RunSqlDataSet(sql);
                            if (dsBookIDs != null && dsBookIDs.Tables.Count > 0)
                            {
                                foreach (RailExam.Model.Book book in bookList)
                                {
                                    DataRow[] drs = dsBookIDs.Tables[0].Select("book_id=" + book.bookId);
                                    if (drs.Length > 0)
                                    {
                                        booksViaPosts.Add(book);
                                    }
                                }
                                bookList.Clear();
                                bookList = booksViaPosts;
                            }
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(Request.QueryString.Get("RandomExamID")))
                        {
                            string                    examId  = Request.QueryString.Get("RandomExamID");
                            RandomExamBLL             objBll  = new RandomExamBLL();
                            RailExam.Model.RandomExam objexam = objBll.GetExam(Convert.ToInt32(examId));
                            string                    strPost = objexam.PostID;

                            if (objexam.AutoSaveInterval == 1)
                            {
                                strPost = "";
                            }

                            bookList = bookBLL.GetBookByKnowledgeIDPath(strKnowledgeId);

                            OracleAccess oa = new OracleAccess();
                            if (strPost != "")
                            {
                                string sql =
                                    @"select book_id from BOOK_RANGE_POST t 
                                     where  post_id in (" +
                                    strPost + @")";
                                DataTable dt = oa.RunSqlDataSet(sql).Tables[0];

                                IList <RailExam.Model.Book> objList = new List <RailExam.Model.Book>();
                                foreach (RailExam.Model.Book book in bookList)
                                {
                                    DataRow[] dr = dt.Select("book_id=" + book.bookId);
                                    if (dr.Length > 0)
                                    {
                                        objList.Add(book);
                                    }
                                }
                                bookList.Clear();
                                bookList = objList;
                            }

                            if (objexam.HasTrainClass)
                            {
                                string sql = "select * from ZJ_Train_Class_Subject_Book a "
                                             +
                                             " inner join ZJ_Train_Class_Subject b on a.Train_Class_Subject_ID = b.Train_Class_Subject_ID "
                                             +
                                             " where b.Train_Class_ID in (select Train_Class_ID from Random_Exam_Train_Class "
                                             + " where Random_Exam_ID=" + objexam.RandomExamId + ")";
                                DataTable dt = oa.RunSqlDataSet(sql).Tables[0];

                                foreach (DataRow dr in dt.Rows)
                                {
                                    if (strBook == "")
                                    {
                                        strBook += dr["Book_ID"].ToString();
                                    }
                                    else
                                    {
                                        strBook += "," + dr["Book_ID"];
                                    }
                                }
                            }
                        }
                        else
                        {
                            bookList = bookBLL.GetBookByKnowledgeIDPath(strKnowledgeId);

                            OracleAccess oa = new OracleAccess();
                            IList <RailExam.Model.Book> booksViaPosts = new List <RailExam.Model.Book>();

                            if (!string.IsNullOrEmpty(Request.QueryString.Get("postId")))
                            {
                                string postID = Request.QueryString.Get("postId");

                                string sql = String.Format(
                                    @"select book_id from BOOK_RANGE_POST t 
                            where 
                            post_id = {0} 
                            or 
                            post_id in 
                                (select post_id from POST t where parent_id = {0})",
                                    postID
                                    );

                                DataSet dsBookIDs = oa.RunSqlDataSet(sql);
                                if (dsBookIDs != null && dsBookIDs.Tables.Count > 0)
                                {
                                    foreach (RailExam.Model.Book book in bookList)
                                    {
                                        DataRow[] drs = dsBookIDs.Tables[0].Select("book_id=" + book.bookId);
                                        if (drs.Length > 0)
                                        {
                                            booksViaPosts.Add(book);
                                        }
                                    }
                                    bookList.Clear();
                                    bookList = booksViaPosts;
                                }
                            }

                            //铁路系统权限
                            int railSystemid = PrjPub.RailSystemId();
                            if (railSystemid != 0)
                            {
                                string sql = String.Format(
                                    @"select book_id from BOOK_RANGE_ORG t 
                                        where 
                                         org_Id in (select org_id from org where rail_System_Id={0} and level_num=2) ",
                                    railSystemid
                                    );

                                DataSet dsBookIDs = oa.RunSqlDataSet(sql);
                                if (dsBookIDs != null && dsBookIDs.Tables.Count > 0)
                                {
                                    foreach (RailExam.Model.Book book in bookList)
                                    {
                                        DataRow[] drs = dsBookIDs.Tables[0].Select("book_id=" + book.bookId);
                                        if (drs.Length > 0)
                                        {
                                            booksViaPosts.Add(book);
                                        }
                                    }
                                    bookList.Clear();
                                    bookList = booksViaPosts;
                                }
                            }
                        }
                    }
                }

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

                    foreach (RailExam.Model.Book book in bookList)
                    {
                        tvn       = new TreeViewNode();
                        tvn.ID    = book.bookId.ToString();
                        tvn.Value = book.bookId.ToString();
                        if (Request.QueryString.Get("item") != null && Request.QueryString.Get("item") == "no")
                        {
                            tvn.Text = book.bookName;
                        }
                        else
                        {
                            int n = objItemBll.GetItemsByBookID(book.bookId, Convert.ToInt32(strItemTypeID));
                            if (n > 0)
                            {
                                tvn.Text = book.bookName + "(" + n + "题)";
                            }
                            else
                            {
                                tvn.Text = book.bookName;
                            }
                        }

                        if (("," + strBook + ",").IndexOf("," + book.bookId + ",") >= 0)
                        {
                            tvn.ImageUrl = "~/App_Themes/" + StyleSheetTheme + "/Images/TreeView/RedBook.gif";
                        }
                        else
                        {
                            tvn.ImageUrl = "~/App_Themes/" + StyleSheetTheme + "/Images/TreeView/Book.gif";
                        }

                        tvn.ToolTip = book.bookName;
                        tvn.Attributes.Add("isBook", "true");

                        if (strflag != null && (strflag == "2" || strflag == "3" || strflag == "4"))
                        {
                            tvn.ShowCheckBox = true;

                            if (strflag == "4")
                            {
                                string strBookIds = Request.QueryString.Get("bookIds");
                                if (("|" + strBookIds + "|").IndexOf("|" + book.bookId + "|") >= 0)
                                {
                                    tvn.Checked = true;
                                }
                            }
                        }



                        //没有题目数量显示
                        if (Request.QueryString.Get("item") != null && Request.QueryString.Get("item") == "no")
                        {
                            if (strflag != null)
                            {
                                if (strflag == "2")
                                {
                                    tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?item=no&flag=" + strflag + "&id=" + book.bookId;
                                }
                                //屏蔽教材
                                else if (strflag == "1")
                                {
                                    tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?item=no&flag=" + strflag + "&id=" + book.bookId + "&StrategyID=" + Request.QueryString.Get("StrategyID");
                                }
                            }
                            else
                            {
                                tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?item=no&id=" + book.bookId;
                            }
                        }
                        else
                        {
                            if (strflag != null)
                            {
                                if (strflag == "2")
                                {
                                    tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?itemTypeID=" + strItemTypeID + "&flag=" + strflag + "&id=" + book.bookId;
                                }
                                //屏蔽教材
                                else if (strflag == "1")
                                {
                                    tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?itemTypeID=" + strItemTypeID + "&flag=" + strflag + "&id=" + book.bookId + "&StrategyID=" + Request.QueryString.Get("StrategyID");
                                }
                            }
                            else
                            {
                                tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?itemTypeID=" + strItemTypeID + "&id=" + book.bookId;
                            }
                        }

                        tvBookBook.Nodes.Add(tvn);
                    }
                }

                Response.Clear();
                Response.ClearHeaders();
                Response.ContentType = "text/xml";
                Response.Cache.SetNoStore();

                string strXmlEncoding = string.Empty;
                try
                {
                    strXmlEncoding = System.Configuration.ConfigurationManager.AppSettings["CallbackEncoding"];
                }
                catch
                {
                    strXmlEncoding = "gb2312";
#if DEBUG
                    System.Diagnostics.Debug.WriteLine("Error Accessing Web.Config File!\r\n"
                                                       + "Using \"gb2312\"!");
#endif
                }
                if (string.IsNullOrEmpty(strXmlEncoding))
                {
                    strXmlEncoding = "gb2312";
#if DEBUG
                    System.Diagnostics.Debug.WriteLine("CallbackEncoding Empty in Web.Config File!\r\n"
                                                       + "Using \"gb2312\"!");
#endif
                }
                else
                {
                    try
                    {
                        System.Text.Encoding enc = System.Text.Encoding.GetEncoding(strXmlEncoding);
                    }
                    catch
                    {
#if DEBUG
                        System.Diagnostics.Debug.WriteLine("Invalid Encoding in Web.Config File!\r\n"
                                                           + "Using \"gb2312\"!");
#endif
                        strXmlEncoding = "gb2312";
                    }
                }

                Response.Write("<?xml version=\"1.0\" encoding=\"" + strXmlEncoding + "\" standalone=\"yes\" ?>\r\n"
                               + tvBookBook.GetXml());
                Response.Flush();
                Response.End();
            }
        }
예제 #27
0
        private void LoadForTreeView(DataTable dtCommands)
        {
            nodePath = "|";
            TreeViewNode focusNode = tvwCmds.SelectedNode;
            if (focusNode != null)
            {
                while (true)
                {
                    if (focusNode.ParentNode == null) break;
                    else
                    {
                        focusNode = focusNode.ParentNode;
                        nodePath += focusNode.ID + "|";
                    }
                }
            }

            tvwCmds.Nodes.Clear();
            TreeViewNode topRoot = new TreeViewNode();
            topRoot.Text = "Root";
            topRoot.ID = "0";
            tvwCmds.Nodes.Add(topRoot);
            //dtCommands = CommandController.GetCommands();
            DataRow[] drRoots = dtCommands.Select("CommandParentID = 0");
            foreach (DataRow row in drRoots)
            {
                TreeViewNode rootNode = new TreeViewNode();
                rootNode.Text = row["CommandName"].ToString();
                rootNode.Value = row["CommandKey"].ToString();
                rootNode.ID = row["CommandID"].ToString();
                if (nodePath.IndexOf("|" + rootNode.ID + "|") >= 0) rootNode.Expanded = true;
                tvwCmds.Nodes.Add(rootNode);
                LoadForCurCommand(rootNode, dtCommands);
            }
        }
        RecipeNode createRecipeNode(Recipe recipe, float x, float y)
        {
            //if (recipeNodes.ContainsKey(recipe.id))
            //{
            //    MessageBox.Show("createRecipeNode called on a recipe that's already been created.");
            //    throw new Exception();
            //}
            //Dictionary<string, TreeViewItem> tmp = new Dictionary<string, TreeViewItem>();
            List <string> outgoingLinks = new List <string>();
            TreeViewNode  tempTVN       = diagram1.Factory.CreateTreeViewNode(x, y, 150, 150);

            tempTVN.Id              = recipe.id;
            tempTVN.IgnoreLayout    = false;
            tempTVN.ConnectionStyle = TreeViewConnectionStyle.Items;
            if (recipe.label != null)
            {
                tempTVN.Text = recipe.label;
            }
            else
            {
                tempTVN.Text = recipe.id;
            }
            tempTVN.RootItems.Add(new TreeViewItem("Recipe ID: " + recipe.id));
            if (recipe.actionId != null)
            {
                tempTVN.RootItems.Add(new TreeViewItem("Action ID: " + recipe.actionId));
            }
            if (recipe.startdescription != null)
            {
                tempTVN.RootItems.Add(new TreeViewItem("Recipe Start Description: "));
                tempTVN.RootItems.Last().Children.Add(new TreeViewItem(recipe.startdescription));
            }
            if (recipe.description != null)
            {
                tempTVN.RootItems.Add(new TreeViewItem("Recipe Description: "));
                tempTVN.RootItems.Last().Children.Add(new TreeViewItem(recipe.description));
            }
            if (recipe.ending != null)
            {
                tempTVN.RootItems.Add(new TreeViewItem("Action ID: " + recipe.ending));
            }
            if (recipe.burnimage != null)
            {
                tempTVN.RootItems.Add(new TreeViewItem("Burn Image: " + recipe.burnimage));
            }
            if (recipe.extends != null)
            {
                tempTVN.RootItems.Add(new TreeViewItem("Extends: " + recipe.extends));
            }
            if (recipe.craftable.HasValue)
            {
                tempTVN.RootItems.Add(new TreeViewItem("Craftable: " + recipe.craftable.Value.ToString()));
            }
            if (recipe.hintonly.HasValue)
            {
                tempTVN.RootItems.Add(new TreeViewItem("Hint Only: " + recipe.hintonly.Value.ToString()));
            }
            if (recipe.maxexecutions.HasValue)
            {
                tempTVN.RootItems.Add(new TreeViewItem("Max Executions: " + recipe.maxexecutions.Value.ToString()));
            }
            if (recipe.warmup.HasValue)
            {
                tempTVN.RootItems.Add(new TreeViewItem("Warmup: " + recipe.warmup.Value.ToString()));
            }
            if (recipe.internalDeck != null)
            {
                tempTVN.RootItems.Add(new TreeViewItem("Internal Deck: "));
                if (recipe.internalDeck.label != null)
                {
                    tempTVN.RootItems.Last().Children.Add(new TreeViewItem("Label: " + recipe.internalDeck.label));
                }
                if (recipe.internalDeck.description != null)
                {
                    tempTVN.RootItems.Last().Children.Add(new TreeViewItem("Description: "));
                    tempTVN.RootItems.Last().Children.Last().Children.Add(new TreeViewItem(recipe.internalDeck.description));
                }
                if (recipe.internalDeck.draws.HasValue)
                {
                    tempTVN.RootItems.Last().Children.Add(new TreeViewItem("Draws: " + recipe.internalDeck.draws.Value));
                }
                if (recipe.internalDeck.resetonexhaustion.HasValue)
                {
                    tempTVN.RootItems.Last().Children.Add(new TreeViewItem("Reset on Exhaustion: " + recipe.internalDeck.resetonexhaustion.Value));
                }
                if (recipe.internalDeck.defaultcard != null)
                {
                    tempTVN.RootItems.Last().Children.Add(new TreeViewItem("Default Card: " + recipe.internalDeck.defaultcard));
                }
                if (recipe.internalDeck.spec != null)
                {
                    tempTVN.RootItems.Last().Children.Add(new TreeViewItem("Cards: "));
                    foreach (string card in recipe.internalDeck.spec)
                    {
                        tempTVN.RootItems.Last().Children.Last().Children.Add(new TreeViewItem(card));
                    }
                }
            }
            if (recipe.slots != null)
            {
                Slot         slot     = recipe.slots[0];
                TreeViewItem slotItem = new TreeViewItem("Recipe Slot");
                tempTVN.RootItems.Add(slotItem);
                // string id
                if (slot.id != null)
                {
                    slotItem.Children.Add(new TreeViewItem("ID: " + slot.id));
                }
                // string label
                if (slot.label != null)
                {
                    slotItem.Children.Add(new TreeViewItem("Label: " + slot.label));
                }
                // string description
                if (slot.description != null)
                {
                    slotItem.Children.Add(new TreeViewItem("Description: " + slot.id));
                    slotItem.Children.Last().Children.Add(new TreeViewItem(slot.description));
                }
                // string actionId
                if (slot.actionId != null)
                {
                    slotItem.Children.Add(new TreeViewItem("Action ID: " + slot.actionId));
                }
                // Dictionary<string, int> required
                if (slot.required != null)
                {
                    slotItem.Children.Add(new TreeViewItem("Required: "));
                    foreach (KeyValuePair <string, int> required in slot.required)
                    {
                        slotItem.Children.Last().Children.Add(new TreeViewItem(required.Key + ": " + required.Value));
                    }
                }
                // Dictionary<string, int> forbidden
                if (slot.forbidden != null)
                {
                    slotItem.Children.Add(new TreeViewItem("Forbidden: "));
                    foreach (KeyValuePair <string, int> forbidden in slot.forbidden)
                    {
                        slotItem.Children.Last().Children.Add(new TreeViewItem(forbidden.Key + ": " + forbidden.Value));
                    }
                }
                // bool? greedy
                if (slot.greedy.HasValue)
                {
                    slotItem.Children.Add(new TreeViewItem("Greedy: " + slot.greedy.Value.ToString()));
                }
                // bool? consumes
                if (slot.consumes.HasValue)
                {
                    slotItem.Children.Add(new TreeViewItem("Consumes: " + slot.consumes.Value.ToString()));
                }
            }
            if (recipe.requirements != null)
            {
                TreeViewItem requirements = new TreeViewItem("Requirements:");
                tempTVN.RootItems.Add(requirements);
                foreach (KeyValuePair <string, string> kvp in recipe.requirements)
                {
                    requirements.Children.Add(new TreeViewItem(kvp.Key + ": " + kvp.Value));
                }
            }
            if (recipe.tablereqs != null)
            {
                TreeViewItem tablereqs = new TreeViewItem("Table Requirements:");
                tempTVN.RootItems.Add(tablereqs);
                foreach (KeyValuePair <string, string> kvp in recipe.tablereqs)
                {
                    tablereqs.Children.Add(new TreeViewItem(kvp.Key + ": " + kvp.Value));
                }
            }
            if (recipe.extantreqs != null)
            {
                TreeViewItem extantreqs = new TreeViewItem("ExtantRequirements:");
                tempTVN.RootItems.Add(extantreqs);
                foreach (KeyValuePair <string, string> kvp in recipe.extantreqs)
                {
                    extantreqs.Children.Add(new TreeViewItem(kvp.Key + ": " + kvp.Value));
                }
            }
            if (recipe.effects != null)
            {
                TreeViewItem effects = new TreeViewItem("Card Effects:");
                tempTVN.RootItems.Add(effects);
                foreach (KeyValuePair <string, string> kvp in recipe.effects)
                {
                    effects.Children.Add(new TreeViewItem(kvp.Key + ": " + kvp.Value));
                }
            }
            if (recipe.aspects != null)
            {
                TreeViewItem aspects = new TreeViewItem("Aspect Effects:");
                tempTVN.RootItems.Add(aspects);
                foreach (KeyValuePair <string, int> kvp in recipe.aspects)
                {
                    aspects.Children.Add(new TreeViewItem(kvp.Key + ": " + kvp.Value.ToString()));
                }
            }
            if (recipe.deckeffect != null)
            {
                TreeViewItem deckeffect = new TreeViewItem("Deck Effects:");
                tempTVN.RootItems.Add(deckeffect);
                foreach (KeyValuePair <string, int> kvp in recipe.deckeffect)
                {
                    deckeffect.Children.Add(new TreeViewItem(kvp.Key + ": " + kvp.Value.ToString()));
                }
            }
            if (recipe.linked != null)
            {
                TreeViewItem linked = new TreeViewItem("Linked Recipes:");
                tempTVN.RootItems.Add(linked);
                foreach (RecipeLink link in recipe.linked)
                {
                    TreeViewItem recipeTree = new TreeViewItem("Linked Recipe:");
                    linked.Children.Add(recipeTree);
                    //linkedNodes.Add(link.id, tempTVN);
                    outgoingLinks.Add(link.id);
                    if (link.id != null)
                    {
                        recipeTree.Children.Add(new TreeViewItem("Recipe ID: " + link.id));
                    }
                    if (link.chance.HasValue)
                    {
                        recipeTree.Children.Add(new TreeViewItem("Chance: " + link.chance.Value.ToString()));
                    }
                    if (link.additional.HasValue)
                    {
                        recipeTree.Children.Add(new TreeViewItem("Additional: " + link.additional.Value.ToString()));
                    }
                    if (link.expulsion != null)
                    {
                        TreeViewItem expulsion = new TreeViewItem("Expulsions: ");
                        recipeTree.Children.Add(expulsion);
                        expulsion.Children.Add(new TreeViewItem("Limit: " + link.expulsion.limit.ToString()));
                        foreach (KeyValuePair <string, int> kvp in link.expulsion.filter)
                        {
                            expulsion.Children.Add(new TreeViewItem(kvp.Key + ": " + kvp.Value));
                        }
                    }
                    if (link.challenges != null)
                    {
                        TreeViewItem challenges = new TreeViewItem("Challenges: ");
                        recipeTree.Children.Add(challenges);
                        foreach (KeyValuePair <string, string> kvp in link.challenges)
                        {
                            challenges.Children.Add(new TreeViewItem(kvp.Key + ": " + kvp.Value));
                        }
                    }
                }
            }
            if (recipe.alternativerecipes != null)
            {
                TreeViewItem linked = new TreeViewItem("Alternative Recipes:");
                tempTVN.RootItems.Add(linked);
                foreach (RecipeLink link in recipe.alternativerecipes)
                {
                    TreeViewItem recipeTree = new TreeViewItem("Linked Recipe:");
                    linked.Children.Add(recipeTree);
                    //linkedNodes.Add(link.id, tempTVN);
                    outgoingLinks.Add(link.id);
                    if (link.id != null)
                    {
                        recipeTree.Children.Add(new TreeViewItem("Recipe ID: " + link.id));
                    }
                    if (link.chance.HasValue)
                    {
                        recipeTree.Children.Add(new TreeViewItem("Chance: " + link.chance.Value.ToString()));
                    }
                    if (link.additional.HasValue)
                    {
                        recipeTree.Children.Add(new TreeViewItem("Additional: " + link.additional.Value.ToString()));
                    }
                    if (link.expulsion != null)
                    {
                        TreeViewItem expulsion = new TreeViewItem("Expulsions: ");
                        recipeTree.Children.Add(expulsion);
                        expulsion.Children.Add(new TreeViewItem("Limit: " + link.expulsion.limit.ToString()));
                        foreach (KeyValuePair <string, int> kvp in link.expulsion.filter)
                        {
                            expulsion.Children.Add(new TreeViewItem(kvp.Key + ": " + kvp.Value));
                        }
                    }
                    if (link.challenges != null)
                    {
                        TreeViewItem challenges = new TreeViewItem("Challenges: ");
                        recipeTree.Children.Add(challenges);
                        foreach (KeyValuePair <string, string> kvp in link.challenges)
                        {
                            challenges.Children.Add(new TreeViewItem(kvp.Key + ": " + kvp.Value));
                        }
                    }
                }
            }
            if (recipe.mutations != null)
            {
                TreeViewItem mutations = new TreeViewItem("Mutations: ");
                tempTVN.RootItems.Add(mutations);
                foreach (Mutation mutation in recipe.mutations)
                {
                    TreeViewItem mutationItem = new TreeViewItem("Mutation: ");
                    mutationItem.Children.Add(mutations);
                    mutationItem.Children.Add(new TreeViewItem("Aspect Filter: " + mutation.filterOnAspectId));
                    mutationItem.Children.Add(new TreeViewItem("Aspect Affected: " + mutation.mutateAspectId));
                    mutationItem.Children.Add(new TreeViewItem("Mutation Level: " + mutation.mutationLevel.ToString()));
                    mutationItem.Children.Add(new TreeViewItem("Additive Mutation: " + mutation.additive.ToString()));
                }
            }
            tempTVN.ResizeToFitText();
            return(new RecipeNode(tempTVN, outgoingLinks));
        }
예제 #29
0
 internal TreeViewCollapsedEventArgs(TreeViewNode node)
 {
     Node = node;
 }
 public RecipeNode(TreeViewNode Node, List <string> linkedRecipes)
 {
     this.Node          = Node;
     this.linkedRecipes = linkedRecipes;
 }
예제 #31
0
 /// <summary>
 /// Move a node to a new parent node.
 /// </summary>
 public void Move(string originalPath, IModel toParent, TreeViewNode nodeDescription)
 {
     view.Tree.Delete(originalPath);
     view.Tree.AddChild(Apsim.FullPath(toParent), nodeDescription);
 }
예제 #32
0
        private static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);



            var bestellungNode          = new TreeViewNode("Bestellung", 8, 9);
            var bestellungenHistoryNode = new TreeViewNode("Bestellungen History", 4, 5);

            var festmanagerNode = new TreeViewNode("Festmanager", 12, 13);

            festmanagerNode.Children.Add(bestellungNode);
            festmanagerNode.Children.Add(bestellungenHistoryNode);

            var personalNode       = new TreeViewNode("Personal", 2, 3);
            var artikelNode        = new TreeViewNode("Artikel", 4, 5);
            var ausgabestellenNode = new TreeViewNode("Ausgabestellen", 14, 15);

            var einstellungeNode = new TreeViewNode("Einstellungen", 6, 7);

            einstellungeNode.Children.Add(personalNode);
            einstellungeNode.Children.Add(artikelNode);
            einstellungeNode.Children.Add(ausgabestellenNode);

            var infoNode = new TreeViewNode("Info", 0, 1);

            var nodes = new Collection <TreeViewNode>
            {
                festmanagerNode,
                einstellungeNode,
                infoNode
            };

            var settingsPath = FormMain.DefaultSettingsPath;

            if (args.Length > 0)
            {
                settingsPath = args[0];
            }

            FestManagerSettings settings = null;

            try
            {
                settings = FestManagerSettings.Load(settingsPath);
            }
            catch (FileNotFoundException)
            {
                MessageBox.Show(Resources.Fatal_Settings_not_found + settingsPath,
                                Resources.Fatal_Settings_not_found_Title, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            catch (System.InvalidOperationException)
            {
                MessageBox.Show(Resources.Fatal_Invalid_settings + settingsPath,
                                Resources.Fatal_Invalid_settings_Title, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            try
            {
                Application.Run(new FormMain("Bestellung", nodes, settings));
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                MessageBox.Show("Fehler in der Anwendung aufgetreten: " + ex.Message, "Kritischer Fehler!", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
예제 #33
0
 /// <summary>Populate the treeview.</summary>
 /// <param name="rootNode">A description of the top level root node</param>
 public void Populate(TreeViewNode topLevelNode)
 {
     rootNode = topLevelNode;
     Refresh(rootNode);
 }
        private void RefreshData()
        {
            if (Case == null || Case.CurrentCase == null)
            {
                return;
            }

            caseContent.RootNodes.Clear();

            foreach (CaseManager.CaseData.CSIData data in Case.CurrentCase.CSIData.Values)
            {
                TreeViewNode main = new TreeViewNode()
                {
                    Content = $"CSIData \t| {data.ID}"
                };
                caseContent.RootNodes.Add(main);
            }
            foreach (CaseManager.CaseData.EntityData data in Case.CurrentCase.EntityData.Values)
            {
                TreeViewNode main = new TreeViewNode()
                {
                    Content = $"EntityData \t| {data.ID}"
                };
                caseContent.RootNodes.Add(main);
                foreach (var item in data.Dialogue)
                {
                    TreeViewNode children = new TreeViewNode()
                    {
                        Content = $"EntityData \t| {item.Text}"
                    };
                    main.Children.Add(children);
                }
            }
            foreach (CaseManager.CaseData.InterrogationData data in Case.CurrentCase.InterrogationData.Values)
            {
                TreeViewNode main = new TreeViewNode()
                {
                    Content = $"IntData \t| {data.ID}"
                };
                caseContent.RootNodes.Add(main);
                foreach (var item in data.InterrogationLines)
                {
                    TreeViewNode children = new TreeViewNode()
                    {
                        Content = item.Question
                    };
                    main.Children.Add(children);
                }
            }
            foreach (CaseManager.CaseData.SceneData data in Case.CurrentCase.SceneData.Values)
            {
                TreeViewNode main = new TreeViewNode()
                {
                    Content = $"SceneData \t| {data.ID}"
                };
                caseContent.RootNodes.Add(main);
                foreach (var item in data.Items)
                {
                    TreeViewNode children = new TreeViewNode()
                    {
                        Content = $"{item.ItemType} \t| {item.Model}"
                    };
                    main.Children.Add(children);
                }
            }
            foreach (CaseManager.CaseData.StageData data in Case.CurrentCase.StageData.Values)
            {
                TreeViewNode main = new TreeViewNode()
                {
                    Content = $"StageData \t| {data.ID}"
                };
                caseContent.RootNodes.Add(main);
                foreach (var item in data.ID_CSIData)
                {
                    TreeViewNode children = new TreeViewNode()
                    {
                        Content = $"ID_CSIData \t| {item}"
                    };
                    main.Children.Add(children);
                }
                foreach (var item in data.ID_EntityData)
                {
                    TreeViewNode children = new TreeViewNode()
                    {
                        Content = $"ID_EntityData \t| {item}"
                    };
                    main.Children.Add(children);
                }
                foreach (var item in data.ID_InterrogationData)
                {
                    TreeViewNode children = new TreeViewNode()
                    {
                        Content = $"ID_IntData \t| {item}"
                    };
                    main.Children.Add(children);
                }
                foreach (var item in data.ID_SceneData)
                {
                    TreeViewNode children = new TreeViewNode()
                    {
                        Content = $"ID_SceneData \t| {item}"
                    };
                    main.Children.Add(children);
                }
                foreach (var item in data.ID_WrittenData)
                {
                    TreeViewNode children = new TreeViewNode()
                    {
                        Content = $"ID_WrittenData \t| {item}"
                    };
                    main.Children.Add(children);
                }
            }
        }
예제 #35
0
        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))
            {
                organizationList = organizationBLL.GetOrganizations();

                string strOwnIDs = string.Empty;
                if (railSystemID != 0)
                {
                    IList <RailExam.Model.Organization> organizationList1 = organizationBLL.GetOrganizations(PrjPub.CurrentLoginUser.StationOrgID);
                    foreach (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();
                    //tvView.Nodes.Add(tvn);

                    foreach (RailExam.Model.Organization organization in organizationList)
                    {
                        if (!organization.IsEffect)
                        {
                            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;
                        }

                        tvn         = new TreeViewNode();
                        tvn.ID      = organization.OrganizationId.ToString();
                        tvn.Value   = organization.IdPath;
                        tvn.Text    = organization.ShortName;
                        tvn.ToolTip = organization.FullName;
                        try
                        {
                            if (organization.ParentId == 0)
                            {
                                tvn.Expanded = true;
                                tvView.Nodes.Add(tvn);
                            }
                            else
                            {
                                tvView.FindNodeById(organization.ParentId.ToString()).Nodes.Add(tvn);
                            }
                        }
                        catch
                        {
                            tvView.Nodes.Clear();
                            SessionSet.PageMessage = "数据错误!";
                            return;
                        }
                    }
                }
            }
            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();
                    tvView.Nodes.Add(tvn);

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

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

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

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

            if (tvView.Nodes.Count > 0)
            {
                tvView.Nodes[0].Expanded = true;
            }
        }
예제 #36
0
    private void Fill_trvUnderManagementPersonnel_SubstituteSettings(decimal flowID)
    {
        string imageUrl  = "Images\\TreeView\\folder.gif";
        string imagePath = "Images/TreeView/folder.gif";

        string[] retMessage = new string[4];
        this.InitializeCulture();
        try
        {
            Department   rootDepartment     = this.SubstituteBusiness.GetDepartmentRoot();
            TreeViewNode rootDepartmentNode = new TreeViewNode();
            rootDepartmentNode.ID = rootDepartment.ID.ToString();
            string rootOrgPostNodeText = string.Empty;
            if (GetLocalResourceObject("OrgNode_trvUnderManagementPersonnel_SubstituteSettings") != null)
            {
                rootOrgPostNodeText = GetLocalResourceObject("OrgNode_trvUnderManagementPersonnel_SubstituteSettings").ToString();
            }
            else
            {
                rootOrgPostNodeText = rootDepartment.Name;
            }
            rootDepartmentNode.Text  = rootOrgPostNodeText;
            rootDepartmentNode.Value = rootDepartment.CustomCode;
            if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + imageUrl))
            {
                rootDepartmentNode.ImageUrl = imagePath;
            }
            this.trvUnderManagementPersonnel_SubstituteSettings.Nodes.Add(rootDepartmentNode);
            IList <Department> DepartmentChildList = this.SubstituteBusiness.GetDepartmentChilds(rootDepartment.ID, flowID);
            foreach (Department childDepartment in DepartmentChildList)
            {
                TreeViewNode childOrgPostNode = new TreeViewNode();
                childOrgPostNode.ID    = childDepartment.ID.ToString();
                childOrgPostNode.Text  = childDepartment.Name;
                childOrgPostNode.Value = ((int)UnderManagmentTypes.Department).ToString();
                if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + imageUrl))
                {
                    childOrgPostNode.ImageUrl = imagePath;
                }
                childOrgPostNode.ContentCallbackUrl = "XmlUnderManagementPersonnelLoadonDemand.aspx?FlowID=" + flowID + "&ParentDepartmentID=" + childDepartment.ID + "&LangID=" + this.LangProv.GetCurrentLanguage();
                if (this.SubstituteBusiness.GetDepartmentChilds(childDepartment.ID, flowID).Count > 0 || this.SubstituteBusiness.GetDepartmentPerson(childDepartment.ID, flowID).Count > 0)
                {
                    childOrgPostNode.Nodes.Add(new TreeViewNode());
                }
                rootDepartmentNode.Nodes.Add(childOrgPostNode);
            }
            if (DepartmentChildList.Count > 0 || this.SubstituteBusiness.GetDepartmentPerson(rootDepartment.ID, flowID).Count > 0)
            {
                rootDepartmentNode.Expanded = true;
            }
        }
        catch (UIValidationExceptions ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
            this.ErrorHiddenField_UnderManagementPersonnel.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            this.ErrorHiddenField_UnderManagementPersonnel.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (Exception ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
            this.ErrorHiddenField_UnderManagementPersonnel.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
    }
예제 #37
0
 public void AddChild (TreeViewNode c)
 {
     children.Add(c);
 }
예제 #38
0
        private void BindOrganizationTree()
        {
            OrganizationBLL organizationBLL = new OrganizationBLL();

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

                Pub.BuildComponentArtTreeView(tvView, (IList)organizationList, "OrganizationId",
                                              "ParentId", "ShortName", "FullName", "IdPath", 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));
                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)
                        {
                            tvView.Nodes.Add(tvn);
                        }
                        else
                        {
                            try
                            {
                                tvView.FindNodeById(organization.ParentId.ToString()).Nodes.Add(tvn);
                            }
                            catch
                            {
                                tvView.Nodes.Clear();
                                SessionSet.PageMessage = "数据错误!";
                                return;
                            }
                        }
                    }
                }

                tvView.DataBind();
            }

            if (tvView.Nodes.Count > 0)
            {
                tvView.Nodes[0].Expanded = true;
            }
        }
예제 #39
0
 private void buildTree (TreeViewNode node0, ITreeNodeObject g)
 {
     foreach (ITreeNodeObject cg in g.ChildObjects)
     {
         TreeViewNode node = new TreeViewNode(cg.Name, "" + cg.Identity);
         node0.AddChild(node);
         buildTree(node, cg);
     }
 }
        public TreeViewPage()
        {
            this.InitializeComponent();

            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 6))
            {
                TreeViewNode workFolder = new TreeViewNode()
                {
                    Content = "Work Documents"
                };
                workFolder.IsExpanded = true;

                workFolder.Children.Add(new TreeViewNode()
                {
                    Content = "XYZ Functional Spec"
                });
                workFolder.Children.Add(new TreeViewNode()
                {
                    Content = "Feature Schedule"
                });
                workFolder.Children.Add(new TreeViewNode()
                {
                    Content = "Overall Project Plan"
                });
                workFolder.Children.Add(new TreeViewNode()
                {
                    Content = "Feature Rsource Allocation"
                });

                TreeViewNode remodelFolder = new TreeViewNode()
                {
                    Content = "Home Remodel"
                };
                remodelFolder.IsExpanded = true;

                remodelFolder.Children.Add(new TreeViewNode()
                {
                    Content = "Contractor Contact Info"
                });
                remodelFolder.Children.Add(new TreeViewNode()
                {
                    Content = "Paint Color Scheme"
                });
                remodelFolder.Children.Add(new TreeViewNode()
                {
                    Content = "Flooring woodgrain type"
                });
                remodelFolder.Children.Add(new TreeViewNode()
                {
                    Content = "Kitchen cabinet style"
                });

                personalFolder = new TreeViewNode()
                {
                    Content = "Personal Documents"
                };
                personalFolder.IsExpanded = true;
                personalFolder.Children.Add(remodelFolder);

                personalFolder2 = new TreeViewNode()
                {
                    Content = "Personal Documents"
                };
                personalFolder2.IsExpanded = true;
                personalFolder2.Children.Add(remodelFolder);

                sampleTreeView.RootNodes.Add(workFolder);
                sampleTreeView.RootNodes.Add(personalFolder);

                sampleTreeView2.RootNodes.Add(workFolder);
                sampleTreeView2.RootNodes.Add(personalFolder2);
            }
        }
예제 #41
0
 public void SetContent (TreeViewNode pContent)
 {
     Content = pContent;
 }
예제 #42
0
 protected override void FillTreeViewNode()
 {
     base.FillTreeViewNode();
     TreeViewNode.Expand();
 }
예제 #43
0
    private string RenderContent (List<TreeViewNode> content, TreeViewNode parentNode)
    {
        StringBuilder sb = new StringBuilder();
        sb.Append("<ul");
        if (this.Content == content[0])
            sb.Append(" id='" + this.ClientID + "_tree'");
        else
        {
            if (!parentNode.expanded)
            {
                sb.Append(" style='display: none;'");
            }
        }
        sb.AppendLine(">");

        List<TreeViewNode>.Enumerator enumer = content.GetEnumerator();
        TreeViewNode node = null;
        if (enumer.MoveNext())
            node = enumer.Current;
        while (node != null)
        {
            TreeViewNode nextNode = null;
            if (enumer.MoveNext())
                nextNode = enumer.Current;


            string elemClass = "";

            elemClass += " lb";

            if (node.isleaf)
                elemClass += " leaf";

            if (node.clickable == false)
                elemClass = " " + TreeViewNode.disabledClass;

            if (node.selected)
                elemClass += " " + TreeViewNode.selectedClass;

            if (node.hasSelectedChild)
                elemClass += " " + TreeViewNode.partSelectedClass;

            elemClass = elemClass.Trim();

            string hitarea = "";

            if (node.isleaf)
            {
                if (nextNode == null)
                    node.className += " last";
            }
            else
            {
                if (node.expanded)
                {
                    node.className += " collapsable";
                    if (nextNode == null)
                    {
                        node.className += " lastCollapsable";
                        hitarea = "<div class='hitarea collapsable-hitarea lastCollapsable-hitarea'></div>";
                    }
                    else
                        hitarea = "<div class='hitarea collapsable-hitarea'></div>";
                }
                else
                {
                    node.className += " expandable";
                    if (nextNode == null)
                    {
                        node.className += " lastExpandable";
                        hitarea = "<div class='hitarea expandable-hitarea lastExpandable-hitarea'></div>";
                    }
                    else
                        hitarea = "<div class='hitarea expandable-hitarea'></div>";
                }
            }


            string checkbox = "";
            if (MultiSelect)
                checkbox = "<input type='checkbox' class='cb' name='cb" + this.ClientID + "'" + (node.selected ? " checked=checked" : "") + (node.clickable ? "" : " disabled=disabled") + " value='{value}' />";
            string className = (node.className != "" ? " class='" + node.className.Trim() + "'" : "");
            string valueProp = (node.clickable ? " val='{value}'" : "");
            string selected = (elemClass != "" ? " class='" + elemClass + "'" : "");
            selected += (node.title != "" ? " title='" + node.title + "'" : "");
            string nodeTag = "<li{className}>" + hitarea + NodeTemplate;
            nodeTag = nodeTag
                .Replace("{checkbox}", checkbox)
                .Replace("{className}", className)
                .Replace("{valueProp}", valueProp)
                .Replace("{selected}", selected)
                .Replace("{value}", node.value)
                .Replace("{text}", node.text);

            sb.Append(nodeTag);

            if (node.children.Count > 0)
                sb.Append(RenderContent(node.children, node));
            sb.AppendLine("</li>");

            node = nextNode;
        }
        sb.AppendLine("</ul>");
        return sb.ToString();
    }
예제 #44
0
    static void AddAssetToResourceTreeView(string path)
    {
        TreeViewCtrl treeView = s_root.FindControl("_MainTreeView") as TreeViewCtrl;

        if (treeView == null)
        {
            return;
        }

        string totalPath = path;
        string currPath  = path;
        List <TreeViewNode> currLevelNodeList = treeView.Roots;
        TreeViewNode        parentNode        = null;
        int len = 0;

        while (currPath != "")
        {
            int i = currPath.IndexOf('/');
            if (i < 0)
            {
                i = currPath.Length;
            }
            len += i + 1;
            string pathNodeName     = currPath.Substring(0, i);
            string currNodeFullPath = totalPath.Substring(0, len - 1);
            if (i + 1 < currPath.Length)
            {
                currPath = currPath.Substring(i + 1);
            }
            else
            {
                currPath = "";
            }


            bool findNode = false;
            foreach (var treeNode in currLevelNodeList)
            {
                if (treeNode.name == pathNodeName)
                {
                    findNode          = true;
                    parentNode        = treeNode;
                    currLevelNodeList = treeNode.children;
                    break;
                }
            }

            if (!findNode)
            {
                TreeViewNode newNode = new TreeViewNode();
                newNode.name           = pathNodeName;
                newNode.image          = ResourceManageToolUtility.GetCachedIcon(path);
                newNode.state.IsExpand = true;
                TreeViewNodeUserParam userParam = new TreeViewNodeUserParam();

                bool toggleState = false;
                foreach (var p in ResourceManageConfig.GetInstance().Paths)
                {
                    if (p.Equals(currNodeFullPath))
                    {
                        toggleState = true;
                    }
                }
                userParam.param = toggleState;
                newNode.state.userParams.Add(userParam);

                if (parentNode == null)
                {//说明需要作为根节点插入树视图中
                    currLevelNodeList.Add(newNode);
                }
                else
                {
                    parentNode.Add(newNode);
                }
                parentNode        = newNode;
                currLevelNodeList = newNode.children;
            }
        }
    }
예제 #45
0
        private void BindSubNodes(TreeViewNode parentNode, ListFolder parent, int selectedId)
        {
            Mediachase.Ibn.Data.Services.TreeService ts = parent.GetService<Mediachase.Ibn.Data.Services.TreeService>();
            foreach (Mediachase.Ibn.Data.Services.TreeNode tN in ts.GetChildNodes())
            {
                MetaObject moFolder = tN.InnerObject;
                ListFolder folder = new ListFolder(moFolder.PrimaryKeyId.Value);
                int iFolderId = folder.PrimaryKeyId.Value;
                TreeViewNode node = new TreeViewNode();
                node.Text = folder.Title;

                bool IsPrivate = (folder.FolderType == ListFolderType.Private);
                if (folder.HasChildren)
                {
                    BindSubNodes(node, folder, selectedId);
                }
                node.ID = "listfolder" + iFolderId.ToString();
                if (IsPrivate)
                    node.ID += "private";
                node.Value = iFolderId.ToString();
                if (iFolderId == selectedId)
                    MoveTree.SelectedNode = node;
                parentNode.Nodes.Add(node);
            }
        }
예제 #46
0
 private void GetChildMissionLocation_trvMissionLocationsIntroduction_MissionLocationIntroduction(TreeViewNode parentMissionLocationNode, DutyPlace parentMissionLocation)
 {
     foreach (DutyPlace childMissionLocation in this.MissionLocationBusiness.GetDutyPlaceChilds(parentMissionLocation.ID))
     {
         TreeViewNode childMissionLocationNode = new TreeViewNode();
         childMissionLocationNode.ID    = childMissionLocation.ID.ToString();
         childMissionLocationNode.Text  = childMissionLocation.Name;
         childMissionLocationNode.Value = childMissionLocation.CustomCode;
         if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\Images\\TreeView\\folder.gif"))
         {
             childMissionLocationNode.ImageUrl = "Images/TreeView/folder.gif";
         }
         parentMissionLocationNode.Nodes.Add(childMissionLocationNode);
         try
         {
             if (parentMissionLocationNode.Parent.Parent == null)
             {
                 parentMissionLocationNode.Expanded = true;
             }
         }
         catch
         { }
         if (this.MissionLocationBusiness.GetDutyPlaceChilds(childMissionLocation.ID).Count > 0)
         {
             this.GetChildMissionLocation_trvMissionLocationsIntroduction_MissionLocationIntroduction(childMissionLocationNode, childMissionLocation);
         }
     }
 }
        /// <summary>
        /// Add the collection of albums to the specified treeview node.
        /// </summary>
        /// <param name="albums">The collection of albums to add the the treeview node.</param>
        /// <param name="parentNode">The treeview node that will receive child nodes representing the specified albums.</param>
        /// <param name="expandNode">Specifies whether the nodes should be expanded.</param>
        private void BindAlbumToTreeview(IGalleryObjectCollection albums, TreeViewNode parentNode, bool expandNode)
        {
            string handlerPath = String.Concat(Utils.GalleryRoot, "/handler/gettreeviewxml.ashx");

            foreach (IAlbum album in albums)
            {
                TreeViewNode node = new TreeViewNode();
                string albumTitle = Utils.RemoveHtmlTags(album.Title);
                node.Text = albumTitle;
                node.ToolTip = albumTitle;
                node.Value = album.Id.ToString(CultureInfo.InvariantCulture);
                node.ID = album.Id.ToString(CultureInfo.InvariantCulture);
                node.Expanded = expandNode;

                if (!String.IsNullOrEmpty(NavigateUrl))
                {
                    node.NavigateUrl = Utils.AddQueryStringParameter(NavigateUrl, String.Concat("aid=", album.Id.ToString(CultureInfo.InvariantCulture)));
                    node.HoverCssClass = "tv0HoverTreeNodeLink";
                }

                node.ShowCheckBox = parentNode.ShowCheckBox;
                node.Selectable = true;

                if (album.GetChildGalleryObjects(GalleryObjectType.Album, false, this.GalleryPage.IsAnonymousUser).Count > 0)
                {
                    string handlerPathWithAlbumId = Utils.AddQueryStringParameter(handlerPath, String.Concat("aid=", album.Id.ToString(CultureInfo.InvariantCulture)));
                    node.ContentCallbackUrl = String.Format(CultureInfo.CurrentCulture, "{0}{1}&sc={2}&nurl={3}", handlerPathWithAlbumId, this.SecurityPermissionQueryStringParm, node.ShowCheckBox, Utils.UrlEncode(NavigateUrl));
                }

                // Select and check this node if needed.
                if ((this._albumToSelect != null) && (album.Id == this._albumToSelect.Id))
                {
                    tv.SelectedNode = node;
                    node.Checked = true;
                    node.Expanded = true;
                    // Expand the child of the selected album.
                    BindAlbumToTreeview(album.GetChildGalleryObjects(GalleryObjectType.Album, true, this.GalleryPage.IsAnonymousUser), node, false);
                }

                // Check this node if needed.
                if (this._albumIdsToCheck.Contains(album.Id))
                {
                    node.Checked = true;
                }

                parentNode.Nodes.Add(node);
            }
        }
예제 #48
0
		/// <summary>
		/// Render the treeview with the first two levels of albums that are viewable to the logged on user.
		/// </summary>
		private void DataBindTreeView()
		{
			#region Validation

			//if (!this.AllowMultiSelect && this.AlbumIdsToCheck.Count > 1)
			//{
			//  throw new InvalidOperationException("The property AllowMultiSelect must be false when multiple album IDs have been assigned to the property AlbumIdsToCheck.");
			//}

			if (!this.AllowMultiSelect && this.AlbumIdsToSelect.Count > 1)
			{
				throw new InvalidOperationException("The property AllowMultiSelect must be false when multiple album IDs have been assigned to the property TopLevelAlbumIdsToCheck.");
			}

			if (!SecurityActionEnumHelper.IsValidSecurityAction(this.RequiredSecurityPermissions))
			{
				throw new InvalidOperationException("The property GalleryServerPro.Web.Controls.albumtreeview.RequiredSecurityPermissions must be assigned before the TreeView can be rendered.");
			}
			
			#endregion

			// Add root node.
			IAlbum rootAlbum = Factory.LoadRootAlbum(this.RequiredSecurityPermissions, this.GalleryPage.GetGalleryServerRolesForUser());

			TreeViewNode rootNode = new TreeViewNode();
			rootNode.Text = Util.RemoveHtmlTags(rootAlbum.Title);
			rootNode.Value = rootAlbum.Id.ToString(CultureInfo.InvariantCulture);
			rootNode.ID = rootAlbum.Id.ToString(CultureInfo.InvariantCulture);
			rootNode.Expanded = true;

			bool isAlbumSelectable = !rootAlbum.IsVirtualAlbum;
			rootNode.ShowCheckBox = isAlbumSelectable;
			rootNode.Selectable = isAlbumSelectable;
			if (!isAlbumSelectable) rootNode.HoverCssClass = String.Empty;

			// Select and check this node if needed.
			if (isAlbumSelectable && (this._albumToSelect != null) && (rootAlbum.Id == _albumToSelect.Id))
			{
				tv.SelectedNode = rootNode;
				rootNode.Checked = true;
			}

			// Check this node if needed.
			if (this._albumIdsToSelect.Contains(rootAlbum.Id))
			{
				rootNode.Checked = true;
			}

			tv.Nodes.Clear();
			tv.Nodes.Add(rootNode);

			// Add the first level of albums below the root album.
			BindAlbumToTreeview(rootAlbum.GetChildGalleryObjects(GalleryObjectType.Album), rootNode, false);

			if ((this._albumToSelect != null) && (tv.SelectedNode == null))
			{
				// We have an album we are supposed to select, but we haven't encountered it in the first two levels,
				// so expand the treeview as needed to include this album.
					BindSpecificAlbumToTreeview(this._albumToSelect);
			}

			// Make sure all specified albums are visible and checked.
			foreach (int albumId in this._albumIdsToSelect)
			{
				BindSpecificAlbumToTreeview(Factory.LoadAlbumInstance(albumId, false));
			}
		}
예제 #49
0
        private void LoadForCurCommand(TreeViewNode curNode, DataTable source)
        {
            int curCommandId = ConvertUtility.ToInt32(curNode.ID);
            DataRow[] drChildCommands = source.Select("CommandParentID = " + curCommandId);

            foreach (DataRow row in drChildCommands)
            {
                TreeViewNode childNode = new TreeViewNode();
                childNode.Text = row["CommandName"].ToString();
                childNode.Value = row["CommandKey"].ToString();
                childNode.ID = row["CommandID"].ToString();
                if (nodePath.IndexOf("|" + childNode.ID + "|") >= 0) childNode.Expanded = true;
                curNode.Nodes.Add(childNode);
                LoadForCurCommand(childNode, source);
            }
        }
예제 #50
0
		/// <summary>
		/// Bind the heirarchical list of albums to the specified treeview node.
		/// </summary>
		/// <param name="existingParentNode">The treeview node to add the first album in the stack to.</param>
		/// <param name="albumParents">A list of albums where the first album should be a child of the specified treeview
		/// node, and each subsequent album is a child of the previous album.</param>
		private void BindSpecificAlbumToTreeview(TreeViewNode existingParentNode, Stack<IAlbum> albumParents)
		{
			// Assumption: The first album in the stack is a child of the existingParentNode node.
			existingParentNode.Expanded = true;

			// For each album in the heirarchy of albums to the current album, add the album and all its siblings to the 
			// treeview.
			foreach (IAlbum album in albumParents)
			{
				if (existingParentNode.Nodes.Count == 0)
				{
					// Add all the album's siblings to the treeview.
					IGalleryObjectCollection childAlbums = Factory.LoadAlbumInstance(Convert.ToInt32(existingParentNode.ID, CultureInfo.InvariantCulture), true).GetChildGalleryObjects(GalleryObjectType.Album, true);
					BindAlbumToTreeview(childAlbums, existingParentNode, false);
				}

				// Now find the album in the siblings we just added that matches the current album in the stack.
				// Set that album as the new parent and expand it.
				TreeViewNode nodeInAlbumHeirarchy = null;
				foreach (TreeViewNode node in existingParentNode.Nodes)
				{
					if (node.ID == album.Id.ToString(CultureInfo.InvariantCulture))
					{
						nodeInAlbumHeirarchy = node;
						nodeInAlbumHeirarchy.Expanded = true;
						break;
					}
				}

				if (nodeInAlbumHeirarchy == null)
					throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, "Album ID {0} is not a child of the treeview node representing album ID {1}.", album.Id, Convert.ToInt32(existingParentNode.Value, CultureInfo.InvariantCulture)));

				existingParentNode = nodeInAlbumHeirarchy;
			}
			existingParentNode.Expanded = false;
		}
        public void SetupTreeView()
        {
            LeftNavigationTreeView.Nodes.RemoveAll(x => true);

            if (CustomerUtilities.IsLoggedIn() == true)
            {
                Customer customer = CustomerUtilities.CurrentCustomerFromSession(XpoHelper.GetNewSession());
                customer.Phonebooks.Reload();
                customer.ImportTaskConfigurations.Reload();

                // Phonebooks

                TreeViewNode phonebooksNode = new TreeViewNode
                {
                    Text = String.Format("Phonebooks ({0})", customer.Phonebooks.Count)
                };

                phonebooksNode.Nodes.Add(new TreeViewNode
                {
                    Text = "Manage",
                    NavigateUrl = UrlManager.PhonebooksManagePage
                });

                foreach (Phonebook phonebook in customer.Phonebooks)
                {
                    phonebook.Employees.Reload();

                    TreeViewNode phonebookNode = new TreeViewNode
                    {
                        Text = phonebook.Name,
                        Name = String.Format("Phonebook_{0}", phonebook.Oid)
                    };

                    phonebookNode.Nodes.Add(new TreeViewNode
                    {
                        Text = String.Format("Employees ({0})", phonebook.Employees.Count),
                        NavigateUrl = UrlManager.PhonebooksViewEmployeesPageByOid(phonebook.Oid)
                    });

                    phonebooksNode.Nodes.Add(phonebookNode);

                    // Field legal value configurations

                    phonebook.FieldLegalValueConfigurations.Reload();

                    TreeViewNode fieldLegalValueConfigNode = new TreeViewNode
                    {
                        Text = String.Format("Translation configs ({0})", phonebook.FieldLegalValueConfigurations.Count)
                    };

                    foreach (FieldLegalValueConfiguration configuration in phonebook.FieldLegalValueConfigurations.Cast<FieldLegalValueConfiguration>().ToList())
                    {
                        fieldLegalValueConfigNode.Nodes.Add(new TreeViewNode
                        {
                            Text = configuration.Name,
                            NavigateUrl = UrlManager.FieldLegalValueConfigurationSaveWithOid(configuration.Oid, phonebook.Oid)
                        });
                    }

                    fieldLegalValueConfigNode.Nodes.Add(new TreeViewNode
                    {
                        Text = "Add new",
                        NavigateUrl = UrlManager.FieldLegalValueConfigurationSaveWithOid(Guid.Empty, phonebook.Oid)
                    });

                    phonebookNode.Nodes.Add(fieldLegalValueConfigNode);
                }

                LeftNavigationTreeView.Nodes.Add(phonebooksNode);

                // Files

                LeftNavigationTreeView.Nodes.Add(new TreeViewNode
                {
                    Text = "Files",
                    NavigateUrl = UrlManager.FilesManagePage
                });

                // Settings

                TreeViewNode settingsNode = new TreeViewNode
                {
                    Text = "Settings",
                };

                // Import task configurations

                TreeViewNode importTaskConfigurationsNode = new TreeViewNode
                {
                    Text = "Email campaign configs"
                };

                foreach (ImportTaskConfiguration importTaskConfiguration in customer.ImportTaskConfigurations)
                {
                    importTaskConfigurationsNode.Nodes.Add(new TreeViewNode
                    {
                        Text = importTaskConfiguration.Name,
                        NavigateUrl = UrlManager.ImportTaskConfigurationSaveWithOid(importTaskConfiguration.Oid)
                    });
                }

                importTaskConfigurationsNode.Nodes.Add(new TreeViewNode
                {
                    Text = "Add new",
                    NavigateUrl = UrlManager.ImportTaskConfigurationSaveWithOid(Guid.Empty)
                });

                settingsNode.Nodes.Add(importTaskConfigurationsNode);

                LeftNavigationTreeView.Nodes.Add(settingsNode);

                //// Import profiles

                //TreeViewNode importProfilesNode = new TreeViewNode
                //{
                //    Text = String.Format("Import profiles ({0})", customer.ImportProfiles.Count)
                //};

                //foreach (ImportProfile profile in customer.ImportProfiles)
                //{
                //    importProfilesNode.Nodes.Add(new TreeViewNode
                //    {
                //        Text = profile.Name.ToString(),
                //        NavigateUrl = UrlManager.ImportProfilesViewPageByOid(profile.Oid)
                //    });
                //}

                //importProfilesNode.Nodes.Add(new TreeViewNode
                //{
                //    Text = "Add",
                //    NavigateUrl = UrlManager.ImportProfilesViewPageByOid(Guid.Empty)
                //});

                //settingsNode.Nodes.Add(importProfilesNode);

                // Email campaigns

                TreeViewNode campaignsNode = new TreeViewNode
                {
                    Text = "Email campaigns"
                };

                foreach (Phonebook phonebook in customer.Phonebooks)
                {
                    TreeViewNode phonebookNode = new TreeViewNode
                    {
                        Text = phonebook.Name,
                        Name = String.Format("Phonebook_{0}", phonebook.Oid)
                    };

                    phonebook.ImportTasks.Reload();

                    if (phonebook.ImportTasks.Count > 0)
                    {
                        campaignsNode.Nodes.Add(phonebookNode);

                        foreach (ImportTask importTask in phonebook.ImportTasks)
                        {
                            TreeViewNode importTaskNode = new TreeViewNode
                            {
                                Text = "Campaign: " + importTask.StartDate.ToShortDateString(),
                                NavigateUrl = UrlManager.PhonebooksImportTaskOverviewWithOid(importTask.Oid)
                            };

                            phonebookNode.Nodes.Add(importTaskNode);
                        }
                    }
                }

                campaignsNode.Nodes.Add(new TreeViewNode
                {
                    Text = "New campaign",
                    NavigateUrl = UrlManager.PhonebooksImportTaskSave()
                });

                LeftNavigationTreeView.Nodes.Add(campaignsNode);

                // Log

                LeftNavigationTreeView.Nodes.Add(new TreeViewNode
                {
                    Text = "Log",
                    NavigateUrl = UrlManager.LogPage
                });
            }
            else
            {
                LeftNavigationTreeView.Nodes.Add(new TreeViewNode
                {
                    Text = "Login",
                    NavigateUrl = UrlManager.LoginPage,
                });

                LeftNavigationTreeView.Nodes.Add(new TreeViewNode
                {
                    Text = "Register",
                    NavigateUrl = UrlManager.RegisterPage,
                });
            }
        }
예제 #52
0
		/// <summary>
		/// Determines whether the specified node is the "highest" checked node, or whether it has any ancestor nodes that are checked.
		/// </summary>
		/// <param name="albumNode">A treeview node for which to determine if any of its parents are checked.</param>
		/// <returns>Returns true if none of this node's ancestors is checked; otherwise returns false.</returns>
		private static bool IsTopLevelCheckedNode(TreeViewNode albumNode)
		{
			if (!albumNode.Checked)
				throw new WebException("Only checked treeview nodes should be passed to the IsTopLevelCheckedNode() method. Instead, the specified node was not checked.");

			TreeViewNode node = albumNode;
			while (node.ParentNode != null)
			{
				node = node.ParentNode;
				if (node.Checked)
					return false;
			}

			return true;
		}
예제 #53
0
        private void BindPostTree()
        {
            string strID = Request.QueryString["id"];

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

            RailExam.BLL.PostBLL PostBLL   = new RailExam.BLL.PostBLL();
            IList <Post>         postsList = PostBLL.GetPosts();

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

                foreach (Post post in postsList)
                {
                    tvn         = new TreeViewNode();
                    tvn.ID      = post.PostId.ToString();
                    tvn.Value   = post.PostId.ToString();
                    tvn.Text    = post.PostName;
                    tvn.ToolTip = post.PostName;

                    IList <Post> postsList1 = PostBLL.GetPostsByParentID(post.PostId);

                    if (postsList1.Count == 0)
                    {
                        tvn.ShowCheckBox = true;
                    }


                    foreach (string strOrgID in strIDS)
                    {
                        if (strOrgID == post.PostId.ToString() && tvn.ShowCheckBox)
                        {
                            tvn.Checked = true;
                        }
                    }

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

            tvPost.DataBind();
            //tvPost.ExpandAll();
        }
예제 #54
0
        protected override void OnInitialized()
        {
            base.OnInitialized();

            Root.Padding = "5px";
            Root.Layout  = Layout.LayoutType.Column;

            Root.Children = new List <Component>()
            {
                new Label("Wybierz folder")
                {
                    Margin = "5px"
                },
                new TreeView()
                {
                    Width    = "100%",
                    Expand   = true,
                    Name     = "treeview",
                    Children = new List <Component>()
                    {
                        new TreeViewRoot("Computer")
                        {
                            Name = "computer_node",
                            Icon = Icons.Desktop
                        }
                    }
                },
                new Component()
                {
                    Width     = "100%",
                    MarginTop = "5px",
                    AutosizeY = true,
                    Children  = new List <Component>()
                    {
                        new Button("Nowy folder")
                        {
                            Action = () => CreateNewFolder()
                        },
                        new Spacer(),
                        new Button("Anuluj")
                        {
                            Action = () => Hide()
                        },
                        new Button("Ok")
                        {
                            Appearance = Button.ButtonStyle.Filled,
                            MarginLeft = "5px",
                            Action     = () =>
                            {
                                TreeViewNode node = (Root.FindChild("treeview") as TreeView).GetSelectedNode();

                                if (node != null && node is TreeViewDirectory)
                                {
                                    OnFolderSelected?.Invoke(this, (node as TreeViewDirectory).Path);
                                }
                                Hide();
                            }
                        },
                    }
                }
            };

            string[]     drives       = Directory.GetLogicalDrives();
            TreeViewNode computerNode = Root.FindChild("computer_node") as TreeViewNode;

            foreach (var drive in drives)
            {
                computerNode.Children.Add(new TreeViewDirectory(drive)
                {
                    Icon = Icons.Hdd
                });
            }
        }
예제 #55
0
		/// <summary>
		/// Retrieve a list of albums that are in the heirarchical path between the specified album and a node in the treeview.
		/// The node that is discovered as the ancestor of the album is assigned to the existingParentNode parameter.
		/// </summary>
		/// <param name="treeview">The treeview with at least one node added to it. At least one node must be an ancestor of the 
		/// specified album.</param>
		/// <param name="album">An album. This method navigates the ancestors of this album until it finds a matching node in the treeview.</param>
		/// <param name="existingParentNode">The existing node in the treeview that is an ancestor of the specified album is assigned to
		/// this parameter.</param>
		/// <returns>Returns a list of albums where the first album (the one returned by calling Pop) is a child of the album 
		/// represented by the existingParentNode treeview node, and each subsequent album is a child of the previous album.
		/// The final album is the same album specified in the album parameter.</returns>
		private static Stack<IAlbum> GetAlbumsBetweenTopLevelNodeAndAlbum(ComponentArt.Web.UI.TreeView treeview, IAlbum album, out TreeViewNode existingParentNode)
		{
			if (treeview.Nodes.Count == 0)
				throw new ArgumentException("The treeview must have at least one top-level node before calling the function GetAlbumsBetweenTopLevelNodeAndAlbum().");
			
			Stack<IAlbum> albumParents = new Stack<IAlbum>();
			albumParents.Push(album);

			IAlbum parentAlbum = (IAlbum) album.Parent;

			albumParents.Push(parentAlbum);

			// Navigate up from the specified album until we find an album that exists in the treeview. Remember,
			// the treeview has been built with the root node and the first level of albums, so eventually we
			// should find an album. If not, just return without showing the current album.
			while ((existingParentNode = treeview.FindNodeById(parentAlbum.Id.ToString(CultureInfo.InvariantCulture))) == null)
			{
				parentAlbum = parentAlbum.Parent as IAlbum;

				if (parentAlbum == null)
					break;

				albumParents.Push(parentAlbum);
			}

			// Since we found a node in the treeview we don't need to add the most recent item in the stack. Pop it off.
			albumParents.Pop();

			return albumParents;
		}
        private void TreeView_ItemDropping(object sender, TreeViewItemDroppingEventArgs e)
        {
            var   dragSource       = e.DragSource as SfTreeView;
            var   dropSource       = sender as SfTreeView;
            IList sourceCollection = null;

            if (dragSource == null || (dragSource != dropSource))
            {
                var item         = e.Data.GetData("ListViewRecords") as ObservableCollection <object>;
                var record       = item[0] as Folder;
                var dropPosition = e.DropPosition.ToString();
                var folderData   = new Folder();
                var fileData     = new File();

                if (e.TargetNode != null)
                {
                    var itemInfo = AssociatedObject.treeView.GetItemInfo(e.TargetNode.Content);
                    int rowIndex = (int)itemInfo.ItemIndex;
                    if (dropPosition != "None" && rowIndex != -1)
                    {
                        var treeViewNode = AssociatedObject.treeView.GetNodeAtRowIndex(rowIndex);

                        if (treeViewNode == null)
                        {
                            return;
                        }
                        var data      = treeViewNode.Content;
                        var itemIndex = -1;

                        TreeViewNode parentNode = null;

                        if (dropPosition == "DropBelow" || dropPosition == "DropAbove")
                        {
                            parentNode = treeViewNode.ParentNode;

                            if (parentNode == null)
                            {
                                folderData = new Folder()
                                {
                                    FileName = record.FileName, ImageIcon = record.ImageIcon
                                }
                            }
                            ;
                            else
                            {
                                fileData = new File()
                                {
                                    FileName = record.FileName, ImageIcon = record.ImageIcon
                                };
                            }
                        }

                        else if (dropPosition == "DropAsChild")
                        {
                            if (!treeViewNode.IsExpanded)
                            {
                                AssociatedObject.treeView.ExpandNode(treeViewNode);
                            }
                            parentNode = treeViewNode;
                            if (treeViewNode.Level == 0)
                            {
                                fileData = new File()
                                {
                                    FileName = record.FileName, ImageIcon = record.ImageIcon
                                };
                            }
                        }

                        if (dropPosition == "DropBelow" || dropPosition == "DropAbove")
                        {
                            if (treeViewNode.ParentNode != null)
                            {
                                IEnumerable collection = null;
                                if (AssociatedObject.treeView.HierarchyPropertyDescriptors != null && AssociatedObject.treeView.HierarchyPropertyDescriptors.Count > 0)
                                {
                                    foreach (var propertyDescriptor in AssociatedObject.treeView.HierarchyPropertyDescriptors)
                                    {
                                        if (propertyDescriptor.TargetType == treeViewNode.ParentNode.Content.GetType())
                                        {
                                            var descriptors = TypeDescriptor.GetProperties(treeViewNode.ParentNode.Content.GetType());
                                            var tempItem    = descriptors.Find(AssociatedObject.treeView.ChildPropertyName, true);
                                            if (tempItem != null)
                                            {
                                                collection = tempItem.GetValue(treeViewNode.ParentNode.Content) as IEnumerable;
                                            }
                                            break;
                                        }
                                    }
                                }
                                else
                                {
                                    var descriptors = TypeDescriptor.GetProperties(treeViewNode.ParentNode.Content.GetType());
                                    var tempItem    = descriptors.Find(AssociatedObject.treeView.ChildPropertyName, true);
                                    if (tempItem != null)
                                    {
                                        collection = tempItem.GetValue(treeViewNode.ParentNode.Content) as IEnumerable;
                                    }
                                }
                                sourceCollection = GetSourceListCollection(collection);
                            }
                            else
                            {
                                sourceCollection = GetSourceListCollection(null);
                            }
                            itemIndex = sourceCollection.IndexOf(data);

                            if (dropPosition == "DropBelow")
                            {
                                itemIndex += 1;
                            }
                        }
                        else if (dropPosition == "DropAsChild")
                        {
                            var descriptors = TypeDescriptor.GetProperties(treeViewNode.Content.GetType());
                            if (parentNode != null && parentNode.IsExpanded)
                            {
                                IEnumerable collection = null;
                                var         tempItem   = descriptors.Find(AssociatedObject.treeView.ChildPropertyName, true);
                                if (tempItem != null)
                                {
                                    collection = tempItem.GetValue(treeViewNode.Content) as IEnumerable;
                                }

                                sourceCollection = GetSourceListCollection(collection);
                            }

                            if (sourceCollection == null)
                            {
                                var type     = data.GetType().GetProperty(AssociatedObject.treeView.ChildPropertyName).PropertyType;
                                var paramExp = System.Linq.Expressions.Expression.Parameter(type, type.Name);
                                var instance = System.Linq.Expressions.Expression.MemberInit(System.Linq.Expressions.Expression.New(type), new List <MemberBinding>());
                                var lambda   = System.Linq.Expressions.Expression.Lambda(instance, paramExp);
                                var delg     = lambda.Compile();
                                var list     = delg.DynamicInvoke(new object[] { null }) as IList;

                                if (list != null)
                                {
                                    var tempitem = descriptors.Find(AssociatedObject.treeView.ChildPropertyName, true);
                                    tempitem.SetValue(treeViewNode.Content, list);
                                    sourceCollection = list;
                                }
                            }
                            itemIndex = sourceCollection.Count;
                        }

                        if (parentNode != null)
                        {
                            sourceCollection.Insert(itemIndex, fileData);
                        }
                        else
                        {
                            sourceCollection.Insert(itemIndex, folderData);
                        }

                        (AssociatedObject.listView.ItemsSource as ObservableCollection <Folder>).Remove(record as Folder);
                        e.Handled = true;
                    }
                }
                else
                {
                    sourceCollection = GetSourceListCollection(null);
                    sourceCollection.Insert(0, record);
                    (AssociatedObject.listView.ItemsSource as ObservableCollection <Folder>).Remove(record as Folder);
                }
            }
        }
예제 #57
0
		/// <summary>
		/// Add the collection of albums to the specified treeview node.
		/// </summary>
		/// <param name="albums">The collection of albums to add the the treeview node.</param>
		/// <param name="parentNode">The treeview node that will receive child nodes representing the specified albums.</param>
		/// <param name="expandNode">Specifies whether the nodes should be expanded.</param>
		private void BindAlbumToTreeview(IGalleryObjectCollection albums, TreeViewNode parentNode, bool expandNode)
		{
			string handlerPath = String.Concat(Util.GalleryRoot, "/handler/gettreeviewxml.ashx");

			foreach (IAlbum album in albums)
			{
				TreeViewNode node = new TreeViewNode();
				node.Text = Util.RemoveHtmlTags(album.Title);
				node.Value = album.Id.ToString(CultureInfo.InvariantCulture);
				node.ID = album.Id.ToString(CultureInfo.InvariantCulture);
				node.Expanded = expandNode;

				node.ShowCheckBox = true;
				node.Selectable = true;

				if (album.GetChildGalleryObjects(GalleryObjectType.Album).Count > 0)
				{
					node.ContentCallbackUrl = String.Format(CultureInfo.CurrentCulture, "{0}?aid={1}{2}", handlerPath, album.Id.ToString(CultureInfo.InvariantCulture), this.SecurityPermissionQueryStringParm);
				}

				// Select and check this node if needed.
				if ((this._albumToSelect != null) && (album.Id == this._albumToSelect.Id))
				{
					tv.SelectedNode = node;
					node.Checked = true;
					node.Expanded = true;
					// Expand the child of the selected album.
					BindAlbumToTreeview(album.GetChildGalleryObjects(GalleryObjectType.Album), node, false);
				}
				
				// Check this node if needed.
				if (this._albumIdsToSelect.Contains(album.Id))
				{
					node.Checked = true;
				}

				parentNode.Nodes.Add(node);
			}
		}
예제 #58
0
        private void Fill_trvOrganizationPosts_UnderManagementPersonnel()
        {
            string imageUrl  = PathHelper.GetModulePath_Nuke() + "Images\\TreeView\\folder.gif";
            string imagePath = PathHelper.GetModuleUrl_Nuke() + "Images/TreeView/folder.gif";

            string[] retMessage = new string[4];
            this.InitializeCulture();
            try
            {
                OrganizationUnit rootOrgPost     = this.ManagerBusiness.GetOrganizationUnitTree();
                TreeViewNode     rootOrgPostNode = new TreeViewNode();
                rootOrgPostNode.ID = rootOrgPost.ID.ToString();
                string rootOrgPostNodeText = string.Empty;
                if (GetLocalResourceObject("OrgNode_trvPosts_Post") != null)
                {
                    rootOrgPostNodeText = GetLocalResourceObject("OrgNode_trvPosts_Post").ToString();
                }
                else
                {
                    rootOrgPostNodeText = rootOrgPost.Name;
                }
                rootOrgPostNode.Text = rootOrgPostNodeText;
                OrganizationPostNodeValue rootOrgPostNodeValue = new OrganizationPostNodeValue();
                rootOrgPostNodeValue.CustomCode    = rootOrgPost.CustomCode;
                rootOrgPostNodeValue.ParentPath    = string.Empty;
                rootOrgPostNodeValue.PersonnelName = string.Empty;
                rootOrgPostNodeValue.PersonnelCode = string.Empty;
                rootOrgPostNodeValue.PersonnelID   = "0";
                rootOrgPostNode.Value = this.JsSerializer.Serialize(rootOrgPostNodeValue);
                if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + imageUrl))
                {
                    rootOrgPostNode.ImageUrl = imagePath;
                }
                this.trvOrganizationPosts_UnderManagementPersonnel.Nodes.Add(rootOrgPostNode);
                foreach (OrganizationUnit childOrgPost in rootOrgPost.ChildList)
                {
                    TreeViewNode childOrgPostNode = new TreeViewNode();
                    childOrgPostNode.ID   = childOrgPost.ID.ToString();
                    childOrgPostNode.Text = childOrgPost.Name;
                    OrganizationPostNodeValue childOrgPostNodeValue = new OrganizationPostNodeValue();
                    childOrgPostNodeValue.CustomCode    = childOrgPost.CustomCode;
                    childOrgPostNodeValue.ParentPath    = childOrgPost.ParentPath;
                    childOrgPostNodeValue.PersonnelName = childOrgPost.Person != null ? childOrgPost.Person.Name : string.Empty;
                    childOrgPostNodeValue.PersonnelCode = childOrgPost.Person != null ? childOrgPost.Person.PersonCode : string.Empty;
                    childOrgPostNodeValue.PersonnelID   = childOrgPost.Person != null?childOrgPost.Person.ID.ToString() : "0";

                    childOrgPostNode.Value = this.JsSerializer.Serialize(childOrgPostNodeValue);
                    if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + imageUrl))
                    {
                        childOrgPostNode.ImageUrl = imagePath;
                    }
                    childOrgPostNode.ContentCallbackUrl = "XmlOrganizationPostsLoadonDemand.aspx?ParentOrgPostID=" + childOrgPost.ID + "&LangID=" + this.LangProv.GetCurrentLanguage();
                    if (childOrgPost.ChildList.Count > 0)
                    {
                        childOrgPostNode.Nodes.Add(new TreeViewNode());
                    }
                    rootOrgPostNode.Nodes.Add(childOrgPostNode);
                }
                if (rootOrgPost.ChildList.Count > 0)
                {
                    rootOrgPostNode.Expanded = true;
                }
            }
            catch (UIValidationExceptions ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
                this.ErrorHiddenField_OrganizationPosts_UnderManagementPersonnel.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (UIBaseException ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
                this.ErrorHiddenField_OrganizationPosts_UnderManagementPersonnel.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (Exception ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
                this.ErrorHiddenField_OrganizationPosts_UnderManagementPersonnel.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
        }
예제 #59
0
    /// <summary>
    /// 根据数据XmlDoc绑定树节点:节点ID,节点文本;如果该行对应的树节点已经建立就直接返回该节点
    /// </summary>
    /// <param name="xmlNodeRow">数据源行节点</param>
    /// <returns>如成功返回对应的树节点,否则返回null</returns>
    private TreeViewNode bindTree(XmlNode xmlNodeRow)
    {
        if ("" == this._idField || "" == this._pidField || "" == this._txtField || null == xmlNodeRow)
            return null;
        XmlNode xmlNodeID = xmlNodeRow.SelectSingleNode(this._idField);
        XmlNode xmlNodePid = xmlNodeRow.SelectSingleNode(this._pidField);
        XmlNode xmlNodeTxt = xmlNodeRow.SelectSingleNode(this._txtField);
        XmlNode xmlNodeTag = null;
        if(this._nTag!="")
            xmlNodeTag = xmlNodeRow.SelectSingleNode(this._nTag);
        if (null == xmlNodeID || null == xmlNodeID.FirstChild || XmlNodeType.Text != xmlNodeID.FirstChild.NodeType)
            return null;
        //已经存在节点直接返回;
        TreeViewNode trvNode = this.getTrvNodeByID(xmlNodeID.FirstChild.Value);
        if (null != trvNode)       return trvNode;
        //没有该节点,就先创建父节点
        trvNode = new TreeViewNode();
        if (null != xmlNodeTxt && null != xmlNodeTxt.FirstChild)
            trvNode.Text = xmlNodeTxt.FirstChild.Value;
        if (null != xmlNodeTag && null != xmlNodeTag.FirstChild)
            trvNode.Value = xmlNodeTag.FirstChild.Value;
        else
            trvNode.Value = leofun.setvaltag("", this._idField, trvNode.PageViewId);
        trvNode.PageViewId = xmlNodeID.FirstChild.Value; //代替原来的DataKey
        string tag = leofun.setvaltag("", this._idField, trvNode.PageViewId);
        XmlNode xmlNodeRowParent = null;
        if(null!=xmlNodePid && null!=xmlNodePid.FirstChild && XmlNodeType.Text==xmlNodePid.FirstChild.NodeType)
            xmlNodeRowParent= xmlNodeRow.ParentNode.SelectSingleNode("*[" + this._idField + "='" + xmlNodePid.FirstChild.Value + "']");
        

        TreeViewNode nodeParent = null;

        if (null != xmlNodeRowParent)
            nodeParent = this.bindTree(xmlNodeRowParent);

        //有父节点就加入父节点之下,没有的直接加入树的跟节点
        if (null != nodeParent)
            nodeParent.Nodes.Add(trvNode);
        else
            this.trvLand.Nodes.Add(trvNode);
        if (null == xmlNodeTag)
            trvNode.Value = tag;
        trvNode.ID = trvNode.PageViewId;
        return trvNode;
    }
예제 #60
0
        private void Fill_trvOrganizationPersonnel_UnderManagementPersonnel()
        {
            string imageUrl  = PathHelper.GetModulePath_Nuke() + "Images\\TreeView\\folder.gif";
            string imagePath = PathHelper.GetModuleUrl_Nuke() + "Images/TreeView/folder.gif";

            string[] retMessage = new string[4];
            this.InitializeCulture();
            try
            {
                IList <Department> departmentsList    = new List <Department>();
                Department         rootDepartment     = this.ManagerBusiness.GetDepartmentRoot();
                TreeViewNode       rootDepartmentNode = new TreeViewNode();
                rootDepartmentNode.ID = rootDepartment.ID.ToString();
                string rootDepartmentNodeText = string.Empty;
                if (GetLocalResourceObject("OrgNode_trvPosts_Post") != null)
                {
                    rootDepartmentNodeText = GetLocalResourceObject("OrgNode_trvPosts_Post").ToString();
                }
                else
                {
                    rootDepartmentNodeText = rootDepartment.Name;
                }
                rootDepartmentNode.Text  = rootDepartmentNodeText;
                rootDepartmentNode.Value = ((int)UnderManagmentTypes.Department).ToString();
                if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + imageUrl))
                {
                    rootDepartmentNode.ImageUrl = imagePath;
                }
                this.trvOrganizationPersonnel_UnderManagementPersonnel.Nodes.Add(rootDepartmentNode);
                if (SessionHelper.HasSessionValue(SessionHelper.AllDepartments))
                {
                    SessionHelper.ClearSessionValue(SessionHelper.AllDepartments);
                }
                departmentsList = this.DepartmentBusiness.GetAll();
                SessionHelper.SaveSessionValue(SessionHelper.AllDepartments, departmentsList);
                IList <Department> DepartmentChildList = this.DepartmentBusiness.GetDepartmentChilds(rootDepartment.ID, departmentsList);
                foreach (Department childDepartment in DepartmentChildList)
                {
                    TreeViewNode childOrgPostNode = new TreeViewNode();
                    childOrgPostNode.ID    = childDepartment.ID.ToString();
                    childOrgPostNode.Text  = childDepartment.Name;
                    childOrgPostNode.Value = ((int)UnderManagmentTypes.Department).ToString();
                    if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + imageUrl))
                    {
                        childOrgPostNode.ImageUrl = imagePath;
                    }
                    childOrgPostNode.ContentCallbackUrl = "XmlDeparmentsPersonnelLoadonDemand.aspx?ParentDepartmentID=" + childDepartment.ID + "&LangID=" + this.LangProv.GetCurrentLanguage();
                    //if (this.ManagerBusiness.GetDepartmentChilds(childDepartment.ID).Count > 0 || this.ManagerBusiness.GetDepartmentPerson(childDepartment.ID).Count > 0)
                    //    childOrgPostNode.Nodes.Add(new TreeViewNode());
                    rootDepartmentNode.Nodes.Add(childOrgPostNode);
                }
                if (DepartmentChildList.Count > 0 || this.ManagerBusiness.GetDepartmentPerson(rootDepartment.ID).Count > 0)
                {
                    rootDepartmentNode.Expanded = true;
                }
            }
            catch (UIValidationExceptions ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
                this.ErrorHiddenField_OrganizationPersonnel_UnderManagementPersonnel.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (UIBaseException ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
                this.ErrorHiddenField_OrganizationPersonnel_UnderManagementPersonnel.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (Exception ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
                this.ErrorHiddenField_OrganizationPersonnel_UnderManagementPersonnel.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
        }