public IEnumerable <R_Project> GetProjects() { IEnumerable <R_Project> results = null; var sql = PetaPoco.Sql.Builder .Select("*") .From("R_Project") .Where("IsDeleted = 0") ; results = R_Project.Query(sql); return(results); }
public IEnumerable <R_Project> GetProjectListAdvancedSearch( int?nucleoId , string name , string description , string deadlineCall , double?budget , string funding , System.DateTime?startDateFrom , System.DateTime?startDateTo , System.DateTime?endDateFrom , System.DateTime?endDateTo , string areaOfInterest , bool?active ) { IEnumerable <R_Project> results = null; var sql = PetaPoco.Sql.Builder .Select("*") .From("R_Project") .Where("IsDeleted = 0" + (nucleoId != null ? " and NucleoId like '%" + nucleoId + "%'" : "") + (name != null ? " and Name like '%" + name + "%'" : "") + (description != null ? " and Description like '%" + description + "%'" : "") + (deadlineCall != null ? " and DeadlineCall like '%" + deadlineCall + "%'" : "") + (budget != null ? " and Budget like '%" + budget + "%'" : "") + (funding != null ? " and Funding like '%" + funding + "%'" : "") + (startDateFrom != null ? " and StartDate >= '" + startDateFrom.Value.ToShortDateString() + "'" : "") + (startDateTo != null ? " and StartDate <= '" + startDateTo.Value.ToShortDateString() + "'" : "") + (endDateFrom != null ? " and EndDate >= '" + endDateFrom.Value.ToShortDateString() + "'" : "") + (endDateTo != null ? " and EndDate <= '" + endDateTo.Value.ToShortDateString() + "'" : "") + (areaOfInterest != null ? " and AreaOfInterest like '%" + areaOfInterest + "%'" : "") + (active != null ? " and Active = " + (active == true ? "1" : "0") : "") ) ; results = R_Project.Query(sql); return(results); }