//public Tuple<string, PurchaseItem> GetProductTypeRef(long purchaseItemID) //{ // //Will check the TagNo of ProductType, but to get it, must first Get the full info of one PurchaseItem. // PurchaseItem purchaseItem = repositoryPurchaseItem.FindById(purchaseItemID); // string tagRef = purchaseItem.Product.ProductType.TagNo; // return new Tuple<string, PurchaseItem>(tagRef, purchaseItem); //} public List <Asset> CreateAssetsWithPurchaseItem(long purchaseItemID, int qtyAdd) { //Inicialize new List of assets List <Asset> assets = new List <Asset>(); //Receive the PurchaseItemID from view PurchaseItem/Create //and get data from the database var purchaseItem = repositoryPurchaseItem.FindById(purchaseItemID); long getStatusID = repositoryStatus.FindAssetFirstOnStockID(); //Create one Asset for each PurchaseQty and add in the List Assets for (int i = 0; i < qtyAdd; i++) { Asset asset = new Asset(); asset.PurchaseItemID = purchaseItemID; asset.StatusID = getStatusID; asset.DeliveryDate = purchaseItem.DeliveryDate; asset.WarningPeriodID = purchaseItem.Product.ProductType.WarningPeriodID.Value; assets.Add(asset); } return(assets); }
public List <License> CreateLicensesWithPurchaseItem(long purchaseItemID, int qtyAdd) { //Inicialize new List of licenses List <License> licenses = new List <License>(); //Receive the PurchaseItemID from view PurchaseItem/Create //and get data from the database var purchaseItem = repositoryPurchaseItem.FindById(purchaseItemID); long getStatusID = repositoryStatus.FindLicenseFirstOnStockID(); //Create one License for each PurchaseQty and add in the List Licenses for (int i = 0; i < qtyAdd; i++) { License license = new License(); license.PurchaseItemID = purchaseItemID; license.StatusID = getStatusID; licenses.Add(license); } return(licenses); }
public PurchaseItem FindById(long id) { return(repository.FindById(id)); }