/// <summary> /// Creates a new material batch. /// </summary> /// <param name="material">The material the batch is composed of..</param> /// <param name="expirationDate">The expiration date of the material.</param> /// <param name="storageLocation">The storage location of the material.</param> /// <param name="batchNumber">The manufacturer provided batch number.</param> /// <param name="quantity">The quantity of the batch.</param> /// <param name="customProps">The custom prop values for this batch.</param> /// <param name="isLocked">Whether the batch should be locked.</param> /// <param name="userId">The ID of the user checking in the new batch..</param> /// <returns>Returns the newly created batch.</returns> public MaterialBatch CreateMaterialBatch(Material material, DateTime expirationDate, StorageLocation storageLocation, long batchNumber, double quantity, Dictionary <Guid, string> customProps, bool isLocked, string userId) { // Create batch MaterialBatch batch = MaterialBatchRepository.CreateMaterialBatch(material, expirationDate, storageLocation, batchNumber, quantity, customProps, isLocked); // Log transaction Transaction transaction = new Transaction() { Id = Guid.NewGuid(), MaterialBatchId = batch.Id, Quantity = batch.Quantity, Timestamp = DateTime.UtcNow, UserId = userId }; TransactionLogService.LogTransaction(transaction); // Done - return newly create batch! return(batch); }