-
Notifications
You must be signed in to change notification settings - Fork 0
/
ComplexDictionaryControl.cs
154 lines (144 loc) · 7.62 KB
/
ComplexDictionaryControl.cs
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
using System.Collections.Generic;
using System.Windows.Forms;
using ipsFormsDesign.Model;
using WebAPIConnector;
using sysAdminwp.ComplexDictionariesBaseControls;
using sysAdminwp.PresenterComplexDictionaries;
namespace sysAdminwp.viewPageDictionaryControls
{
public partial class ComplexDictionaryControl : UserControl
{
private readonly ApiConnector _connector;
private const string PrefixUpdate = "dictionary/complex/update/";
private const string PrefixCreate = "dictionary/complex/addnew/";
private const string PrefixDelete = "dictionary/complex/delete/";
//for saved complex dictionaries from DictionaryForm and use for
//- UrlForComplexDictionaries
//- ComplexDictionaryName
private List<DicCategoryItems> complexDictionary;
public List<DicCategoryItems> ComplexDictionarySaved
{
get { return complexDictionary; }
set
{
if (value != null)
complexDictionary = value;
}
}
//mass for color setting for textBox color
private byte[] borderDefault = new byte[4];
//sequence of complex dictionaries
private readonly List<string> _complexDictionaryList = new List<string>
{
"copyrightkind",
"country",
"creativeroletype",
"genretype",
"kl_r030",
"systemconstant",
"typeplace"
};
public string UrlForComplexDictionaries
{
get
{
var nodeComplexDictionary = complexTreeView.SelectedNode;
if (nodeComplexDictionary == null) return string.Empty;
var currentDataComplexdictionary = ComplexDictionarySaved[nodeComplexDictionary.Index];
if (currentDataComplexdictionary == null) return string.Empty;
return currentDataComplexdictionary.Url;
}
}
public string ComplexDictionaryName
{
get
{
var node = complexTreeView.SelectedNode;
if (node == null) return string.Empty;
var currentDataDictionary = ComplexDictionarySaved[node.Index];
if (currentDataDictionary == null) return string.Empty;
return currentDataDictionary.DicName;
}
}
public ComplexDictionaryControl(ApiConnector connector, List<DicCategoryItems> complexDictionaries)
{
InitializeComponent();
//initialize connector
_connector = connector;
//save for NodeSelected property
ComplexDictionarySaved = complexDictionaries;
//initialize data for TreeView
SetComplexDictionaryToTree(complexDictionaries);
}
//initialize sequence complex dictionaries for 'TreeView' element
private void SetComplexDictionaryToTree(List<DicCategoryItems> complexDictionaries)
{
//set data for element
complexTreeView.DataSource = complexDictionaries;
complexTreeView.DisplayMember = "Name";
}
//initialize data for grid of the selected dictionary
private void complexTreeView_SelectedNodeChanged(object sender, Telerik.WinControls.UI.RadTreeViewEventArgs e)
{
switch (ComplexDictionaryName.ToLower())
{
case "copyrightkind":
//revome other controls
tableLayout_MarkupElement.Controls.Remove(tableLayout_MarkupElement.GetControlFromPosition(1, 0));
DirectorLayers<CopyrightKind> directorCopyright = new DirectorLayers<CopyrightKind>();
BaseCopyrightKindControl baseCopyrightKind = (BaseCopyrightKindControl)directorCopyright.InitCommon(_connector, UrlForComplexDictionaries);
tableLayout_MarkupElement.Controls.Add(baseCopyrightKind, 1, 0);
break;
case "country":
//revome other controls
tableLayout_MarkupElement.Controls.Remove(tableLayout_MarkupElement.GetControlFromPosition(1, 0));
DirectorLayers<Country> directorCountry = new DirectorLayers<Country>();
BaseCountryControl baseCountry = (BaseCountryControl)directorCountry.InitCommon(_connector, UrlForComplexDictionaries);
tableLayout_MarkupElement.Controls.Add(baseCountry, 1, 0);
break;
case "creativeroletype":
//revome other controls
tableLayout_MarkupElement.Controls.Remove(tableLayout_MarkupElement.GetControlFromPosition(1, 0));
DirectorLayers<CreativeRoleType> directorCreative = new DirectorLayers<CreativeRoleType>();
BaseCreativeroleTypeControl baseCreativeroleType = (BaseCreativeroleTypeControl)directorCreative.InitCommon(_connector, UrlForComplexDictionaries);
tableLayout_MarkupElement.Controls.Add(baseCreativeroleType, 1, 0);
break;
case "genretype":
//revome other controls
tableLayout_MarkupElement.Controls.Remove(tableLayout_MarkupElement.GetControlFromPosition(1, 0));
DirectorLayers<GenreType> directorGenre = new DirectorLayers<GenreType>();
BaseGenreTypeControl baseGenreType = (BaseGenreTypeControl)directorGenre.InitCommon(_connector, UrlForComplexDictionaries);
tableLayout_MarkupElement.Controls.Add(baseGenreType, 1, 0);
break;
case "kl_r030":
//revome other controls
tableLayout_MarkupElement.Controls.Remove(tableLayout_MarkupElement.GetControlFromPosition(1, 0));
DirectorLayers<KlR030> directorKlr = new DirectorLayers<KlR030>();
BaseKlr030Control baseKlr030 = (BaseKlr030Control)directorKlr.InitCommon(_connector, UrlForComplexDictionaries);
tableLayout_MarkupElement.Controls.Add(baseKlr030, 1, 0);
break;
case "systemconstant":
//revome other controls
tableLayout_MarkupElement.Controls.Remove(tableLayout_MarkupElement.GetControlFromPosition(1, 0));
DirectorLayers<SystemConstant> directorSystem = new DirectorLayers<SystemConstant>();
BaseSystemConstantControl baseSystemConstant = (BaseSystemConstantControl)directorSystem.InitCommon(_connector, UrlForComplexDictionaries);
tableLayout_MarkupElement.Controls.Add(baseSystemConstant, 1, 0);
break;
case "typeplace":
//revome other controls
tableLayout_MarkupElement.Controls.Remove(tableLayout_MarkupElement.GetControlFromPosition(1, 0));
DirectorLayers<TypePlace> directorType = new DirectorLayers<TypePlace>();
BaseTypePlaceControl baseTypePlace = (BaseTypePlaceControl)directorType.InitCommon(_connector, UrlForComplexDictionaries);
tableLayout_MarkupElement.Controls.Add(baseTypePlace, 1, 0);
break;
}
}
private void ddlEditKeyField_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
{
if (e.Position == -1)
{
return;
}
}
}
}