Пример #1
0
		public void PopulateOrderReconsiderationProperty(int orderId, OrderReconsiderationProperty property)
		{
			property.Address = Address;
			property.Age = Age;
			property.Baths = Baths;
			property.Beds = Beds;
			property.Comments = Comments;
			property.GLA = GLA;
			property.MLSNumber = MLSNumber;
			property.Prox = Prox;
			property.OrderId = orderId;
			property.Id = PropertyId.HasValue ? PropertyId.Value : default(int);
		}
Пример #2
0
		public ValueReconsiderationViewModel(OrderReconsiderationProperty property)
		{
			if (property != null)
			{
				PropertyId = property.Id;
				Address = property.Address;
				MLSNumber = property.MLSNumber;
				Age = property.Age;
				GLA = property.GLA;
				Prox = property.Prox;
				Baths = property.Baths;
				Beds = property.Beds;
				Comments = property.Comments;

			}
		}
Пример #3
0
		public OrderReconsiderationProperty AddValueReconsideration(int orderId, ValueReconsiderationViewModel model)
		{
			if (!AllowAddValueReconsideration())
			{
				throw new SecurityException(string.Format("User has no permissions to add or edit value reconsideration record. User id [{0}].", _securityContext.CurrentUser.Id));
			}
			var order = _orderManager.GetOrderById(orderId);
			var property = new OrderReconsiderationProperty();
			model.PopulateOrderReconsiderationProperty(orderId, property);
			if (model.PropertyId.HasValue)
			{
				var propertyToUpdate = order.ReconsiderationProperties.FirstOrDefault(p => p.Id == model.PropertyId);
				if (propertyToUpdate != null)
				{
					propertyToUpdate.Address = model.Address;
					propertyToUpdate.Age = model.Age;
					propertyToUpdate.Baths = model.Baths;
					propertyToUpdate.Beds = model.Beds;
					propertyToUpdate.Comments = model.Comments;
					propertyToUpdate.GLA = model.GLA;
					propertyToUpdate.Prox = model.Prox;
					propertyToUpdate.MLSNumber = model.MLSNumber;
				}
			}
			else
			{
				order.ReconsiderationProperties.Add(property);
				_orderHistoryManager.AddReconsiderationPropertyNote(orderId, property.Address);
			}
			_notificationManager.SheduleOrderPeriodicalNotifications(order, OrderPeriodicalNotificationType.ValueReconsiderationCreated);

			return property;
		}