コード例 #1
0
        public SalesOrderDetail AddNewDetail(Product product,
                                             [DefaultValue((short)1), Range(1, 999)] short quantity)
        {
            int stock = product.NumberInStock();

            if (stock < quantity)
            {
                var t = Container.NewTitleBuilder();
                t.Append("Current inventory of").Append(product).Append(" is").Append(stock);
                Container.WarnUser(t.ToString());
            }
            var sod = Container.NewTransientInstance <SalesOrderDetail>();

            sod.SalesOrderHeader    = this;
            sod.SalesOrderID        = SalesOrderID;
            sod.OrderQty            = quantity;
            sod.SpecialOfferProduct = product.BestSpecialOfferProduct(quantity);
            sod.Recalculate();

            return(sod);
        }
コード例 #2
0
        public SalesOrderDetail AddNewDetail(Product product,
                                             [DefaultValue((short) 1), Range(1, 999)] short quantity) {
            int stock = product.NumberInStock();
            if (stock < quantity) {
                var t = Container.NewTitleBuilder();
                t.Append("Current inventory of").Append(product).Append(" is").Append(stock);
                Container.WarnUser(t.ToString());
            }
            var sod = Container.NewTransientInstance<SalesOrderDetail>();
            sod.SalesOrderHeader = this;
            sod.SalesOrderID = SalesOrderID;
            sod.OrderQty = quantity;
            sod.SpecialOfferProduct = product.BestSpecialOfferProduct(quantity);
            sod.Recalculate();

            return sod;
        }