Example #1
0
        static void RegisterFactor_UserState(BizTransaction transaction, BzureUser user)
        {
            IEntityRequestProcess userStateProcessor = Actor.Public.BuildEntityProcessor("SecurityApp");
            TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>> userStateFactor = new TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>>(userStateProcessor);
            userStateFactor.ActionBody = (IEntityRequestProcess contract, EntityPostRequest request) =>
            {
                contract.UpdateEntity(request);
            };

            userStateFactor.Action = (Action<IEntityRequestProcess, EntityPostRequest> action) =>
            {
                EntityPostRequest OrderRequest = BuilderUserStateRequest(user);
                action(userStateProcessor, OrderRequest);
            };

            transaction.RegisterFactor(userStateFactor);
        }
Example #2
0
        static void RegisterFactor_DeleteDroits(BizTransaction transaction, string RoleID)
        {
            IEntityRequestProcess deleteRoleDroitsProcessor = Actor.Public.BuildEntityProcessor("SecurityApp");
            TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>> deleteRoleDroitsFactor = new TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>>(deleteRoleDroitsProcessor);
            deleteRoleDroitsFactor.ActionBody = (IEntityRequestProcess contract, EntityPostRequest request) =>
            {
                contract.UpdateEntity(request);
            };

            deleteRoleDroitsFactor.Action = (Action<IEntityRequestProcess, EntityPostRequest> action) =>
            {

                EntityPostRequest deleteRoleDroitRequest = BuilddeleteRoleDroitsRequest(RoleID);
                action(deleteRoleDroitsProcessor, deleteRoleDroitRequest);
            };

            transaction.RegisterFactor(deleteRoleDroitsFactor);
        }
Example #3
0
        static void RegisterFactor_AddNewDroits(BizTransaction transaction, string ResourceName, DroitResource[] droits)
        {
            IEntityRequestProcess addDroitsProcessor = Actor.Public.BuildEntityProcessor("SecurityApp");
            TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>> addDroitsFactor = new TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>>(addDroitsProcessor);
            addDroitsFactor.ActionBody = (IEntityRequestProcess contract, EntityPostRequest request) =>
            {
                contract.UpdateEntity(request);
            };

            addDroitsFactor.Action = (Action<IEntityRequestProcess, EntityPostRequest> action) =>
            {
                foreach (DroitResource droit in droits)
                {
                    EntityPostRequest addDroitRequest = BuildaddDroitRequest(ResourceName, droit);
                    action(addDroitsProcessor, addDroitRequest);
                }
            };

            transaction.RegisterFactor(addDroitsFactor);
        }
Example #4
0
        static void RegisterFactor_DeleteRoles(BizTransaction transaction, BzureUser user, string[] oldRoles)
        {
            IEntityRequestProcess deleteRolesProcessor = Actor.Public.BuildEntityProcessor("SecurityApp");
            TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>> deleteRolesFactor = new TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>>(deleteRolesProcessor);
            deleteRolesFactor.ActionBody = (IEntityRequestProcess contract, EntityPostRequest request) =>
            {
                contract.UpdateEntity(request);
            };

            deleteRolesFactor.Action = (Action<IEntityRequestProcess, EntityPostRequest> action) =>
            {
                foreach (string roleid in oldRoles)
                {
                    EntityPostRequest deleteRoleRequest = BuilddeleteRoleRequest(user.UserID.ToString(), roleid);
                    action(deleteRolesProcessor, deleteRoleRequest);
                }
            };

            transaction.RegisterFactor(deleteRolesFactor);
        }