forked from ahyahy/OneScriptForms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataRowView.cs
More file actions
162 lines (143 loc) · 4.42 KB
/
DataRowView.cs
File metadata and controls
162 lines (143 loc) · 4.42 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
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
155
156
157
158
159
160
161
162
using System;
using ScriptEngine.Machine.Contexts;
using ScriptEngine.Machine;
namespace osf
{
public class DataRowView
{
public ClDataRowView dll_obj;
public System.Data.DataRowView M_DataRowView;
public DataRowView()
{
}
public DataRowView(osf.DataRowView p1)
{
M_DataRowView = p1.M_DataRowView;
OneScriptForms.AddToHashtable(M_DataRowView, this);
}
public DataRowView(System.Data.DataRowView p1)
{
M_DataRowView = p1;
OneScriptForms.AddToHashtable(M_DataRowView, this);
}
public object get_Item(object p1)
{
if (p1 is string)
{
return M_DataRowView[(string)p1];
}
return M_DataRowView[(int)p1];
}
public osf.DataRow Row
{
get { return new DataRow(M_DataRowView.Row); }
}
public void Delete()
{
M_DataRowView.Delete();
}
public void EndEdit()
{
M_DataRowView.EndEdit();
}
public void SetItem(object index, object item)
{
if (index is string)
{
M_DataRowView[(string)index] = item;
}
else
{
M_DataRowView[(int)index] = item;
}
System.Windows.Forms.Application.DoEvents();
}
}
[ContextClass ("КлПредставлениеСтрокиДанных", "ClDataRowView")]
public class ClDataRowView : AutoContext<ClDataRowView>
{
public ClDataRowView()
{
DataRowView DataRowView1 = new DataRowView();
DataRowView1.dll_obj = this;
Base_obj = DataRowView1;
}
public ClDataRowView(DataRowView p1)
{
DataRowView DataRowView1 = p1;
DataRowView1.dll_obj = this;
Base_obj = DataRowView1;
}
public ClDataRowView(System.Data.DataRowView p1)
{
DataRowView DataRowView1 = new DataRowView(p1);
DataRowView1.dll_obj = this;
Base_obj = DataRowView1;
}
public DataRowView Base_obj;
[ContextProperty("Строка", "Row")]
public ClDataRow Row
{
get { return new ClDataRow(Base_obj.Row); }
}
[ContextMethod("ЗакончитьРедактирование", "EndEdit")]
public void EndEdit()
{
Base_obj.EndEdit();
}
[ContextMethod("Удалить", "Delete")]
public void Delete()
{
Base_obj.Delete();
}
[ContextMethod("УстановитьЭлемент", "SetItem")]
public void SetItem(IValue p1, IValue p2)
{
dynamic p3 = p1;
if (p1.SystemType.Name == "Строка")
{
p3 = p1.AsString();
}
else if (p1.SystemType.Name == "Число")
{
p3 = Convert.ToInt32(p1.AsNumber());
}
if (p2.GetType().ToString().Contains("osf."))
{
Base_obj.SetItem(p3, OneScriptForms.RevertObj(p2));
}
else if (p2.SystemType.Name == "Строка")
{
Base_obj.SetItem(p3, p2.AsString());
}
else if (p2.SystemType.Name == "Булево")
{
Base_obj.SetItem(p3, p2.AsBoolean());
}
else if (p2.SystemType.Name == "Дата")
{
Base_obj.SetItem(p3, new System.DateTime(
p2.AsDate().Year,
p2.AsDate().Month,
p2.AsDate().Day,
p2.AsDate().Hour,
p2.AsDate().Minute,
p2.AsDate().Second
));
}
else if (p2.SystemType.Name == "Число")
{
Base_obj.SetItem(p3, p2.AsNumber());
}
}
[ContextMethod("Элемент", "Item")]
public IValue Item(IValue p1)
{
if (p1.SystemType.Name == "Строка")
{
return OneScriptForms.RevertObj(Base_obj.get_Item(p1.AsString()));
}
return OneScriptForms.RevertObj(Base_obj.get_Item(Convert.ToInt32(p1.AsNumber())));
}
}
}