当前位置: 首页>>代码示例>>C#>>正文


C# SalesOrderItemBuilder.Cancel方法代码示例

本文整理汇总了C#中SalesOrderItemBuilder.Cancel方法的典型用法代码示例。如果您正苦于以下问题:C# SalesOrderItemBuilder.Cancel方法的具体用法?C# SalesOrderItemBuilder.Cancel怎么用?C# SalesOrderItemBuilder.Cancel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SalesOrderItemBuilder的用法示例。


在下文中一共展示了SalesOrderItemBuilder.Cancel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InventoryItemVarianceBuilder

        public void GivenOrderItemWithPendingShipmentAndAssignedPickList_WhenOrderItemIsCancelled_ThenNegativePickListIsCreatedAndShipmentItemIsDeleted()
        {
            this.InstantiateObjects(this.DatabaseSession);

            var inventoryItem = (NonSerializedInventoryItem)this.part.InventoryItemsWherePart.First;
            inventoryItem.AddInventoryItemVariance(new InventoryItemVarianceBuilder(this.DatabaseSession).WithQuantity(10).WithReason(new VarianceReasons(this.DatabaseSession).Unknown).Build());

            this.DatabaseSession.Derive(true);

            var item1 = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(this.good)
                .WithQuantityOrdered(3)
                .WithActualUnitPrice(5)
                .Build();

            var item2 = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(this.good)
                .WithQuantityOrdered(2)
                .WithActualUnitPrice(5)
                .Build();

            this.order.AddSalesOrderItem(item1);
            this.order.AddSalesOrderItem(item2);

            this.DatabaseSession.Derive(true);

            this.order.Confirm();

            this.DatabaseSession.Derive(true);

            var shipment = (CustomerShipment)this.order.ShipToCustomer.ShipmentsWhereShipToParty.First;
            Assert.AreEqual(5, shipment.ShipmentItems[0].Quantity);

            var pickList = shipment.ShipmentItems[0].ItemIssuancesWhereShipmentItem[0].PickListItem.PickListWherePickListItem;
            Assert.AreEqual(5, pickList.PickListItems[0].RequestedQuantity);

            pickList.Picker = new Persons(this.DatabaseSession).FindBy(Persons.Meta.LastName, "orderProcessor");

            this.DatabaseSession.Derive(true);

            item1.Cancel();

            this.DatabaseSession.Derive(true);

            var negativePickList = this.order.ShipToCustomer.PickListsWhereShipToParty[1];

            Assert.AreEqual(1, shipment.ShipmentItems.Count);
            Assert.AreEqual(2, shipment.ShipmentItems[0].Quantity);
            Assert.AreEqual(5, pickList.PickListItems[0].RequestedQuantity);
            Assert.AreEqual(-3, negativePickList.PickListItems[0].RequestedQuantity);
        }
开发者ID:Allors,项目名称:apps,代码行数:51,代码来源:SalesOrderItemTests.cs

示例2: SalesOrderItemBuilder

        public void GivenConfirmedOrderItemForGood_WhenOrderItemIsCancelled_ThenNonSerializedInventoryQuantitiesAreReleased()
        {
            this.InstantiateObjects(this.DatabaseSession);

            var item = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(this.good)
                .WithQuantityOrdered(3)
                .WithActualUnitPrice(5)
                .Build();

            this.order.AddSalesOrderItem(item);

            this.DatabaseSession.Derive(true);

            this.order.Confirm();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(item.QuantityOrdered, item.ReservedFromInventoryItem.QuantityCommittedOut);
            Assert.AreEqual(0, item.ReservedFromInventoryItem.AvailableToPromise);

            var previous = item.ReservedFromInventoryItem;

            this.DatabaseSession.Derive(true);

            item.Cancel();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(0, previous.QuantityCommittedOut);
            Assert.AreEqual(0, previous.AvailableToPromise);
        }
开发者ID:Allors,项目名称:apps,代码行数:32,代码来源:SalesOrderItemTests.cs

示例3: GivenOrderItem_WhenObjectStateIsCancelled_ThenItemMayNotBeCancelledOrRejectedOrDeleted

        public void GivenOrderItem_WhenObjectStateIsCancelled_ThenItemMayNotBeCancelledOrRejectedOrDeleted()
        {
            var administrator = new PersonBuilder(this.DatabaseSession).WithFirstName("Koen").WithUserName("admin").Build();
            var administrators = new UserGroups(this.DatabaseSession).Administrators;
            administrators.AddMember(administrator);

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();

            this.InstantiateObjects(this.DatabaseSession);

            Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("admin", "Forms"), new string[0]);

            var item = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(this.good)
                .WithQuantityOrdered(3)
                .WithActualUnitPrice(5)
                .Build();

            this.order.AddSalesOrderItem(item);

            this.DatabaseSession.Derive(true);

            item.Cancel();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(new SalesOrderItemObjectStates(this.DatabaseSession).Cancelled, item.CurrentObjectState);
            var acl = new AccessControlList(item, new Users(this.DatabaseSession).GetCurrentUser());
            Assert.IsFalse(acl.CanExecute(SalesOrderItems.Meta.Cancel));
            Assert.IsFalse(acl.CanExecute(SalesOrderItems.Meta.Reject));
            Assert.IsFalse(acl.CanExecute(SalesOrderItems.Meta.Delete));
        }
开发者ID:Allors,项目名称:apps,代码行数:33,代码来源:SalesOrderItemTests.cs

示例4: GivenSalesOrder_WhenConfirming_ThenAllValidItemsAreInConfirmedState

        public void GivenSalesOrder_WhenConfirming_ThenAllValidItemsAreInConfirmedState()
        {
            var billToCustomer = new PersonBuilder(this.DatabaseSession).WithLastName("person1").Build();
            var shipToCustomer = new PersonBuilder(this.DatabaseSession).WithLastName("person2").Build();
            var internalOrganisation = Singleton.Instance(this.DatabaseSession).DefaultInternalOrganisation;

            new CustomerRelationshipBuilder(this.DatabaseSession).WithFromDate(DateTime.UtcNow).WithCustomer(billToCustomer).WithInternalOrganisation(internalOrganisation).Build();
            new CustomerRelationshipBuilder(this.DatabaseSession).WithFromDate(DateTime.UtcNow).WithCustomer(shipToCustomer).WithInternalOrganisation(internalOrganisation).Build();

            var mechelen = new CityBuilder(this.DatabaseSession).WithName("Mechelen").Build();
            var shipToContactMechanism = new PostalAddressBuilder(this.DatabaseSession).WithGeographicBoundary(mechelen).WithAddress1("Haverwerf 15").Build();

            var vatRate21 = new VatRateBuilder(this.DatabaseSession).WithRate(21).Build();
            var part1 = new FinishedGoodBuilder(this.DatabaseSession).WithName("part1").Build();
            var part2 = new FinishedGoodBuilder(this.DatabaseSession).WithName("part2").Build();

            var good1 = new GoodBuilder(this.DatabaseSession)
                .WithSku("10101")
                .WithVatRate(vatRate21)
                .WithName("good1")
                .WithFinishedGood(part1)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            var good2 = new GoodBuilder(this.DatabaseSession)
                .WithSku("10102")
                .WithVatRate(vatRate21)
                .WithName("good1")
                .WithFinishedGood(part2)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            this.DatabaseSession.Derive(true);

            var order = new SalesOrderBuilder(this.DatabaseSession)
                .WithBillToCustomer(billToCustomer)
                .WithShipToCustomer(shipToCustomer)
                .WithShipToAddress(shipToContactMechanism)
                .Build();

            var item1 = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(good1).WithQuantityOrdered(1).WithActualUnitPrice(15).Build();
            var item2 = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(good1).WithQuantityOrdered(2).WithActualUnitPrice(15).Build();
            var item3 = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(good2).WithQuantityOrdered(3).WithActualUnitPrice(15).Build();
            var item4 = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(good2).WithQuantityOrdered(4).WithActualUnitPrice(15).Build();
            order.AddSalesOrderItem(item1);
            order.AddSalesOrderItem(item2);
            order.AddSalesOrderItem(item3);
            order.AddSalesOrderItem(item4);

            order.Confirm();

            this.DatabaseSession.Derive(true);

            item4.Cancel();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(3, order.ValidOrderItems.Count);
            Assert.Contains(item1, order.ValidOrderItems);
            Assert.Contains(item2, order.ValidOrderItems);
            Assert.Contains(item3, order.ValidOrderItems);
            Assert.AreEqual(new SalesOrderItemObjectStates(this.DatabaseSession).InProcess, item1.CurrentObjectState);
            Assert.AreEqual(new SalesOrderItemObjectStates(this.DatabaseSession).InProcess, item2.CurrentObjectState);
            Assert.AreEqual(new SalesOrderItemObjectStates(this.DatabaseSession).InProcess, item3.CurrentObjectState);
            Assert.AreEqual(new SalesOrderItemObjectStates(this.DatabaseSession).Cancelled, item4.CurrentObjectState);
        }
开发者ID:Allors,项目名称:apps,代码行数:66,代码来源:SalesOrderTests.cs


注:本文中的SalesOrderItemBuilder.Cancel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。