internal IConfigurable ReadComplianceJob <T>(ComplianceJobId identity) where T : IConfigurable, new() { try { using (SqlConnection sqlConnection = new SqlConnection(this.GetConnectionString())) { using (DataContext dataContext = new DataContext(sqlConnection)) { Table <TempDatabase.ComplianceJobTable> table = dataContext.GetTable <TempDatabase.ComplianceJobTable>(); IQueryable <TempDatabase.ComplianceJobTable> source = from job in table where job.JobId == identity.Guid select job; int num = source.Count <TempDatabase.ComplianceJobTable>(); if (num == 1) { TempDatabase.ComplianceJobTable row = source.First <TempDatabase.ComplianceJobTable>(); return(this.CreateComplianceJobFromTableRow <T>(row, dataContext)); } } } } catch (Exception ex) { throw ex; } return(null); }
internal void UpdateJobTable(ComplianceJob newJob) { try { using (SqlConnection sqlConnection = new SqlConnection(this.GetConnectionString())) { using (DataContext dataContext = new DataContext(sqlConnection)) { Table <TempDatabase.ComplianceJobTable> table = dataContext.GetTable <TempDatabase.ComplianceJobTable>(); IQueryable <TempDatabase.ComplianceJobTable> queryable = from job in table where job.JobId == ((ComplianceJobId)newJob.Identity).Guid select job; if (queryable != null && queryable.Count <TempDatabase.ComplianceJobTable>() > 0) { TempDatabase.ComplianceJobTable complianceJobTable = queryable.First <TempDatabase.ComplianceJobTable>(); complianceJobTable.SetRowData(newJob); dataContext.SubmitChanges(); } } } } catch (Exception ex) { throw ex; } }
private ComplianceJob CreateComplianceJobFromTableRow <T>(TempDatabase.ComplianceJobTable row, DataContext dbContext) where T : IConfigurable, new() { ComplianceJob newJob = (ComplianceJob)((object)((default(T) == null) ? Activator.CreateInstance <T>() : default(T))); newJob.CopyFromRow(row); Table <TempDatabase.ComplianceJobBindingTable> table = dbContext.GetTable <TempDatabase.ComplianceJobBindingTable>(); IQueryable <TempDatabase.ComplianceJobBindingTable> queryable = from binding in table where binding.JobRunId == row.JobRunId && binding.TenantId == newJob.TenantId select binding; foreach (TempDatabase.ComplianceJobBindingTable complianceJobBindingTable in queryable) { newJob.Bindings[complianceJobBindingTable.BindingType].CopyFromRow(complianceJobBindingTable); } newJob.UpdateJobResults(); return(newJob); }
public void Delete(ComplianceJob job) { using (SqlConnection sqlConnection = new SqlConnection(this.GetConnectionString())) { using (DataContext dataContext = new DataContext(sqlConnection)) { Table <TempDatabase.ComplianceJobTable> table = dataContext.GetTable <TempDatabase.ComplianceJobTable>(); IQueryable <TempDatabase.ComplianceJobTable> queryable = from jobRow in table where jobRow.JobId == ((ComplianceJobId)job.Identity).Guid select jobRow; if (queryable != null && queryable.Count <TempDatabase.ComplianceJobTable>() > 0) { TempDatabase.ComplianceJobTable entity = queryable.First <TempDatabase.ComplianceJobTable>(); table.DeleteOnSubmit(entity); dataContext.SubmitChanges(); } } } }
// Token: 0x060000DD RID: 221 RVA: 0x00005B9C File Offset: 0x00003D9C internal void CopyFromRow(TempDatabase.ComplianceJobTable row) { this.Name = row.DisplayName; this.CreatedTime = row.CreateTime; this.LastModifiedTime = row.LastModifiedTime; this.JobStartTime = row.StartTime; this.JobEndTime = row.EndTime; this.Identity = new ComplianceJobId(row.JobId); this.Description = row.Description; this.JobObjectVersion = row.JobObjectVersion; this.TenantId = row.TenantId; this.JobType = row.JobType; this.CreatedBy = row.CreatedBy; this.RunBy = row.RunBy; this.JobRunId = row.JobRunId; this.TenantInfo = row.TenantInfo; this.JobData = row.JobData; this.Resume = row.Resume; this.NewRunId = false; }