1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using HeuristicLab.DataAccess.ADOHelper;
|
---|
6 | using System.Data.SqlClient;
|
---|
7 | using HeuristicLab.Hive.Contracts.BusinessObjects;
|
---|
8 | using System.Data.Common;
|
---|
9 |
|
---|
10 | namespace HeuristicLab.Hive.Server.ADODataAccess.TableAdapterWrapper {
|
---|
11 | class JobAdapterWrapper :
|
---|
12 | TableAdapterWrapperBase<dsHiveServerTableAdapters.JobTableAdapter,
|
---|
13 | Job,
|
---|
14 | dsHiveServer.JobRow> {
|
---|
15 | public override void UpdateRow(dsHiveServer.JobRow row) {
|
---|
16 | TransactionalAdapter.Update(row);
|
---|
17 | }
|
---|
18 |
|
---|
19 | public override dsHiveServer.JobRow
|
---|
20 | InsertNewRow(Job job) {
|
---|
21 | dsHiveServer.JobDataTable data =
|
---|
22 | new dsHiveServer.JobDataTable();
|
---|
23 |
|
---|
24 | dsHiveServer.JobRow row = data.NewJobRow();
|
---|
25 | row.JobId = job.Id;
|
---|
26 | data.AddJobRow(row);
|
---|
27 |
|
---|
28 | return row;
|
---|
29 | }
|
---|
30 |
|
---|
31 | public override IEnumerable<dsHiveServer.JobRow>
|
---|
32 | FindById(Guid id) {
|
---|
33 | return TransactionalAdapter.GetDataById(id);
|
---|
34 | }
|
---|
35 |
|
---|
36 | public override IEnumerable<dsHiveServer.JobRow>
|
---|
37 | FindAll() {
|
---|
38 | return TransactionalAdapter.GetData();
|
---|
39 | }
|
---|
40 |
|
---|
41 | public byte[] GetSerializedJob(Guid jobId) {
|
---|
42 | return TransactionalAdapter.GetSerializedJobById(jobId);
|
---|
43 | }
|
---|
44 |
|
---|
45 | public bool UpdateSerialiedJob(byte[] serializedJob, Guid jobId) {
|
---|
46 | return TransactionalAdapter.UpdateSerializedJob(serializedJob, jobId) > 0;
|
---|
47 | }
|
---|
48 |
|
---|
49 | protected override void SetConnection(DbConnection connection) {
|
---|
50 | adapter.Connection = connection as SqlConnection;
|
---|
51 | }
|
---|
52 |
|
---|
53 | protected override void SetTransaction(DbTransaction transaction) {
|
---|
54 | adapter.Transaction = transaction as SqlTransaction;
|
---|
55 | }
|
---|
56 | }
|
---|
57 | }
|
---|