public IEnumerable <R_Supplier> GetSupplierListAdvancedSearch( string name , int?supplierTypeId , string phone , string email , double?latitude , double?longitude , string description , string website , int?addressId ) { IEnumerable <R_Supplier> results = null; var sql = PetaPoco.Sql.Builder .Select("*") .From("R_Supplier") .Where("IsDeleted = 0" + (name != null ? " and Name like '%" + name + "%'" : "") + (supplierTypeId != null ? " and SupplierTypeId = " + supplierTypeId : "") + (phone != null ? " and Phone like '%" + phone + "%'" : "") + (email != null ? " and Email like '%" + email + "%'" : "") + (latitude != null ? " and Latitude like '%" + latitude + "%'" : "") + (longitude != null ? " and Longitude like '%" + longitude + "%'" : "") + (description != null ? " and Description like '%" + description + "%'" : "") + (website != null ? " and Website like '%" + website + "%'" : "") + (addressId != null ? " and AddressId like '%" + addressId + "%'" : "") ) ; results = R_Supplier.Query(sql); return(results); }
public IEnumerable <R_Supplier> GetSuppliers() { IEnumerable <R_Supplier> results = null; var sql = PetaPoco.Sql.Builder .Select("*") .From("R_Supplier") .Where("IsDeleted = 0") ; results = R_Supplier.Query(sql); return(results); }