Beispiel #1
0
        public IEnumerable <R_Equipment> GetEquipmentListAdvancedSearch(
            string name
            , string description
            , string category
            , int?photo
            , double?quantityInStock
            , double?minimumQuantityNeeded
            , double?pricePerUnit
            , string storageLocation
            , bool?active
            )
        {
            IEnumerable <R_Equipment> results = null;

            var sql = PetaPoco.Sql.Builder
                      .Select("*")
                      .From("R_Equipment")
                      .Where("IsDeleted = 0"
                             + (name != null ? " and Name like '%" + name + "%'" : "")
                             + (description != null ? " and Description like '%" + description + "%'" : "")
                             + (category != null ? " and Category like '%" + category + "%'" : "")
                             + (photo != null ? " and Photo like '%" + photo + "%'" : "")
                             + (quantityInStock != null ? " and QuantityInStock like '%" + quantityInStock + "%'" : "")
                             + (minimumQuantityNeeded != null ? " and MinimumQuantityNeeded like '%" + minimumQuantityNeeded + "%'" : "")
                             + (pricePerUnit != null ? " and PricePerUnit like '%" + pricePerUnit + "%'" : "")
                             + (storageLocation != null ? " and StorageLocation like '%" + storageLocation + "%'" : "")
                             + (active != null ? " and Active = " + (active == true ? "1" : "0") : "")
                             )
            ;

            results = R_Equipment.Query(sql);

            return(results);
        }
Beispiel #2
0
        public IEnumerable <R_Equipment> GetEquipments()
        {
            IEnumerable <R_Equipment> results = null;

            var sql = PetaPoco.Sql.Builder
                      .Select("*")
                      .From("R_Equipment")
                      .Where("IsDeleted = 0")

            ;

            results = R_Equipment.Query(sql);

            return(results);
        }