/// <summary> /// Add note to purchase order /// </summary> /// <param name="purchaseOrder"></param> /// <param name="noteDetails"></param> /// <param name="type"></param> /// <param name="customerId"></param> private void AddNoteToPurchaseOrder(IPurchaseOrder purchaseOrder, string noteDetails, OrderNoteTypes type, Guid customerId) { if (purchaseOrder == null) { throw new ArgumentNullException(nameof(purchaseOrder)); } var orderNote = purchaseOrder.CreateOrderNote(); if (!orderNote.OrderNoteId.HasValue) { var newOrderNoteId = -1; if (purchaseOrder.Notes.Count != 0) { newOrderNoteId = Math.Min(purchaseOrder.Notes.ToList().Min(n => n.OrderNoteId.Value), 0) - 1; } orderNote.OrderNoteId = newOrderNoteId; } orderNote.CustomerId = customerId; orderNote.Type = type.ToString(); orderNote.Title = noteDetails.Substring(0, Math.Min(noteDetails.Length, 24)) + "..."; orderNote.Detail = noteDetails; orderNote.Created = DateTime.UtcNow; }
private void AddNoteToPurchaseOrder(IPurchaseOrder purchaseOrder, Guid customerId, string title, string detail) { var orderNote = purchaseOrder.CreateOrderNote(); orderNote.Type = OrderNoteTypes.System.ToString(); orderNote.CustomerId = customerId != Guid.Empty ? customerId : PrincipalInfo.CurrentPrincipal.GetContactId(); orderNote.Title = title; orderNote.Detail = detail; orderNote.Created = DateTime.UtcNow; purchaseOrder.Notes.Add(orderNote); }
private void AddNoteToPurchaseOrder(string title, string detail, Guid customerId, IPurchaseOrder purchaseOrder) { var orderNote = purchaseOrder.CreateOrderNote(); orderNote.Type = OrderNoteTypes.System.ToString(); orderNote.CustomerId = customerId != Guid.Empty ? customerId : PrincipalInfo.CurrentPrincipal.GetContactId(); orderNote.Title = !string.IsNullOrEmpty(title) ? title : detail.Substring(0, Math.Min(detail.Length, 24)) + "..."; orderNote.Detail = detail; orderNote.Created = DateTime.UtcNow; purchaseOrder.Notes.Add(orderNote); }
/// <summary> /// Adds the note to purchase order. /// </summary> /// <param name="note">The note detail.</param> /// <param name="purchaseOrder">The purchase order.</param> private void AddNoteToPurchaseOrder(string note, IPurchaseOrder purchaseOrder) { var orderNote = purchaseOrder.CreateOrderNote(); orderNote.Type = OrderNoteTypes.System.ToString(); orderNote.CustomerId = PrincipalInfo.CurrentPrincipal.GetContactId(); orderNote.Title = note.Substring(0, Math.Min(note.Length, 24)) + "..."; orderNote.Detail = note; orderNote.Created = DateTime.UtcNow; purchaseOrder.Notes.Add(orderNote); }