/// <summary>
 /// Loads Inventory by the id parameter
 /// </summary>
 /// <param name="inventoryId">Primary Key of Inventory table</param>
 /// <returns>Inventory entity</returns>
 public static Inventory Load(int inventoryId)
 {
     SearchInventory search
         = new SearchInventory
             {
                 InventoryId = inventoryId
             };
     return Search(search).FirstOrDefault();
 }
 public static bool IsValidToRemove(int locationId)
 {
     SearchInventory search
         = new SearchInventory
         {
             LocationId = locationId,
             Deleted = false
         };
     return !Search(search).SafeAny();
 }
        /// <summary>
        /// Searches for Inventory
        /// </summary>
        /// <param name="item" />
        /// <returns>An IEnumerable set of Inventory</returns>
        public static IEnumerable<Inventory> Search(SearchInventory item)
        {
            List<SqlParameter> parameters
                = new List<SqlParameter>
                    {
                        new SqlParameter("@InventoryId", item.InventoryId),
                        new SqlParameter("@ModelId", item.ModelId),
                        new SqlParameter("@Year", item.Year),
                        new SqlParameter("@Quantity", item.Quantity),
                        new SqlParameter("@LocationId", item.LocationId),
                        new SqlParameter("@Color", item.Color),
                        new SqlParameter("@Price", item.Price),
                        new SqlParameter("@Deleted", item.Deleted)
                    };

            DataSet set = DataManager.ExecuteProcedure(KarzPlusConnectionString, "PKP_GetInventory", parameters);
            IEnumerable<DataRow> dataRows = set.GetRowsFromDataSet();
            return ConvertToEntityObject(dataRows);
        }
 /// <summary>
 /// Loads Inventory by the id parameter
 /// </summary>
 /// <param name="inventoryId">Primary Key of Inventory table</param>
 /// <returns>Inventory entity</returns>
 public static IEnumerable<Inventory> LoadAllOnInventoryId(int inventoryId)
 {
     SearchInventory search
         = new SearchInventory
         {
             InventoryId = inventoryId
         };
     return Search(search);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static IEnumerable<Inventory> LoadAll()
        {
            SearchInventory inventory = new SearchInventory();

            return Search(inventory);
        }
 /// <summary>
 /// Searches for Inventory
 /// </summary>
 /// <param name="search" />
 /// <returns>An IEnumerable set of Inventory</returns>
 public static IEnumerable<Inventory> Search(SearchInventory search)
 {
     return search == null ? new List<Inventory>() : InventoryDao.Search(search);
 }
 public static IEnumerable<Inventory> LoadOnLocationId(int locationId)
 {
     SearchInventory search
         = new SearchInventory
         {
             LocationId = locationId,
             Deleted=false
         };
     return Search(search);
 }