Example #1
0
		public NoteViewModel(OrderFulfillmentConditionNote note)
		{
			if (note != null)
			{
				Added = note.Added;
				By = note.By.FirstName + " " + note.By.LastName;
				Email = note.By.Email;
				Note = note.Text;

				var clientRoles = RoleTypeExtensions.ClientRoles();
				var noteCreatorRoles = note.By.Roles.Select(r => r.RoleType);
				IsClient = clientRoles.Any(e => noteCreatorRoles.Contains(e));
			}
		}
Example #2
0
		public NoteViewModel AddNoteForCondition(int orderId, Guid conditionId, string note)
		{
			var order = _orderManager.GetOrderById(orderId);
			var condition = order.Conditions.FirstOrDefault(e => e.Identity == conditionId);
			if (condition == null)
			{
				return new NoteViewModel();
			}
			var noteResult = new OrderFulfillmentConditionNote{ Added = DateTime.Now, By = _securityContext.CurrentUser, Text = note };
			condition.Notes.Add(noteResult);

			_orderHistoryManager.AddNoteToCondition(orderId, condition.Description);

			return new NoteViewModel(noteResult);
		}