public T GetRecordType <T>(string recordTypeName, string sObjectType)
        {
            var recordType = Activator.CreateInstance <T>();

            try
            {
                String connectionString = SalesforceCxn.SalesforceConnectionString();
                string sql =
                    String.Format("SELECT Id, Name,SobjectType FROM RecordType where Name='{0}' and SobjectType = '{1}'",
                                  recordTypeName, sObjectType);


                using (SalesforceConnection connection = new SalesforceConnection(connectionString))
                {
                    SalesforceCommand cmd = new SalesforceCommand(sql, connection);

                    SalesforceDataReader rdr = cmd.ExecuteReader();
                    recordType = SfdcReflectionUtil.PopulateBaseModelFromReader <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(recordType);
        }
        public T CreateJobForBatchInSalesforce <T>(string salesforceObjectName, string action, string concurrency)
        {
            var salesforceBulkJob = Activator.CreateInstance <T>();

            try
            {
                String connectionString = SalesforceCxn.SalesforceConnectionString();

                using (SalesforceConnection connection = new SalesforceConnection(connectionString))
                {
                    SalesforceCommand cmd = new SalesforceCommand("CreateJob", connection);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SalesforceParameter("@ObjectName", salesforceObjectName)); //ex. "Account"
                    cmd.Parameters.Add(new SalesforceParameter("@Action", action));                   // ex. "Insert"
                    cmd.Parameters.Add(new SalesforceParameter("@ConcurrencyMode", concurrency));     // ex. "Serial"
                    cmd.Parameters.Add(new SalesforceParameter("@ExternalIdColumn", ""));

                    SalesforceDataReader rdr = cmd.ExecuteReader();
                    salesforceBulkJob = SfdcReflectionUtil.PopulateBaseModelFromReader <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(salesforceBulkJob);
        }
        public T GetJobFromSalesforce <T>(string jobId)
        {
            var salesforceBulkJob = Activator.CreateInstance <T>();


            try
            {
                String connectionString = SalesforceCxn.SalesforceConnectionString();
                using (SalesforceConnection connection = new SalesforceConnection(connectionString))
                {
                    SalesforceCommand cmd = new SalesforceCommand("GetJob", connection);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SalesforceParameter("@jobId", jobId));

                    SalesforceDataReader rdr = cmd.ExecuteReader();
                    salesforceBulkJob = SfdcReflectionUtil.PopulateBaseModelFromReader <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(salesforceBulkJob);
        }