public with sharing class TradeCustomerManagerSearchOppController {
|
public String DealerId {get;set;}
|
public String byName {get;set;}
|
public String byCode {get;set;}
|
public List<Opportunity> oppList {get;set;}
|
|
public TradeCustomerManagerSearchOppController() {
|
DealerId = System.currentPageReference().getParameters().get('DealerId');
|
}
|
|
public void init(){
|
|
}
|
|
public void doSearch(){
|
String sql = 'select Id,Name,InquiryNumber__c,Account.Name,customerType__c,Dealer__r.Name,NewInquiryDate__c from Opportunity where id != null';
|
if(String.isNotBlank(byName)){
|
sql += ' and Name like \'%'+String.escapeSingleQuotes(byName.trim().replaceAll('%', '\\%'))+'%\'';
|
}
|
if(String.isNotBlank(byCode)){
|
sql += ' and InquiryNumber__c like \'%'+String.escapeSingleQuotes(byCode.trim().replaceAll('%', '\\%'))+'%\'';
|
}
|
System.debug(sql);
|
oppList = Database.query(sql+' order by NewInquiryDate__c desc limit 100');
|
}
|
}
|