示例#1
0
 private void SaveComplianceTask(CompositeTask task)
 {
     if (task.ObjectState == ObjectState.New)
     {
         task.TenantId = this.organizationId.OrganizationalUnit.ObjectGuid;
         TempDatabase.Instance.InsertIntoTable <TempDatabase.CompositeTaskTable, CompositeTask>(task);
         task.ResetChangeTracking(true);
         return;
     }
     throw new NotImplementedException();
 }
示例#2
0
 public void Delete(CompositeTask task)
 {
     using (SqlConnection sqlConnection = new SqlConnection(this.GetConnectionString()))
     {
         using (DataContext dataContext = new DataContext(sqlConnection))
         {
             Table <TempDatabase.CompositeTaskTable>      table     = dataContext.GetTable <TempDatabase.CompositeTaskTable>();
             IQueryable <TempDatabase.CompositeTaskTable> queryable = from taskRow in table
                                                                      where taskRow.JobRunId == task.JobRunId && taskRow.TaskId == task.TaskId
                                                                      select taskRow;
             if (queryable != null && queryable.Count <TempDatabase.CompositeTaskTable>() > 0)
             {
                 TempDatabase.CompositeTaskTable entity = queryable.First <TempDatabase.CompositeTaskTable>();
                 table.DeleteOnSubmit(entity);
                 dataContext.SubmitChanges();
             }
         }
     }
 }