/// <summary> /// 构建Document树 /// </summary> /// <param name="reload">是否重新从数据库中读取Document树</param> private void BuildDocumentTree(bool reload) { this.treeDocument.Nodes.Clear(); if (reload) { this.LoadDocumentTreeToApplication(); } ITreeObjectNode node = LoadDocumentTreeToApplication(); this.treeDocument.Nodes.Add(BuildTreeNode(node)); LanguageWord lword = this.languageComponent1.GetLanguage("documentRoot"); if (lword != null) { this.treeDocument.Nodes[0].Text = lword.ControlText; } //this.treeModule.ExpandAll(); this.treeDocument.CollapseAll(); if (this.treeDocument.SelectedNode != null) { Infragistics.WebUI.UltraWebNavigator.Node nodeParent = this.treeDocument.SelectedNode.Parent; while (nodeParent != null) { nodeParent.Expand(false); nodeParent = nodeParent.Parent; } } this.BuildParentDocumentCodeList(); }
/// <summary> /// 构建Menu树 /// </summary> private void BuildMenuTree() { this.treeMenu.Nodes.Clear(); ITreeObjectNode node = this.LoadMenuTree(); this.treeMenu.Nodes.Add(BuildTreeNode(node)); LanguageWord lword = this.languageComponent1.GetLanguage("menuRoot"); if (lword != null) { this.treeMenu.Nodes[0].Text = lword.ControlText; } //this.treeMenu.ExpandAll(); this.treeMenu.CollapseAll(); if (this.treeMenu.SelectedNode != null) { Infragistics.WebUI.UltraWebNavigator.Node nodeParent = this.treeMenu.SelectedNode.Parent; while (nodeParent != null) { nodeParent.Expand(false); nodeParent = nodeParent.Parent; } } this.BuildParenMenuCodeList(); }
private void webTree_NodeBound(object sender, Infragistics.WebUI.UltraWebNavigator.WebTreeNodeEventArgs e) { //************************************************************* // Copy Item Id to node Tag so that Client script can access it //************************************************************* e.Node.Tag = e.Node.DataKey.ToString(); //************************************************************* // Clean Nodes text (remove common text with parents) //************************************************************* Infragistics.WebUI.UltraWebNavigator.Node n = e.Node; Utils.CleanNodeText(ref n); }
private void webTree_NodeBound(object sender, Infragistics.WebUI.UltraWebNavigator.WebTreeNodeEventArgs e) { //************************************************************* // Flag node if it has childs //************************************************************* try { if (e.Node.DataKey != null) { //Response.Write("<font size=1 face=verdana>Table Count = " + ds.Tables.Count.ToString()); //Response.Write("<br>DataKey = " + e.Node.DataKey.ToString()); DataTable dtChildren = e.Node.DataKey.ToString() == "-1" ? ds.Tables[0] : ds.Tables.Count > 1 ? ds.Tables[1] : ds.Tables[0]; //Response.Write("<br>Rows Count = " + dtChildren.Rows.Count.ToString()); //Response.Write("<br>"); DataRow dr = dtChildren.Select("ItemId = " + e.Node.DataKey.ToString())[0]; e.Node.ShowExpand = Convert.ToInt32(dr["ChildCount"]) > 0; //************************************************************* // if node is project, put in different style //************************************************************* if (Convert.ToBoolean(dr["IsProject"])) { e.Node.CssClass = "hc_pnode"; e.Node.HoverClass = "hc_opnode"; e.Node.HiliteClass = "hc_spnode"; } e.Node.TargetFrame = e.Node.Text; //************************************************************* // Copy Item Id to node Tag so that Client script can access it //************************************************************* e.Node.Tag = e.Node.DataKey.ToString(); if (e.Node.ShowExpand && e.Node.Nodes.Count == 0) { e.Node.Tag += "|needsLoadOnDemand"; Node loadNode = e.Node.Nodes.Add("<img src='/hc_v4/img/ed_wait.gif'/>Loading..."); loadNode.ImageUrl = "/hc_v4/ig/s_blank.gif"; e.Node.Expanded = false; } if (e.Node.Parent != null) { string tag = e.Node.Parent.Tag.ToString(); if (tag.IndexOf("|needsLoadOnDemand") > 0) { e.Node.Parent.Tag = tag.Replace("|needsLoadOnDemand", String.Empty); if (e.Node.Parent.Nodes[0].Text.EndsWith("Loading...")) { e.Node.Parent.Nodes.RemoveAt(0); } } } //************************************************************* // if node has a roll, put image //************************************************************* if (Convert.ToBoolean(dr["HasRoll"])) { e.Node.Text = "<img src='/hc_v4/img/ed_roll.gif'> " + e.Node.Text; } //************************************************************* // if node is country specific //************************************************************* if (Convert.ToBoolean(dr["IsCountrySpecific"])) { e.Node.Text = "<img src='/hc_v4/img/M.gif'> " + e.Node.Text; } // Add status for obsolete and future string status = dr["Status"].ToString(); e.Node.ImageUrl = e.Node.SelectedImageUrl = "/hc_v4/ig/s_" + status + ".gif"; // If level Is Sku level, update Icon int levelId = Convert.ToInt32(dr["LevelId"]); if (levelId == SkuLevel) { e.Node.ImageUrl = "/hc_v4/img/type_" + dr["ItemTypeId"].ToString() + ".png"; if (e.Node.TargetUrl == "1") // Top Value { e.Node.ImageUrl = "/hc_v4/img/type_1.png"; } e.Node.SelectedImageUrl = e.Node.ImageUrl; switch (status.ToLower()) { case ("o"): e.Node.Text = "<font color=gray>[O] </font>" + e.Node.Text; break; case ("f"): e.Node.Text = "<font color=green>[F] </font>" + e.Node.Text; break; case ("e"): e.Node.Text = "<font color=red>[E] </font>" + e.Node.Text; break; } } else { if (levelId > SkuLevel) { e.Node.SelectedImageUrl = e.Node.ImageUrl = "/hc_v4/img/option.png"; } } //************************************************************* // Item deleted //************************************************************* if (Convert.ToInt32(dr["PMDeleted"]) > 0) { e.Node.Style.CustomRules += "text-decoration:line-through;"; } //************************************************************* // Clean Nodes text (remove common text with parents) //************************************************************* Infragistics.WebUI.UltraWebNavigator.Node n = e.Node; //// Moueen Code for SMO #region COMPANY COLUMN if (e.Node.Level == 1) { string company = string.Empty; int defaultCompany = 0; using (Database dbObj = Utils.GetMainDB()) { using (SqlDataReader rs = dbObj.RunSPReturnRS("[GetCompanyInfoFromItemId]", new SqlParameter("@ItemId", e.Node.DataKey), new SqlParameter("@AlwaysDefault", defaultCompany))) { if ((dbObj.LastError == string.Empty) && (rs.HasRows)) { rs.Read(); company = rs["Company_Info"].ToString(); } } } if (!string.IsNullOrEmpty(company)) { e.Node.Text = company + "-" + e.Node.Text; } } #endregion ds.Dispose(); if ((bool)SessionState.User.GetOptionById((int)OptionsEnum.OPT_SHOW_SHRINKED_NAMES).Value) { Trace.Warn("Before Clean = " + n.Text); Utils.CleanNodeText(ref n); Trace.Warn("After Clean = " + n.Text); } } } catch (Exception ex) { Response.Write(ex.ToString()); Response.End(); } }
/// <summary> /// 邦定列表 /// </summary> private void BindTreeView() { //if (drpOUList.SelectedIndex == 0) //{ // return; //} DataTable dt1 = null; DataTable dt2 = null; DataTable dt3 = null; DataTable dt4 = null; Infragistics.WebUI.UltraWebNavigator.Node tn1; Infragistics.WebUI.UltraWebNavigator.Node tn2; Infragistics.WebUI.UltraWebNavigator.Node tn3; Infragistics.WebUI.UltraWebNavigator.Node tn4; tvRight.ClearAll(); //dt1 = new MenuQuery().GetMenuAll2(0); dt1 = new MenuQuery().GetMenuAll(0, CommonEnum.MenuType.Inner); for (int i = 0; i < dt1.Rows.Count; i++) { tn1 = new Infragistics.WebUI.UltraWebNavigator.Node(); tn1.Text = dt1.Rows[i]["MenuName"].ToString(); tn1.DataKey = dt1.Rows[i]["MenuID"].ToString(); tn1.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.True; //dt2 = new MenuQuery().GetMenuAll2(NDConvert.ToInt64(tn1.DataKey.ToString())); dt2 = new MenuQuery().GetMenuAll(NDConvert.ToInt64(tn1.DataKey.ToString()), CommonEnum.MenuType.Inner); for (int j = 0; j < dt2.Rows.Count; j++) { tn2 = new Infragistics.WebUI.UltraWebNavigator.Node(); tn2.Text = dt2.Rows[j]["MenuName"].ToString(); tn2.DataKey = dt2.Rows[j]["MenuID"].ToString(); tn2.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.True; tn1.Nodes.Add(tn2); //dt3 = new MenuQuery().GetMenuAll2(NDConvert.ToInt64(tn2.DataKey.ToString())); dt3 = new MenuQuery().GetMenuAll(NDConvert.ToInt64(tn2.DataKey.ToString()), CommonEnum.MenuType.Inner); if (dt3.Rows.Count > 0) { for (int k = 0; k < dt3.Rows.Count; k++) { tn3 = new Infragistics.WebUI.UltraWebNavigator.Node(); tn3.Text = dt3.Rows[k]["MenuName"].ToString(); tn3.DataKey = dt3.Rows[k]["MenuID"].ToString(); tn3.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.True; tn2.Nodes.Add(tn3); dt4 = new MenuFunctionQuery().GetMenuFunction(NDConvert.ToInt64(tn3.DataKey.ToString())); for (int m = 0; m < dt4.Rows.Count; m++) { tn4 = new Infragistics.WebUI.UltraWebNavigator.Node(); tn4.Text = dt4.Rows[m]["FName"].ToString(); tn4.DataKey = dt4.Rows[m]["FID"].ToString(); tn4.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.True; tn3.Nodes.Add(tn4); } } } else { dt4 = new MenuFunctionQuery().GetMenuFunction(NDConvert.ToInt64(tn2.DataKey.ToString())); for (int m = 0; m < dt4.Rows.Count; m++) { tn4 = new Infragistics.WebUI.UltraWebNavigator.Node(); tn4.Text = dt4.Rows[m]["FName"].ToString(); tn4.DataKey = dt4.Rows[m]["FID"].ToString(); tn4.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.True; tn2.Nodes.Add(tn4); } } } tvRight.Nodes.Add(tn1); } tvRight.ExpandAll(); }
//Added by Venkata end protected void webTree_NodeBound(object sender, Infragistics.WebUI.UltraWebNavigator.WebTreeNodeEventArgs e) { //************************************************************* // Flag node if it has childs //************************************************************* if (e.Node.DataKey != null) { //Code added for Links Requirement (PR664195) to show/hide obsolete items by Prachi on 12th Dec 2012 bool showObsolete; if (bLinkFrom) { CheckBox cb = (CheckBox)uwToolbar.Items.FromKeyCustom("chkObs").FindControl("chkObsolete"); showObsolete = cb.Checked; } else { showObsolete = true; } //Code added for Links Requirement (PR658940) - to enable the checkbox above the SKU Level by Prachi on 11th Dec 2012 e.Node.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.False; Int64 currentItemId = Convert.ToInt64(e.Node.DataKey); DataTable dtChildren = e.Node.DataKey.ToString() == "-1" ? ds.Tables[0] : ds.Tables.Count > 1 ? ds.Tables[1] : ds.Tables[0]; DataRow dr = dtChildren.Select("ItemId = " + currentItemId.ToString())[0]; // Display or not image to expand node e.Node.ShowExpand = Convert.ToBoolean(dr["HasChild"]); // Update image e.Node.ImageUrl = "/hc_v4/ig/s_l.gif"; Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "scroll", "scroll('" + String.Format("{0}{1}", webTree.UniqueID.Replace("$", ""), e.Node.GetIdString()) + "');", true); // Add checkbox bool isSkuLevel = Convert.ToBoolean(dr["IsSkuLevel"]); bool isMainComponent = Convert.ToBoolean(dr["IsMainComponent"]); int typeId = Convert.ToInt32(dr["TypeId"]); //Code added for Links Requirement (PR664195) to display obsolete icon by Prachi on 12th Dec 2012 bool isObsolete = Convert.ToBoolean(dr["IsObsolete"]); //Code modified for Links Requirement (PR658940) - to enable the checkbox above the SKU Level by Prachi on 11th Dec 2012 - start bool isLinked = Convert.ToBoolean(dr["IsLinked"]); int levelId = Convert.ToInt32(dr["LevelId"]); int limit = configLimit; if (Ultrawebtoolbar2.Items.FromKeyCustom("LoadLevel1").Visible) { CheckBox checkLoad = (CheckBox)Ultrawebtoolbar2.Items.FromKeyCustom("LoadLevel1").FindControl("chkLoad"); //If retrieved Limit is Product Type and User has not checked the "Load from Product Level" checkbox, then consider the limit as the default value if (limit == 1) //For Product Type Level { if (!checkLoad.Checked) { if (bLinkFrom) //Companion { limit = Convert.ToInt32(ApplicationSettings.Parameters["Link_ProductCompanionLimit"].Value); } else //Host { limit = Convert.ToInt32(ApplicationSettings.Parameters["Link_ProductHostLimit"].Value); } } } } if (levelId >= limit) //Code modified for Links Requirement (PR658940) - to enable the checkbox above the SKU Level by Prachi on 11th Dec 2012 - end { e.Node.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.True; //Code added for Links Requirement (PR658940) - to check the nodes if parent node is already checked by Prachi on 9th Jan 2013 - start Node parentNode = e.Node.Parent; if (parentNode.Checked) { e.Node.Checked = true; } //Code added for Links Requirement (PR658940) - to check the nodes if parent node is already checked by Prachi on 9th Jan 2013 - end //Code modified for Links Requirement (PR658940) - to disable the checkbox if the item has already been linked by Prachi on 10th Jan 2013 if (isLinked) { e.Node.Enabled = false; e.Node.Checked = true; e.Node.ShowExpand = false; } // Check if current item is selected item if (currentItemId == itemId) { e.Node.Enabled = false; e.Node.Checked = false; e.Node.Style.CssClass = "hc_error"; e.Node.Style.Font.Bold = true; e.Node.Style.Font.Italic = true; e.Node.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.False; } // If link type is bundle and current SKU is main component if (isMainComponent) { e.Node.Enabled = false; e.Node.Checked = true; e.Node.Style.CssClass = "hc_error"; e.Node.Style.Font.Bold = true; e.Node.Style.Font.Italic = true; e.Node.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.False; } //Code added for Links Requirement (PR664195) - to not allow the user to select obsolete item if selected host/companion is already obsolete by Prachi on 16th Jan 2013 //If selected item on left hand side is obsolete and current item in treeview is also obsolete if (showObsolete) { if (isObsolete && isItemObs) { e.Node.Enabled = false; e.Node.Checked = false; e.Node.ShowExpand = false; } } } //Code added for Links Requirement (PR658940) - to enable the checkbox above the SKU Level by Prachi on 11th Dec 2012 // If level is Sku level, update Icon if (isSkuLevel) { e.Node.ImageUrl = "/hc_v4/img/type_" + typeId.ToString() + ".png"; e.Node.ShowExpand = false; } //Code added for Links Requirement (PR664195) - to display obsolete icon and show/hide obsolete items by Prachi on 12th Dec 2012 if (isObsolete) { if (showObsolete) { e.Node.ImageUrl = e.Node.SelectedImageUrl = "/hc_v4/ig/s_o.gif"; } } } //************************************************************* // Copy Item Id to node Tag so that Client script can access it //************************************************************* e.Node.Tag = e.Node.DataKey.ToString(); //************************************************************* // Clean Nodes text (remove common text with parents) //************************************************************* Infragistics.WebUI.UltraWebNavigator.Node n = e.Node; if ((bool)SessionState.User.GetOptionById((int)OptionsEnum.OPT_SHOW_SHRINKED_NAMES).Value) { Utils.CleanNodeText(ref n); } }