コード例 #1
0
ファイル: Data.cs プロジェクト: jtneumann/CS4B
 // to add a new order row to an existing order
 public OrderRow AddOrderRow(OrderRow orderRow)
 {
     try
     {
         int newId = orderRows.Count.Equals(0) ? 1 :
                     orderRows.Max(o => o.OrderRowId) + 1;
         orderRow.OrderRowId = newId;
         orderRows.Add(orderRow);
         return(orderRow);
     }
     catch (Exception ex)
     {
         throw new ApplicationException(
                   "Could not add the order row", ex);
     }
 }
コード例 #2
0
ファイル: Data.cs プロジェクト: jtneumann/CS4B
 // To remove an order row instance from the orderRows collection in the Data class
 public bool RemoveOrderRow(OrderRow orderRow)
 {
     return(orderRows.Remove(orderRow));
 }