private void MoveNode(TreePanel source, TreePanel target)
        {
            List <SubmittedNode> selectedNodes = source.SelectedNodes;

            if (selectedNodes != null)
            {
                if (NodesAdding != null)
                {
                    var nodeIds = selectedNodes.Select(x => Convert.ToInt32(x.NodeID));
                    var args    = new NodesAddEventArgs();
                    args.NodeIds.AddRange(nodeIds);
                    NodesAdding(this, args);
                    if (args.CancelAdd)
                    {
                        Ext.Net.X.Msg.Alert("提示", args.ErrorMessage).Show();
                        return;
                    }
                }
                foreach (SubmittedNode node in selectedNodes)
                {
                    target.GetRootNode().InsertChild(0, node.ToProxyNode());
                    source.GetNodeById(node.NodeID).Remove();
                    if (target.ID.Contains("Right"))
                    {
                        //增加
                        this._selectedIds.Add(ConvertHelper.ToInt32(node.NodeID));
                    }
                    else
                    {
                        this._selectedIds.Remove(ConvertHelper.ToInt32(node.NodeID));
                    }
                }
            }
        }
Exemple #2
0
        public ActionResult Update(XinZhengQuYu entity)
        {
            if (ModelState.IsValid)
            {
                if (string.IsNullOrEmpty(entity.RecordType))
                {
                    entity.RecordType = RecordType.User.ToString();
                }

                entity.LastModifiedBy   = GetCurrentUserName();
                entity.LastModifiedDate = DateTime.Now;

                _service.UpdateXinZhengQuYu(entity);
                _service.Save();

                var window = this.GetCmp <Window>("windowXinZhengQuYu");
                window.Hide();

                TreePanel treePanel = this.GetCmp <TreePanel>("xinZhengQuYuTreePanel");
                treePanel.GetNodeById(entity.Id).ParentNode().Reload();

                return(this.Direct());
            }

            return(this.Direct());
        }
        public ActionResult UpdateStaff(SA_User entity)
        {
            if (ModelState.IsValid)
            {
                entity.LastModifiedBy   = GetCurrentUserName();
                entity.LastModifiedDate = DateTime.Now;
                var org = new SA_Organization();
                entity.Account  = entity.Name;
                org             = _service.GetOrgContainsId(entity.Id);
                org.Name        = entity.Name;
                org.Description = entity.Name;
                org.Code        = entity.Name;
                _service.UpdateOrganization(org);
                _service.UpdateUser(entity);
                _service.Save();

                var window = this.GetCmp <Window>("windowSA_User");
                window.Hide();

                TreePanel treePanel = this.GetCmp <TreePanel>("treePanelSAOrganization");
                treePanel.GetNodeById(entity.MainOrgId).Reload();
                return(this.Direct());
            }

            return(this.Direct());
        }
        public ActionResult Insert(SA_Organization entity)
        {
            if (ModelState.IsValid)
            {
                entity.CreatedBy   = GetCurrentUserName();
                entity.CreatedDate = DateTime.Now;

                _service.AddOrganization(entity);
                _service.Save();

                this.GetCmp <Window>("windowSA_Organization").Hide();

                TreePanel treePanel = this.GetCmp <TreePanel>("treePanelSAOrganization");
                treePanel.GetNodeById(entity.ParentId).Reload();

                return(this.Direct());
            }
            return(this.Direct());
        }
        public ActionResult Delete(string id)
        {
            string parentId = _service.GetOrgById(id).ParentId;

            if (string.IsNullOrEmpty(id))
            {
                return(this.Direct());
            }

            _service.DeleteOrganization(id);
            _service.DeleteUser(id);
            _service.Save();

            //this.GetCmp<TreeStore>("storeSAOrganization").Reload();
            TreePanel treePanel = this.GetCmp <TreePanel>("treePanelSAOrganization");

            treePanel.GetNodeById(parentId).Reload();
            return(this.Direct());
        }
        public ActionResult UpdatePosition(SA_Organization entity)
        {
            if (ModelState.IsValid)
            {
                entity.LastModifiedBy   = GetCurrentUserName();
                entity.LastModifiedDate = DateTime.Now;

                _service.UpdateOrganization(entity);
                _service.Save();

                var window = this.GetCmp <Window>("windowSA_Organization");
                window.Hide();

                TreePanel treePanel = this.GetCmp <TreePanel>("treePanelSAOrganization");
                treePanel.GetNodeById(entity.ParentId).Reload();
                return(this.Direct());
            }

            return(this.Direct());
        }
 public void RemoveLeftNode(string nodeId)
 {
     _treePanelLeft.GetNodeById(nodeId).Remove();
 }