public static List<InventoryItem> GetByCatalogItemId(Guid catalogItemId) { List<InventoryItem> inventoryItemList = new List<InventoryItem>(); using (ObjectConnection objectConnection = new ObjectConnection()) { using (GetInventoryItemByCatalogItemIdCommand objectCommand = new GetInventoryItemByCatalogItemIdCommand(objectConnection)) { objectCommand.CatalogItemId = catalogItemId; objectConnection.Open(); using (SqlDataReader sqlDataReader = objectCommand.ExecuteReader()) { if (!sqlDataReader.HasRows) { return inventoryItemList; } using (InventoryItemSqlDataReader objectSqlDataReader = new InventoryItemSqlDataReader(sqlDataReader)) { while (objectSqlDataReader.Read()) { InventoryItem inventoryItem = objectSqlDataReader.InventoryItem; inventoryItemList.Add(inventoryItem); } } } } } return inventoryItemList; }
public static List<InventoryItem> GetByManufacturer(string manufacturer, int inventoryItemStatusId) { List<InventoryItem> inventoryItemList = new List<InventoryItem>(); using (ObjectConnection objectConnection = new ObjectConnection()) { using (GetInventoryItemByManufacturerCommand objectCommand = new GetInventoryItemByManufacturerCommand(objectConnection)) { objectCommand.Manufacturer = manufacturer; objectCommand.InventoryItemStatusId = inventoryItemStatusId; objectConnection.Open(); using (SqlDataReader sqlDataReader = objectCommand.ExecuteReader()) { if (!sqlDataReader.HasRows) { return inventoryItemList; } using (InventoryItemSqlDataReader objectSqlDataReader = new InventoryItemSqlDataReader(sqlDataReader)) { while (objectSqlDataReader.Read()) { InventoryItem inventoryItem = objectSqlDataReader.InventoryItem; inventoryItemList.Add(inventoryItem); } } } } } return inventoryItemList; }