Ejemplo n.º 1
0
        public OrderListItem(Wine listItem, InventoryItem quantity)
        {
            WineName = listItem.WineName;
            Year     = listItem.Year;
            Volume   = listItem.Volume;
            Quantity = quantity.Quantity;

            QuantityToOrder = 0;
        }
 public InventoryListItem(Wine wineData, InventoryItem inventoryData)
 {
     WineId   = wineData.WineId;
     Quantity = inventoryData.Quantity;
     WineName = wineData.WineName;
     Origin   = wineData.Origin;
     Price    = wineData.Price;
     Year     = wineData.Year;
     Volume   = wineData.Volume;
     Type     = wineData.Type;
 }
            /// <summary>
            /// Get a wine object matching the given wine id from the Wine table.
            /// </summary>
            /// <param name="wineId">Wine to search for.</param>
            /// <returns>Wine object representing an entry in the database.</returns>
            public static Wine GetWineById(int wineId)
            {
                var data = tableManager.WineTableAdapter.GetWineById(wineId).Rows;

                if (data.Count != 1)
                {
                    throw new FormatException($"GetWineById({wineId}) returned {data.Count} values.");
                }
                var  row  = (InventoryDataSet.WineRow)data[0];
                Wine wine = new Wine(row.WineId, row.WineName, row.Origin, row.Price, row.Year, row.Volume, row.Type, new byte[0]);

                return(wine);
            }