-
Notifications
You must be signed in to change notification settings - Fork 0
/
RVIDocumentImportModel.cs
307 lines (259 loc) · 8.75 KB
/
RVIDocumentImportModel.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
using System;
using System.IO;
using System.Text;
using System.Security;
public class RVIImportModel
{
//System transaction number
private String mTransactionNumber;
public String transactionNumber
{
get { return mTransactionNumber; }
set { mTransactionNumber = value; }
}
/** The id associated with this processing preference */
private String mSystemCode = "";
public String SystemCode
{
get { return mSystemCode; }
set { mSystemCode = value; }
}
/** This relates directly to the field System index 1 */
private String mSystemIndex1 = "";
public String systemIndex1
{
get { return mSystemIndex1; }
set { mSystemIndex1 = value; }
}
/** This relates directly to the field System index 2 */
private String mSystemIndex2 = "";
public String systemIndex2
{
get { return mSystemIndex2; }
set { mSystemIndex2 = value; }
}
/** This relates directly to the field System index 3 */
private String mSystemIndex3 = "";
public String systemIndex3
{
get { return mSystemIndex3; }
set { mSystemIndex3 = value; }
}
/** This relates directly to the field System index 4 */
private String mSystemIndex4 = "";
public String systemIndex4
{
get { return mSystemIndex4; }
set { mSystemIndex4 = value; }
}
/** This relates directly to the field System index 5 */
private String mSystemIndex5 = "";
public String systemIndex5
{
get { return mSystemIndex5; }
set { mSystemIndex5 = value; }
}
/** This relates directly to the field System index 6 */
private String mSystemIndex6 = "";
public String systemIndex6
{
get { return mSystemIndex6; }
set { mSystemIndex6 = value; }
}
/** This relates directly to the field System index 7 */
private String mSystemIndex7 = "";
public String systemIndex7
{
get { return mSystemIndex7; }
set { mSystemIndex7 = value; }
}
/** This relates directly to the field System index 8 */
private String mSystemIndex8 = "";
public String systemIndex8
{
get { return mSystemIndex8; }
set { mSystemIndex8 = value; }
}
/** This relates directly to the field System index 9 */
private String mSystemIndex9 = "";
public String systemIndex9
{
get { return mSystemIndex9; }
set { mSystemIndex9 = value; }
}
/** This relates directly to the field System index 10 */
private String mSystemIndex10 = "";
public String systemIndex10
{
get { return mSystemIndex10; }
set { mSystemIndex10 = value; }
}
/** This relates directly to the field System index 11 */
private String mSystemIndex11 = "";
public String systemIndex11
{
get { return mSystemIndex11; }
set { mSystemIndex11 = value; }
}
/** This relates directly to the field System index 12 */
private String mSystemIndex12 = "";
public String systemIndex12
{
get { return mSystemIndex12; }
set { mSystemIndex12 = value; }
}
/** This relates directly to the field System index 13 */
private String mSystemIndex13 = "";
public String systemIndex13
{
get { return mSystemIndex13; }
set { mSystemIndex13 = value; }
}
/** This relates directly to the field System index 14 */
private String mSystemIndex14 = "";
public String systemIndex14
{
get { return mSystemIndex14; }
set { mSystemIndex14 = value; }
}
/** Image Path */
private String mFileName = "";
public String fileName
{
get { return mFileName; }
set { mFileName = value; }
}
/** Image File Name */
private String mImageFileName = "";
public String imageFileName
{
get { return mImageFileName; }
set { mImageFileName = value; }
}
/** Image Type* */
private String mImageType = "";
public String imageType
{
get { return mImageType; }
set { mImageType = value; }
}
private String mFileStream;
public String fileStream
{
get { return mFileStream; }
set { mFileStream = value; }
}
/// <summary>
/// Upload Document to RVI
/// </summary>
/// <param name="rim"></param>
/// <param name="debug"></param>
/// <returns></returns>
static public Boolean UploadtoRVI(RVIImportModel rim)
{
Boolean result = false;
//int count = 0;
try
{
StringBuilder input = new StringBuilder();
input.Append("<rviimport>");
input.Append("<systemid>");
input.Append(rim.SystemCode);
input.Append("</systemid>");
input.Append("<ordernumber>");
input.Append(SecurityElement.Escape(rim.systemIndex1));
input.Append("</ordernumber>");
input.Append("<company>");
input.Append(SecurityElement.Escape(rim.systemIndex2));
input.Append("</company>");
input.Append("<customernumber>");
input.Append(SecurityElement.Escape(rim.systemIndex3));
input.Append("</customernumber>");
input.Append("<index4>");
input.Append(SecurityElement.Escape(rim.systemIndex4));
input.Append("</index4>");
input.Append("<docid>");
input.Append(SecurityElement.Escape(rim.systemIndex5));
input.Append("</docid>");
input.Append("<createdate>");
input.Append(SecurityElement.Escape(rim.systemIndex6));
input.Append("</createdate>");
input.Append("<documenttype>");
input.Append(SecurityElement.Escape(rim.systemIndex7));
input.Append("</documenttype>");
input.Append("<index8>");
input.Append(SecurityElement.Escape(rim.systemIndex8));
input.Append("</index8>");
input.Append("<index9>");
input.Append(SecurityElement.Escape(rim.systemIndex9));
input.Append("</index9>");
input.Append("<index10>");
input.Append(SecurityElement.Escape(rim.systemIndex10));
input.Append("</index10>");
input.Append("<index11>");
input.Append(SecurityElement.Escape(rim.systemIndex11));
input.Append("</index11>");
input.Append("<index12>");
input.Append(SecurityElement.Escape(rim.systemIndex12));
input.Append("</index12>");
input.Append("<index13>");
input.Append(SecurityElement.Escape(rim.systemIndex13));
input.Append("</index13>");
input.Append("<index14>");
input.Append(SecurityElement.Escape(rim.systemIndex14));
input.Append("</index14>");
input.Append("<filename>");
input.Append(rim.fileName);
input.Append("</filename>");
input.Append("<docext>");
input.Append(rim.imageType);
input.Append("</docext>");
input.Append("<file>");
input.Append(rim.fileStream);
input.Append("</file>");
input.Append("</rviimport>");
String xmlString = input.ToString();
String res;
res = callWebService(xmlString);
result = true;
}
catch (FileNotFoundException fnfe)
{
Log(rim.fileName + fnfe.ToString());
}
catch (IOException ioe)
{
Log(rim.fileName + ioe.ToString());
}
catch (Exception e)
{
Log(rim.systemIndex1 + e.ToString());
}
return result;
}
static private String callWebService(String xmlString)
{
// String rviDocumentImportUrl = "http://usmassvm24.doorgroup.com/papps/services/RVIDocumentImport";
String rviDocumentImportUrl = "D:/Pradeep/Assa Abloy/Source codes- From Client/Document Import Java/RVIDocumentImport";
RVIDocumentImportService rdis = new RVIDocumentImportService();
String res = "";
rdis.Url = rviDocumentImportUrl;
res = rdis.indexDocument(xmlString);
rdis.Dispose();
return res;
}
static public void Log(string logMessage)
{
using (StreamWriter sw = File.AppendText("C:\\ImportLogs\\" + DateTime.Today.ToString("MMddyyyy") + "Log.txt"))
{
sw.Write("\r\n");
sw.WriteLine(" {0} {1}", DateTime.Now.ToShortTimeString(),
DateTime.Now.ToShortDateString());
//sw.WriteLine(" :");
sw.WriteLine("{0}", logMessage);
sw.WriteLine("-------------------------------------------");
// Update the underlying file.
sw.Flush();
}
}
}