public PendingDeliveryItem CreatePending(Guid id, Guid jobItemId, Guid customerId, string notes) { if (!CurrentUser.HasRole(UserRole.Member)) { throw new DomainValidationException(DeliveryItemMessages.InsufficientSecurityClearance, "CurrentUser"); } if (id == Guid.Empty) { throw new ArgumentException("An ID must be supplied for the pending item."); } var pendingItem = new PendingDeliveryItem(); pendingItem.Id = id; pendingItem.JobItem = GetJobItem(jobItemId); if (_quoteItemRepository.JobItemHasPendingQuoteItem(jobItemId)) { throw new DomainValidationException(DeliveryItemMessages.PendingItemExists, "JobItemId"); } pendingItem.Customer = GetCustomer(customerId); pendingItem.QuoteItem = GetQuoteItem(jobItemId); pendingItem.Notes = notes; ValidateAnnotatedObjectThrowOnFailure(pendingItem); _deliveryItemRepository.CreatePending(pendingItem); return(pendingItem); }
private void CreatePending(Guid id, Guid customerId, Guid jobItemId, string notes) { try { _savedPendingItem = _deliveryItemService.CreatePending(id, jobItemId, customerId, notes); } catch (DomainValidationException dex) { _domainValidationException = dex; } }
public void Setup() { _userContext = TestUserContext.Create("*****@*****.**", "Graham Robertson", "Operations Manager", UserRole.Manager | UserRole.Member); _domainValidationException = null; _savedPendingItem = null; _savedDeliveryItem = null; _jobItemService = null; _deliveryItemService = null; _jobItemToUpdateId = Guid.NewGuid(); _jobItemToUpdate = new JobItem { Id = _jobItemToUpdateId, Job = new Job { Id = Guid.NewGuid(), JobNo = "JR2000", CreatedBy = _userContext.GetCurrentUser(), OrderNo = "ORDER12345", DateCreated = DateTime.UtcNow, Customer = new Customer { Id = Guid.NewGuid(), Name = "Gael Ltd" } }, ItemNo = 1, SerialNo = "12345", Instrument = new Instrument { Id = Guid.NewGuid(), Manufacturer = "Druck", ModelNo = "DPI601IS", Range = "None", Description = "Digital Pressure Indicator" }, CalPeriod = 12, Created = DateTime.UtcNow, CreatedUser = _userContext.GetCurrentUser(), }; _deliveryItemForEditId = Guid.NewGuid(); _deliveryItemForEdit = new DeliveryItem { Id = _deliveryItemForEditId, Delivery = new Delivery { Id = Guid.NewGuid(), DeliveryNoteNumber = "DR2000", Customer = new Customer { Id = Guid.NewGuid(), Name = "Gael" } }, ItemNo = 1, }; }
public void UpdatePendingDeliveryItem(PendingDeliveryItem pendingItem) { CurrentSession.Update(pendingItem); }
public void CreatePending(PendingDeliveryItem pendingDeliveryItem) { CurrentSession.Save(pendingDeliveryItem); }