ConvertRouteSubscribersToExt.cs
1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ControlPanel.Interfaces.Strategys;
using ControlPanel.Models;
using ControlPanel.Models.Extend;
using ControlPanel.Interfaces.Reposytorys;
using ControlPanel.NHInplimentRepository;
namespace ControlPanel.ImplimentStrateges
{
public class ConvertRouteSubscribersToExt<T> : IConvertToExt<T>
{
private ExtRoute _extroute;
private ISubscribersRepository _szsrepository;
private IAgkRepository _agkrepository;
public object New(T obj)
{
_extroute = null;
try
{
Route route = obj as Route;
try
{
_extroute = new ExtRoute();
if (_szsrepository == null)
_szsrepository = new NHSubscribersRepository();
if (_agkrepository == null)
_agkrepository = new NHAgkRepository();
Agk agk = _agkrepository.GetByID(route.RefRouteAgk.id);
Subscribers szs = _szsrepository.GetByID(route.RefRouteSzs.Id);
_extroute.id = route.id;
_extroute.titleagk = "АГК-"+agk.number + " " + agk.river;
_extroute.titleszs = szs.Name;
_extroute.enabled = route.enabled;
}
catch (Exception ex)
{
}
}
catch (Exception ex)
{
}
return _extroute;
}
}
}