Example #1
0
 private void webTree_NodeBound(object sender, Infragistics.WebUI.UltraWebNavigator.WebTreeNodeEventArgs e)
 {
     if (e.Node.Parent != null)
     {
         e.Node.Text = e.Node.Text;
         if (e.Node.Parent.Checked)
         {
             e.Node.Checked  = true;
             e.Node.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.False;
         }
         else
         {
             e.Node.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.True;
         }
         if (e.Node.Checked)
         {
             Infragistics.WebUI.UltraWebNavigator.Node p = e.Node.Parent;
             while (p != null)
             {
                 if (p.Level > 0)
                 {
                     //p.Expand(false);
                     p = p.Parent;
                 }
                 else
                 {
                     p = null;
                 }
             }
         }
     }
 }
Example #2
0
    private void webTree_DemandLoad(object sender, Infragistics.WebUI.UltraWebNavigator.WebTreeNodeEventArgs e)
    {
        string itemId = e.Node.DataPath.ToString();

        e.Node.DataKey = itemId;
        if (e.Node.Nodes.Count == 0)
        {
            // Retrieve all children for a given parent
            using (dbObj = Utils.GetMainDB())
            {
                using (DataSet ds = dbObj.RunSPReturnDataSet("dbo._User_ScopeGetTV", "Items",
                                                             new SqlParameter("@UserId", -1),
                                                             new SqlParameter("@ParentId", itemId)))
                {
                    e.Node.DataBind(ds.Tables[0].DefaultView, "Items");
                    dbObj.CloseConnection();
                    e.Node.Expanded = true;

                    if (ds != null)
                    {
                        ds.Dispose();
                    }
                }
            }
        }
    }
Example #3
0
    private void webTree_NodeBound(object sender, Infragistics.WebUI.UltraWebNavigator.WebTreeNodeEventArgs e)
    {
        if (e.Node != null)
        {
            string sItemId = e.Node.DataKey.ToString();
            e.Node.Text     = e.Node.Text + " [#" + e.Node.DataKey.ToString() + "]";
            e.Node.DataPath = sItemId;

            // Retrieve the count of children, if the count is positive then the current node can be expanded
            e.Node.ShowExpand = Utils.GetCount(dbObj, String.Format("SELECT COUNT(*) FROM Items WHERE ParentId = {0}", sItemId)) > 0;

            using (HyperCatalog.Business.Item currentItem = HyperCatalog.Business.Item.GetByKey(Convert.ToInt64(sItemId)))
            {
                // Update checkbox
                if (user != null && user.HasItemInScope(currentItem.Id))
                {
                    e.Node.Checked = true;
                }

                if (e.Node.Parent != null)
                {
                    Infragistics.WebUI.UltraWebNavigator.Node p = e.Node.Parent;
                    if (p.Checked)
                    {
                        e.Node.Checked  = true;
                        e.Node.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.False;
                    }
                    else
                    {
                        e.Node.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.True;
                    }
                    if (e.Node.Checked)
                    {
                        while (p != null)
                        {
                            if (p.Level > 0)
                            {
                                p = p.Parent;
                            }
                            else
                            {
                                p = null;
                            }
                        }
                    }
                }

                if ((currentItem != null) && (currentItem.Level.SkuLevel))
                {
                    // Update Icon
                    e.Node.ImageUrl = "/hc_v4/img/type_" + currentItem.TypeId + ".png";
                }
            }
        }
    }
Example #4
0
    private void webTree_NodeBound(object sender, Infragistics.WebUI.UltraWebNavigator.WebTreeNodeEventArgs e)
    {
        if (e.Node != null)
        {
            e.Node.ShowExpand = Utils.GetCount(dbObj, "SELECT COUNT(*) FROM Items WHERE ParentId = " + e.Node.DataKey.ToString()) > 0;
            if (e.Node.Parent != null)
            {
                if (e.Node.Parent.Checked)
                {
                    // remove checkbox
                    e.Node.Checked  = true;
                    e.Node.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.False;
                }
                else
                {
                    // add checkbox
                    e.Node.CheckBox = Infragistics.WebUI.UltraWebNavigator.CheckBoxes.True;
                }

                if (e.Node.Checked)
                {
                    Infragistics.WebUI.UltraWebNavigator.Node p = e.Node.Parent;
                    while (p != null)
                    {
                        if (p.Level > 0)
                        {
                            p = p.Parent;
                        }
                        else
                        {
                            p = null;
                        }
                    }
                }
            }

            // Update image
            e.Node.ImageUrl = "/hc_v4/ig/s_l.gif";

            HyperCatalog.Business.Item currentItem = HyperCatalog.Business.Item.GetByKey(Convert.ToInt64(e.Node.DataKey));
            if ((currentItem != null) && (currentItem.Level.SkuLevel))
            {
                // Update Icon
                e.Node.ImageUrl = "/hc_v4/img/type_" + currentItem.TypeId + ".png";
            }
        }
    }
Example #5
0
    private void webTree_DemandLoad(object sender, Infragistics.WebUI.UltraWebNavigator.WebTreeNodeEventArgs e)
    {
        lbError.Visible = false;

        if (e.Node.Nodes.Count == 0)
        {
            using (dbObj = Utils.GetMainDB())
            {
                using (DataSet ds = dbObj.RunSPReturnDataSet("dbo._LinkType_GetTv", "Items",
                                                             new SqlParameter("@LinkTypeId", linkTypeId),
                                                             new SqlParameter("@ParentId", e.Node.DataKey.ToString()),
                                                             new SqlParameter("@LinkFromTo", Convert.ToByte(!linkFrom)),
                                                             new SqlParameter("@Company", SessionState.CompanyName)))
                {
                    dbObj.CloseConnection();

                    if (dbObj.LastError.Length > 0)
                    {
                        lbError.CssClass = "hc_error";
                        lbError.Text     = dbObj.LastError;
                        lbError.Visible  = true;
                    }
                    else
                    {
                        e.Node.DataBind(ds.Tables[0].DefaultView, "Items");
                        e.Node.Expanded = true;

                        if (ds != null)
                        {
                            ds.Dispose();
                        }

                        Page.DataBind();
                    }
                }
            }
        }
        UpdateDataView();
    }
 /// <summary>
 /// 树壮结点被点击
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void tvMenu_NodeClicked(object sender, Infragistics.WebUI.UltraWebNavigator.WebTreeNodeEventArgs e)
 {
     this.MenuID = NDConvert.ToInt64(tvMenu.SelectedNode.DataKey.ToString());
 }