コード例 #1
0
 public WorkOrder CreateNewWorkOrder(Product product)
 {
     var wo = NewTransientInstance<WorkOrder>();
     wo.Product = product;
     //MakePersistent();
     return wo;
 }
コード例 #2
0
 public IQueryable<PurchaseOrderHeader> OpenPurchaseOrdersForProduct(Product product)
 {
     return from obj in Instances<PurchaseOrderDetail>()
                                             where obj.Product.ProductID == product.ProductID &&
                                                   obj.PurchaseOrderHeader.Status <= 2
                                             select obj.PurchaseOrderHeader;
 }
コード例 #3
0
 public IQueryable<WorkOrder> WorkOrders(Product product, bool currentOrdersOnly)
 {
     return from obj in Instances<WorkOrder>()
                                   where obj.Product.ProductID == product.ProductID &&
                                         (currentOrdersOnly == false || obj.EndDate == null)
                                   select obj;
 }
コード例 #4
0
 public IQueryable<ShoppingCartItem> AddToShoppingCart(Product product) {
     string id = GetShoppingCartIDForUser();
     var item = NewTransientInstance<ShoppingCartItem>();
     item.ShoppingCartID = id;
     item.Product = product;
     item.Quantity = 1;
     item.DateCreated = DateTime.Now;
     Persist(ref item);
     InformUser("1 x " + product.Name + " added to Cart");
     return Cart();
 }
コード例 #5
0
        public SpecialOfferProduct AssociateSpecialOfferWithProduct(SpecialOffer offer, Product product) {
            //First check if association already exists
            IQueryable<SpecialOfferProduct> query = from sop in Instances<SpecialOfferProduct>()
                                                    where sop.SpecialOfferID == offer.SpecialOfferID &&
                                                          sop.ProductID == product.ProductID
                                                    select sop;

            if (query.Count() != 0) {
                var t = new TitleBuilder();
                t.Append(offer).Append(" is already associated with").Append(product);
                WarnUser(t.ToString());
                return null;
            }
            var newSop = NewTransientInstance<SpecialOfferProduct>();
            newSop.SpecialOffer = offer;
            newSop.Product = product;
            //product.SpecialOfferProduct.Add(newSop);
            Persist(ref newSop);
            return newSop;
        }
コード例 #6
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;
        }
コード例 #7
0
 public void AddToCart(Product product) {
     ShoppingCartRepository.AddToShoppingCart(product);
 }
コード例 #8
0
 public PurchaseOrderDetail AddNewDetail(Product prod, short qty) {
     var pod = Container.NewTransientInstance<PurchaseOrderDetail>();
     pod.PurchaseOrderHeader = this;
     pod.Product = prod;
     pod.OrderQty = qty;
     return pod;
 }
コード例 #9
0
 public WorkOrder CreateNewWorkOrder2(Product product) {
     return CreateNewWorkOrder(product);
 }
コード例 #10
0
 public Product FindProduct(Product product) {
     return product;
 }
        // for autoautocomplete testing
        public IQueryable<PurchaseOrderHeader> OpenPurchaseOrdersForVendorAndProduct(Vendor vendor, Product product)
        {

            return from obj in Instances<PurchaseOrderDetail>()
                   where obj.Product.ProductID == product.ProductID &&
                         obj.PurchaseOrderHeader.Status <= 2 &&
                         obj.PurchaseOrderHeader.Vendor.BusinessEntityID == vendor.BusinessEntityID
                   select obj.PurchaseOrderHeader;
        }
コード例 #12
0
 private bool FilterProduct(Product entity)
 {
     return (entity.ProductID == this.ProductID);
 }
コード例 #13
0
 /// <summary>
 /// Create a new Product object.
 /// </summary>
 /// <param name="productID">Initial value of the ProductID property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="productNumber">Initial value of the ProductNumber property.</param>
 /// <param name="makeFlag">Initial value of the MakeFlag property.</param>
 /// <param name="finishedGoodsFlag">Initial value of the FinishedGoodsFlag property.</param>
 /// <param name="safetyStockLevel">Initial value of the SafetyStockLevel property.</param>
 /// <param name="reorderPoint">Initial value of the ReorderPoint property.</param>
 /// <param name="standardCost">Initial value of the StandardCost property.</param>
 /// <param name="listPrice">Initial value of the ListPrice property.</param>
 /// <param name="daysToManufacture">Initial value of the DaysToManufacture property.</param>
 /// <param name="sellStartDate">Initial value of the SellStartDate property.</param>
 /// <param name="rowguid">Initial value of the rowguid property.</param>
 /// <param name="modifiedDate">Initial value of the ModifiedDate property.</param>
 public static Product CreateProduct(global::System.Int32 productID, global::System.String name, global::System.String productNumber, global::System.Boolean makeFlag, global::System.Boolean finishedGoodsFlag, global::System.Int16 safetyStockLevel, global::System.Int16 reorderPoint, global::System.Decimal standardCost, global::System.Decimal listPrice, global::System.Int32 daysToManufacture, global::System.DateTime sellStartDate, global::System.Guid rowguid, global::System.DateTime modifiedDate)
 {
     Product product = new Product();
     product.ProductID = productID;
     product.Name = name;
     product.ProductNumber = productNumber;
     product.MakeFlag = makeFlag;
     product.FinishedGoodsFlag = finishedGoodsFlag;
     product.SafetyStockLevel = safetyStockLevel;
     product.ReorderPoint = reorderPoint;
     product.StandardCost = standardCost;
     product.ListPrice = listPrice;
     product.DaysToManufacture = daysToManufacture;
     product.SellStartDate = sellStartDate;
     product.rowguid = rowguid;
     product.ModifiedDate = modifiedDate;
     return product;
 }
コード例 #14
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProducts(Product product)
 {
     base.AddObject("Products", product);
 }
コード例 #15
0
 public void AddNewDetails(Product prod, short qty, decimal unitPrice)
 {
     var det = AddNewDetail(prod, qty);
     det.UnitPrice = unitPrice;
     det.DueDate = DateTime.Today.AddDays(7);
     det.ReceivedQty = 0;
     det.RejectedQty = 0;
     Container.Persist(ref det);
 }
コード例 #16
0
#pragma warning restore 612,618
        public void AddNewDetails(Product product,
                                     [DefaultValue((short)1)] short quantity)
        {
            var detail = AddNewDetail(product, quantity);
            Container.Persist(ref detail);
        }