Exemple #1
0
        public virtual void Remove()
        {
            KategoriaTreeNode node = (KategoriaTreeNode)SelectedNode;

            if (node != RootNode)
            {
                DialogResult result = MessageBox.Show("Czy napewno chcesz usunąć kategorię?", "EnovaTools", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.Yes)
                {
                    ((IDeleteRecord)node.Kategoria).DeleteRecord();
                    TreeNode parent = node.Parent;
                    parent.Nodes.Remove(node);
                    treeView.SelectedNode = parent;
                }
            }
        }
Exemple #2
0
        private bool selectCategory(KategoriaTreeNode node, Enova.Business.Old.DB.Web.KategoriaOld kategoria)
        {
            if (node.Kategoria.ID == kategoria.ID)
            {
                kategorieTreeView.SelectedNode = node;
                return(true);
            }

            foreach (var child in node.Nodes)
            {
                if (selectCategory((KategoriaTreeNode)child, kategoria))
                {
                    return(true);
                }
            }
            return(false);
        }
Exemple #3
0
        public void Add(KategoriaOld kategoria)
        {
            KategoriaTreeNode node = (KategoriaTreeNode)SelectedNode;

            if (node == null)
            {
                node = RootNode;
            }

            if (node != null)
            {
                kategoria.PoziomGlebokosci = (byte)(node.Kategoria.PoziomGlebokosci + 1);
                kategoria.Wlasciciel       = node.Kategoria;
                KategoriaTreeNode newNode = new KategoriaTreeNode(kategoria);
                node.Nodes.Add(newNode);
                treeView.SelectedNode = newNode;
            }
        }
Exemple #4
0
 protected override void LoadData()
 {
     if (!towaryIsLoaded)
     {
         var t = new Enova.Business.Old.Web.TowaryEnova(Enova.Business.Old.Core.ContextManager.WebContext);
         KategoriaTreeNode node = (KategoriaTreeNode)kategorieTreeView.SelectedNode;
         if (node != null && node.Kategoria.GUID != EnovaKatGuid)
         {
             t.Kategoria = node.Kategoria;
         }
         //this.DataSource = new Enova.Business.Old.Web.TowaryEnova(node.Kategoria);
         else
         {
             t.Kategoria = null;
         }
         //this.DataSource = new Enova.Business.Old.Web.TowaryEnova(Enova.Business.Old.Core.ContextManager.WebContext);
         this.DataSource = t;
         this.DataGrid.Sort(DataGrid.Columns[0], ListSortDirection.Ascending);
         towaryIsLoaded = true;
     }
 }