internal AssociationContainedInExtent(ExtentFiltered extent, IAssociationType association, Allors.Extent inExtent)
 {
     extent.CheckAssociation(association);
     PredicateAssertions.AssertAssociationContainedIn(association, inExtent);
     this.association = association;
     this.inExtent = ((Extent)inExtent).ContainedInExtent;
 }
Пример #2
0
        protected override void AppsSecure(Security config)
        {
            base.AppsSecure(config);

            var full = new[] { Operations.Read, Operations.Write, Operations.Execute };

            config.GrantAdministrator(this.ObjectType, full);

            var created = new SalesOrderItemObjectStates(Session).Created;
            var partiallyShipped = new SalesOrderItemObjectStates(Session).PartiallyShipped;
            var shipped = new SalesOrderItemObjectStates(Session).Shipped;
            var inProcess = new SalesOrderItemObjectStates(Session).InProcess;
            var cancelled = new SalesOrderItemObjectStates(Session).Cancelled;
            var rejected = new SalesOrderItemObjectStates(Session).Rejected;
            var completed = new SalesOrderItemObjectStates(Session).Completed;
            var finished = new SalesOrderItemObjectStates(Session).Finished;

            var product = Meta.Product;
            config.Deny(this.ObjectType, shipped, product);
            config.Deny(this.ObjectType, partiallyShipped, product);

            var cancel = Meta.Cancel;
            var reject = Meta.Reject;
            var delete = Meta.Delete;

            config.Deny(this.ObjectType, created, cancel, reject);
            config.Deny(this.ObjectType, partiallyShipped, delete, cancel, reject);
            config.Deny(this.ObjectType, shipped, delete, cancel, reject);
            config.Deny(this.ObjectType, inProcess, delete);

            config.Deny(this.ObjectType, cancelled, Operation.Execute, Operations.Write);
            config.Deny(this.ObjectType, rejected, Operation.Execute, Operations.Write);
            config.Deny(this.ObjectType, completed, Operation.Execute, Operations.Write);
            config.Deny(this.ObjectType, finished, Operation.Execute, Operations.Write);
        }
Пример #3
0
 internal RoleContainedInExtent(ExtentFiltered extent, IRoleType role, Allors.Extent inExtent)
 {
     extent.CheckRole(role);
     PredicateAssertions.ValidateRoleContainedIn(role, inExtent);
     this.role = role;
     this.inExtent = ((Extent)inExtent).ContainedInExtent;
 }
Пример #4
0
 public AllorsPredicateRoleInExtentSql(AllorsExtentFilteredSql extent, IRoleType role, Allors.Extent inExtent)
 {
     extent.CheckRole(role);
     PredicateAssertions.ValidateRoleContainedIn(role, inExtent);
     this.role = role;
     this.inExtent = (AllorsExtentSql)inExtent;
 }
Пример #5
0
        protected override void BaseSecure(Security config)
        {
            base.BaseSecure(config);

            var full = new[] { Operation.Read, Operation.Write, Operation.Execute };

            config.GrantAdministrator(this.ObjectType, full);
        }
        internal AssociationContainedInExtent(ExtentFiltered extent, IAssociationType associationType, Allors.Extent containingExtent)
        {
            extent.CheckForAssociationType(associationType);
            PredicateAssertions.AssertAssociationContainedIn(associationType, containingExtent);

            this.associationType = associationType;
            this.containingExtent = containingExtent;
        }
Пример #7
0
        internal RoleOneContainedInExtent(ExtentFiltered extent, IRoleType roleType, Allors.Extent containingExtent)
        {
            extent.CheckForRoleType(roleType);
            PredicateAssertions.ValidateRoleContainedIn(roleType, containingExtent);

            this.roleType = roleType;
            this.containingExtent = containingExtent;
        }
Пример #8
0
        protected override void TestSetup(Allors.Setup setup)
        {
            base.TestSetup(setup);

            this.Instance.PersonTemplate = new StringTemplateBuilder(this.Session).WithUniqueId(PersonTemplateId)
                                                   .WithName("Person Derivation")
                                                   .WithLocale(new Locales(this.Session).DutchBelgium)
                                                   .WithBody(@"main(this) ::= <<
            Hello $this.UserName$!
            >>")
                                                   .Build();
        }
Пример #9
0
        public ICompositePredicate AddContainedIn(IRoleType role, Allors.Extent containingExtent)
        {
            this.CheckUnarity();
            if (role.IsMany)
            {
                this.predicate = new RoleManyContainedInExtent(this.extent, role, containingExtent);
            }
            else
            {
                this.predicate = new RoleOneContainedInExtent(this.extent, role, containingExtent);
            }

            this.extent.Invalidate();
            return this;
        }
Пример #10
0
        protected override void AppsSecure(Security config)
        {
            base.AppsSecure(config);

            var full = new[] { Operations.Read, Operations.Write, Operations.Execute };

            config.GrantAdministrator(this.ObjectType, full);

            ObjectState paid = new SalesInvoiceItemObjectStates(Session).Paid;
            ObjectState writtenOff = new SalesInvoiceItemObjectStates(Session).WrittenOff;
            ObjectState cancelled = new SalesInvoiceItemObjectStates(Session).Cancelled;

            config.Deny(this.ObjectType, paid, Operations.Write, Operation.Execute);
            config.Deny(this.ObjectType, writtenOff, Operations.Write, Operation.Execute);
            config.Deny(this.ObjectType, cancelled, Operations.Write, Operation.Execute);
        }
Пример #11
0
 public ICompositePredicate AddContainedIn(IAssociationType association, Allors.Extent containingExtent)
 {
     this.Extent.FlushCache();
     this.Filters.Add(new AssociationContainedInExtent(this.Extent, association, containingExtent));
     return this;
 }
Пример #12
0
 public ICompositePredicate AddContainedIn(IRoleType role, Allors.Extent containingExtent)
 {
     this.Extent.FlushCache();
     this.Filters.Add(new RoleContainedInExtent(this.Extent, role, containingExtent));
     return this;
 }
Пример #13
0
 public ICompositePredicate AddContainedIn(IAssociationType association, Allors.Extent containingExtent)
 {
     this.CheckUnarity();
     this.predicate = new AssociationContainedInExtent(this.extent, association, containingExtent);
     this.extent.Invalidate();
     return this;
 }
Пример #14
0
        private void CreateNegativePickList(IDerivation derivation, CustomerShipment shipment, Allors.Domain.SalesOrderItem orderItem, decimal quantity)
        {
            if (this.ExistShipToParty)
            {
                var pickList = new PickListBuilder(this.Strategy.Session)
                    .WithCustomerShipmentCorrection(shipment)
                    .WithShipToParty(this.ShipToParty)
                    .WithStore(this.Store)
                    .Build();

                pickList.AddPickListItem(new PickListItemBuilder(this.Strategy.Session)
                                        .WithInventoryItem(orderItem.ReservedFromInventoryItem)
                                        .WithRequestedQuantity(0 - quantity)
                                        .Build());
            }
        }
Пример #15
0
 public ICompositePredicate AddContainedIn(IAssociationType association, Allors.Extent containingExtent)
 {
     this.CheckUnarity();
     this.extent.FlushCache();
     this.filter = new AssociationContainedInExtent(this.extent, association, containingExtent);
     return this;
 }
Пример #16
0
 public ICompositePredicate AddContainedIn(IRoleType role, Allors.Extent containingExtent)
 {
     this.CheckUnarity();
     this.extent.FlushCache();
     this.filter = new RoleContainedInExtent(this.extent, role, containingExtent);
     return this;
 }
Пример #17
0
        public void AppsOnDeriveQuantityDecreased(IDerivation derivation, ShipmentItem shipmentItem, Allors.Domain.SalesOrderItem orderItem, decimal correction)
        {
            var remainingCorrection = correction;

            foreach (OrderShipment orderShipment in shipmentItem.OrderShipmentsWhereShipmentItem)
            {
                if (orderShipment.SalesOrderItem.Equals(orderItem) && remainingCorrection > 0)
                {
                    decimal quantity;
                    if (orderShipment.Quantity < remainingCorrection)
                    {
                        quantity = orderShipment.Quantity;
                        remainingCorrection -= quantity;
                    }
                    else
                    {
                        quantity = remainingCorrection;
                        remainingCorrection = 0;
                    }

                    orderShipment.Quantity -= quantity;
                    shipmentItem.Quantity -= quantity;

                    var itemIssuanceCorrection = quantity;
                    foreach (ItemIssuance itemIssuance in shipmentItem.ItemIssuancesWhereShipmentItem)
                    {
                        if (!itemIssuance.PickListItem.PickListWherePickListItem.ExistPicker)
                        {
                            decimal subQuantity;
                            if (itemIssuance.Quantity < itemIssuanceCorrection)
                            {
                                subQuantity = itemIssuance.Quantity;
                                itemIssuanceCorrection -= quantity;
                            }
                            else
                            {
                                subQuantity = itemIssuanceCorrection;
                                itemIssuanceCorrection = 0;
                            }

                            itemIssuance.Quantity -= subQuantity;

                            if (itemIssuanceCorrection == 0)
                            {
                                break;
                            }
                        }
                    }

                    if (orderShipment.Quantity == 0)
                    {
                        foreach (ItemIssuance itemIssuance in orderShipment.ShipmentItem.ItemIssuancesWhereShipmentItem)
                        {
                            if (!itemIssuance.PickListItem.PickListWherePickListItem.ExistPicker)
                            {
                                itemIssuance.Delete();
                            }
                        }

                        orderShipment.Delete();
                    }
                }
            }

            if (this.PendingPickList == null)
            {
                var shipment = (CustomerShipment)shipmentItem.ShipmentWhereShipmentItem;
                this.CreateNegativePickList(derivation, shipment, orderItem, correction);
            }

            if (shipmentItem.Quantity == 0)
            {
                shipmentItem.Delete();
            }

            if (!this.ExistShipmentItems)
            {
                this.Cancel();

                if (this.PendingPickList != null)
                {
                    this.PendingPickList.Cancel();
                }
            }
        }
Пример #18
0
        public virtual void SetCompositeRoles(IRoleType roleType, Allors.Extent roleObjects)
        {
            if (roleObjects == null || roleObjects.Count == 0)
            {
                this.RemoveCompositeRoles(roleType);
            }
            else
            {
                this.AssertExist();

                // TODO: use CompositeRoles
                var previousRoles = new List<ObjectId>(this.Roles.GetCompositesRole(roleType));
                var newRoles = new HashSet<ObjectId>();

                foreach (IObject roleObject in roleObjects)
                {
                    if (roleObject != null)
                    {
                        RoleAssertions.CompositeRolesChecks(this, roleType, roleObject);
                        var role = (Strategy)roleObject.Strategy;

                        if (!previousRoles.Contains(role.ObjectId))
                        {
                            this.Roles.AddCompositeRole(roleType, role);
                        }

                        newRoles.Add(role.ObjectId);
                    }
                }

                foreach (var previousRole in previousRoles)
                {
                    if (!newRoles.Contains(previousRole))
                    {
                        this.Roles.RemoveCompositeRole(roleType, this.Session.GetOrCreateReferenceForExistingObject(previousRole).Strategy);
                    }
                }
            }
        }