1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using HeuristicLab.DataAccess.ADOHelper;
|
---|
6 | using HeuristicLab.Hive.Contracts.BusinessObjects;
|
---|
7 | using HeuristicLab.Hive.Server.DataAccess;
|
---|
8 | using HeuristicLab.Hive.Server.ADODataAccess.TableAdapterWrapper;
|
---|
9 |
|
---|
10 | namespace HeuristicLab.Hive.Server.ADODataAccess {
|
---|
11 | class ClientConfigAdapter :
|
---|
12 | DataAdapterBase<
|
---|
13 | dsHiveServerTableAdapters.ClientConfigTableAdapter,
|
---|
14 | ClientConfig,
|
---|
15 | dsHiveServer.ClientConfigRow>,
|
---|
16 | IClientConfigAdapter {
|
---|
17 | public ClientConfigAdapter():
|
---|
18 | base(new ClientConfigAdapterWrapper()) {
|
---|
19 | }
|
---|
20 |
|
---|
21 | protected override dsHiveServer.ClientConfigRow
|
---|
22 | ConvertObj(ClientConfig config, dsHiveServer.ClientConfigRow row) {
|
---|
23 | if (row != null && config != null) {
|
---|
24 | row.ClientConfigId = config.Id;
|
---|
25 | row.HeartBeatIntervall = config.HeartBeatIntervall;
|
---|
26 | row.UpDownTimeCalendar = config.UpDownTimeCalendar;
|
---|
27 |
|
---|
28 | return row;
|
---|
29 | } else
|
---|
30 | return null;
|
---|
31 | }
|
---|
32 |
|
---|
33 | protected override ClientConfig ConvertRow(dsHiveServer.ClientConfigRow row, ClientConfig config) {
|
---|
34 | if (config != null && row != null) {
|
---|
35 | config.Id = row.ClientConfigId;
|
---|
36 |
|
---|
37 | if (!row.IsHeartBeatIntervallNull())
|
---|
38 | config.HeartBeatIntervall = row.HeartBeatIntervall;
|
---|
39 | else
|
---|
40 | config.HeartBeatIntervall = 0;
|
---|
41 |
|
---|
42 | if (!row.IsUpDownTimeCalendarNull())
|
---|
43 | config.UpDownTimeCalendar = row.UpDownTimeCalendar;
|
---|
44 | else
|
---|
45 | config.UpDownTimeCalendar = null;
|
---|
46 |
|
---|
47 | return config;
|
---|
48 | } else
|
---|
49 | return null;
|
---|
50 | }
|
---|
51 | }
|
---|
52 | }
|
---|