Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/ClientConfigAdapter.cs @ 2693

Last change on this file since 2693 was 2002, checked in by svonolfe, 15 years ago

Implementd ClientConfigAdapter (#372)

File size: 1.6 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using HeuristicLab.DataAccess.ADOHelper;
6using HeuristicLab.Hive.Contracts.BusinessObjects;
7using HeuristicLab.Hive.Server.DataAccess;
8using HeuristicLab.Hive.Server.ADODataAccess.TableAdapterWrapper;
9
10namespace 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}
Note: See TracBrowser for help on using the repository browser.