/// <summary>
        /// Moves the method.
        /// </summary>
        /// <param name="context">The context.</param>
        protected virtual void Move(BusinessContext context)
        {
            MoveTreeNodeRequest request = (MoveTreeNodeRequest)context.Request;

            if (request.Target.PrimaryKeyId.Value != request.NewParent)
            {
                // Call SP mc_DirectoryOrganizationalUnit_Move
                SqlHelper.ExecuteNonQuery(SqlContext.Current, System.Data.CommandType.StoredProcedure,
                                          "mc_DirectoryOrganizationalUnit_Move",
                                          SqlHelper.SqlParameter("@NodeId", System.Data.SqlDbType.UniqueIdentifier, (Guid)request.Target.PrimaryKeyId.Value),
                                          SqlHelper.SqlParameter("@NewParentId", System.Data.SqlDbType.UniqueIdentifier, (Guid)request.NewParent));

                // TODO: Rebuild USER_GROUP
            }
        }
Exemplo n.º 2
0
        public void Invoke(object Sender, object Element)
        {
            if (Element is CommandParameters)
            {
                CommandParameters cp = (CommandParameters)Element;

                PrimaryKeyId targetId = PrimaryKeyId.Parse(cp.CommandArguments["TreeServiceTargetObjectId"]);
                PrimaryKeyId newId = PrimaryKeyId.Parse(cp.CommandArguments["SelectedValue"].Split(new string[] {"::"}, StringSplitOptions.RemoveEmptyEntries)[0]);
                if(targetId != PrimaryKeyId.Empty && newId != PrimaryKeyId.Empty && newId != targetId)
                {
                    DirectoryOrganizationalUnitEntity obj = (DirectoryOrganizationalUnitEntity)BusinessManager.Load(DirectoryOrganizationalUnitEntity.ClassName, targetId);
                    MoveTreeNodeRequest req = new MoveTreeNodeRequest(obj);
                    req.NewParent = newId;
                    BusinessManager.Execute(req);
                }
                CHelper.RequireBindGrid();
            }
        }