public List <T> GetAllLeaseAssignmentsToVirtual <T>(string recordTypeId) { List <T> vLeaseList = new List <T>(); try { String connectionString = SalesforceCxn.SalesforceConnectionString(); using (SalesforceConnection connection = new SalesforceConnection(connectionString)) { SalesforceCommand cmd = new SalesforceCommand("SELECT Lease__c.Name, Lease__c.Id, Account.Name AS AccountName, Account.Id AS AccountId FROM Lease__c, Account WHERE Account.Id = Lease__c.Contract_Customer__c AND (Account.RecordTypeId = " + recordTypeId + ") AND (Lease__c.IsDeleted = 'False')", connection); SalesforceDataReader rdr = cmd.ExecuteReader(); vLeaseList = SfdcReflectionUtil.PopulateListFromReader <T>(rdr); } } catch (Exception ex) { CfsLogging.LogFatal("Error occured Salesforce Data Loader", String.Format(MethodBase.GetCurrentMethod().Name + " method failed in SalesforceContext class") + "\n" + ex); throw; } return(vLeaseList); }
public List <T> GetSalesforceRecords <T>(string sql) { List <T> recordList = new List <T>(); try { String connectionString = SalesforceCxn.SalesforceConnectionString(); using (SalesforceConnection connection = new SalesforceConnection(connectionString)) { SalesforceCommand cmd = new SalesforceCommand(sql, connection); SalesforceDataReader rdr = cmd.ExecuteReader(); recordList = SfdcReflectionUtil.PopulateListFromReader <T>(rdr); } } catch (Exception ex) { CfsLogging.LogFatal("Error occured Salesforce Data Loader", String.Format(MethodBase.GetCurrentMethod().Name + " method failed in SalesforceContext class") + "\n" + ex); throw; } return(recordList); }
public List <T> GetAccountsFromSalesforce <T>(string recordTypeId) { List <T> accounts = new List <T>(); String connectionString = SalesforceCxn.SalesforceConnectionString(); using (SalesforceConnection connection = new SalesforceConnection(connectionString)) { SalesforceCommand cmd = new SalesforceCommand("SELECT * FROM Account WHERE RecordTypeId = " + recordTypeId, connection); SalesforceDataReader rdr = cmd.ExecuteReader(); accounts = SfdcReflectionUtil.PopulateListFromReader <T>(rdr); } return(accounts); }