Ejemplo n.º 1
0
 /// <summary>
 /// Updates the entity with the values contained within the surrogate.
 /// </summary>
 /// <param name="entity">The entity.</param>
 public void BindObjectInstance(OrderItem entity)
 {
     if (entity.Row.RowState == DataRowState.Added)
     {
     entity.OrderID = OrderID;
     entity.ProductID = ProductID;
     entity.Quantity = Quantity;
     entity.UnitPrice = UnitPrice;
     }
     else
     {
     if (_orderidHasBeenUpdated)
     {
         entity.OrderID = OrderID;
     }
     if (_productidHasBeenUpdated)
     {
         entity.ProductID = ProductID;
     }
     if (_quantityHasBeenUpdated)
     {
         entity.Quantity = Quantity;
     }
     if (_unitpriceHasBeenUpdated)
     {
         entity.UnitPrice = UnitPrice;
     }
     }
 }
Ejemplo n.º 2
0
 /// <summary>Constructor for assembling a surrogate from an entity object.</summary>
 /// <param name="entity">The Entity Object.</param>
 public OrderItemSurrogate(OrderItem entity)
     : base(entity)
 {
     _sb = new StringBuilder();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OrderItemSurrogateBase"/> class.
 /// </summary>
 /// <param name="entity">The entity.</param>
 public OrderItemSurrogateBase(OrderItem entity)
 {
     OrderItemID = entity.OrderItemID;
     OrderID = entity.OrderID;
     ProductID = entity.ProductID;
     Quantity = entity.Quantity;
     UnitPrice = entity.UnitPrice;
 }