forked from GNOME/chronojump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.cs
677 lines (567 loc) · 22.9 KB
/
server.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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
/*
* This file is part of ChronoJump
*
* ChronoJump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ChronoJump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Copyright (C) 2004-2009 Xavier de Blas <xaviblas@gmail.com>
*/
using System;
using System.Data;
using System.Text; //StringBuilder
using System.Threading;
using Mono.Unix;
using Gtk;
using Gdk;
using Glade;
using System.Net;
using System.Collections;
//test comment
public class Server
{
public static bool CanI(string action, string clientVersion) {
try {
ChronojumpServer myServer = new ChronojumpServer();
return myServer.CanINew(action, clientVersion);
} catch {
return false;
}
}
/*
private static string getIP() {
string strHostName = "";
strHostName = System.Net.Dns.GetHostName();
IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(strHostName);
IPAddress[] addr = ipEntry.AddressList;
return addr[addr.Length-1].ToString();
}
*/
public static string Ping(bool doInsertion, string progName, string progVersion) {
try {
ChronojumpServer myServer = new ChronojumpServer();
Log.WriteLine(myServer.ConnectDatabase());
int evalSID = Convert.ToInt32(SqlitePreferences.Select("evaluatorServerID"));
string machineID = SqlitePreferences.Select("machineID");
ServerPing myPing = new ServerPing(evalSID, progName + " " + progVersion, Util.GetOS(),
//getIP(), DateTime.Now); //evaluator IP, date
machineID, DateTime.Now); //evaluator machineID, date
//if !doIsertion nothing will be uploaded,
//is ok for uploadPerson to know if server is online
string versionAvailable = myServer.UploadPing(myPing, doInsertion);
Log.WriteLine(myServer.DisConnectDatabase());
return versionAvailable;
} catch (Exception e){
Log.WriteLine("Server Connection "+e.Message);
return Constants.ServerOffline;
}
}
/*
* server session update
*/
static Thread thread;
public static SessionUploadWindow sessionUploadWin;
[Widget] static Gtk.Window app1;
static Session currentSession;
static string progName;
static string progVersion;
static bool serverSessionError;
static bool needUpdateServerSession;
static bool updatingServerSession;
static SessionUploadPersonData sessionUploadPersonData;
static int progressBarPersonsNum;
static int countPersons;
public static void InitializeSessionVariables(Gtk.Window mainApp, Session session, string programName, string programVersion) {
app1 = mainApp;
currentSession = session;
progName = programName;
progVersion = programVersion;
serverSessionError = false;
needUpdateServerSession = false;
updatingServerSession = false;
sessionUploadPersonData = new SessionUploadPersonData();
countPersons = 0;
progressBarPersonsNum = 0;
}
public static void ThreadStart() {
thread = new Thread(new ThreadStart(on_server_upload_session_started));
GLib.Idle.Add (new GLib.IdleHandler (pulseGTKServer));
thread.Start();
}
private static bool pulseGTKServer ()
{
if(! thread.IsAlive) {
sessionUploadWin.UploadFinished();
Log.Write("dying");
return false;
}
if (serverSessionError) {
new DialogMessage(Constants.MessageTypes.WARNING, Catalog.GetString("Error uploading session to server"));
return false;
}
//need to do this, if not it crashes because chronopicWin gets died by thread ending
sessionUploadWin = SessionUploadWindow.Show(app1);
if(countPersons == 0)
sessionUploadWin.PulseProgressbar();
//activity on pulsebar
sessionUploadWin.UpdatePulsebar();
if(needUpdateServerSession && !updatingServerSession) {
//prevent that FillData is called again with same data
updatingServerSession = true;
//update progressBar
sessionUploadWin.UpdateProgressbar(
Util.DivideSafeFraction(++countPersons, progressBarPersonsNum));
//fill data
sessionUploadWin.FillData(sessionUploadPersonData);
//not need to update until there's more data coming from the other thread
updatingServerSession = false;
needUpdateServerSession = false;
}
Thread.Sleep (50);
Log.Write(thread.ThreadState.ToString());
return true;
}
private static void on_server_upload_session_started ()
{
int evalSID = Convert.ToInt32(SqlitePreferences.Select("evaluatorServerID"));
try {
ChronojumpServer myServer = new ChronojumpServer();
Log.WriteLine(myServer.ConnectDatabase());
int state = (int) Constants.ServerSessionStates.UPLOADINGSESSION;
//create ServerSession based on Session currentSession
ServerSession serverSession = new ServerSession(currentSession, evalSID, progName + " " + progVersion,
Util.GetOS(), DateTime.Now, state);
//if uploading session for first time
if(currentSession.ServerUniqueID == Constants.ServerUndefinedID)
{
//upload ServerSession
int idAtServer = myServer.UploadSession(serverSession);
//update session currentSession (serverUniqueID) on client database
currentSession.ServerUniqueID = idAtServer;
SqliteSession.UpdateServerUniqueID(currentSession.UniqueID, currentSession.ServerUniqueID);
}
state = (int) Constants.ServerSessionStates.UPLOADINGDATA;
myServer.UpdateSession(currentSession.ServerUniqueID, state);
sessionUploadPersonData.testTypes = "";
string testTypesSeparator = "";
sessionUploadPersonData.sports = "";
string sportsSeparator = "";
//upload persons (updating also person.serverUniqueID locally)
ArrayList persons = SqlitePersonSession.SelectCurrentSessionPersons(serverSession.UniqueID);
Constants.UploadCodes uCode;
ArrayList notToUpload = SqlitePersonSessionNotUpload.SelectAll(currentSession.UniqueID);
//store in variable for updating progressBar from other thread
progressBarPersonsNum = persons.Count - notToUpload.Count;
foreach(Person p in persons) {
Person person = p;
//do not continue with this person if has been banned to upload
if(Util.FoundInArrayList(notToUpload, person.UniqueID.ToString()))
continue;
PersonSession ps = SqlitePersonSession.Select(person.UniqueID, currentSession.UniqueID);
//check person if exists
if(person.ServerUniqueID != Constants.ServerUndefinedID)
uCode = Constants.UploadCodes.EXISTS;
else {
uCode = Constants.UploadCodes.OK;
person = serverUploadPerson(myServer, person, serverSession.UniqueID);
}
//if sport is user defined, upload it
//and when upload the person, do it with new sportID
Sport sport = SqliteSport.Select(ps.SportID);
//but record old sport ID because locally will be a change in serverUniqueID
//(with slite update)
//but local sport has not to be changed
int sportUserDefinedLocal = -1;
if(sport.UserDefined) {
sportUserDefinedLocal = sport.UniqueID;
//this will be uploaded
int newSport = myServer.UploadSport(sport);
if(newSport != -1) {
ps.SportID = newSport;
sessionUploadPersonData.sports += sportsSeparator + sport.Name;
sportsSeparator = ", ";
}
}
//a person can be in the database for one session,
//but maybe now we add jumps from another session and we should add an entry at personsession
serverUploadPersonSessionIfNeeded(myServer, person.ServerUniqueID,
currentSession.ServerUniqueID, ps, sportUserDefinedLocal);
//other thread updates the gui:
sessionUploadPersonData.person = person;
sessionUploadPersonData.personCode = uCode;
//upload jumps
int countU = 0;
int countE = 0;
int countS = 0;
string [] jumps = SqliteJump.SelectJumps(currentSession.UniqueID, person.UniqueID, "", "");
Sqlite.Open();
foreach(string myJump in jumps) {
string [] js = myJump.Split(new char[] {':'});
//select jump
Jump test = SqliteJump.SelectJumpData(Convert.ToInt32(js[1]), true); //uniqueID
//fix it to server person, session keys
test.PersonID = person.ServerUniqueID;
test.SessionID = currentSession.ServerUniqueID;
//if test is not simulated and has not been uploaded,
//see if it's type is not predefined and is not in the database
//then upload it first
if(test.Simulated == 0) {
//upload jumpType if is user defined and doesn't exists in server database
//JumpType type = new JumpType(test.Type);
JumpType type = SqliteJumpType.SelectAndReturnJumpType(test.Type, true);
if( ! type.IsPredefined) {
//Console.WriteLine("USER DEFINED TEST: " + test.Type);
//
//this uploads the new type, as it's user created, it will be like this
//eg: for user defined jumpType: "supra" of evaluatorServerID: 9
//at server will be "supra-9"
//then two problems get solved:
//1.- every evaluator that uploads a type will have a different name
//than other evaluator uploading a type that is named the same but could be different
//(one can think that "supra" is another thing
//2- when the same evaluator upload some supra's, only a new type is created
//test.Type = myServer.UploadJumpType(type, evalSID);
//int testType = (int) Constants.TestTypes.JUMP;
//string insertedType = myServer.UploadTestType(Constants.TestTypes.JUMP, type, evalSID);
//string insertedType = myServer.UploadTestType(testType, type, evalSID);
string insertedType = myServer.UploadJumpType(type, evalSID);
if(insertedType != "-1") {
//record type in test (with the "-7" if it's done by evaluator 7)
test.Type = insertedType;
//show user uploaded type (without the "-7")
sessionUploadPersonData.testTypes += testTypesSeparator + type.Name;
testTypesSeparator = ", ";
}
//test.Type in the server will have the correct name "supra-9"
}
}
//upload... (if not because of simulated or uploaded before, report also the user)
uCode = serverUploadTest(myServer, Constants.TestTypes.JUMP, Constants.JumpTable, test);
if(uCode == Constants.UploadCodes.OK)
countU ++;
else if(uCode == Constants.UploadCodes.EXISTS)
countE ++;
else //SIMULATED
countS ++;
}
Sqlite.Close();
//other thread updates the gui:
sessionUploadPersonData.jumpsU = countU;
sessionUploadPersonData.jumpsE = countE;
sessionUploadPersonData.jumpsS = countS;
//upload jumpsRj
countU = 0;
countE = 0;
countS = 0;
string [] jumpsRj = SqliteJumpRj.SelectJumps(currentSession.UniqueID, person.UniqueID, "", "");
Sqlite.Open();
foreach(string myJump in jumpsRj) {
string [] js = myJump.Split(new char[] {':'});
//select jump
JumpRj test = SqliteJumpRj.SelectJumpData(Constants.JumpRjTable, Convert.ToInt32(js[1]), true); //uniqueID
//fix it to server person, session keys
test.PersonID = person.ServerUniqueID;
test.SessionID = currentSession.ServerUniqueID;
if(test.Simulated == 0) {
JumpType type = SqliteJumpType.SelectAndReturnJumpRjType(test.Type, true);
if( ! type.IsPredefined) {
string insertedType = myServer.UploadJumpRjType(type, evalSID);
if(insertedType != "-1") {
test.Type = insertedType;
sessionUploadPersonData.testTypes += testTypesSeparator + type.Name;
testTypesSeparator = ", ";
}
}
}
//upload...
uCode = serverUploadTest(myServer, Constants.TestTypes.JUMP_RJ, Constants.JumpRjTable, test);
if(uCode == Constants.UploadCodes.OK)
countU ++;
else if(uCode == Constants.UploadCodes.EXISTS)
countE ++;
else //SIMULATED
countS ++;
}
Sqlite.Close();
//other thread updates the gui:
sessionUploadPersonData.jumpsRjU = countU;
sessionUploadPersonData.jumpsRjE = countE;
sessionUploadPersonData.jumpsRjS = countS;
//upload runs
countU = 0;
countE = 0;
countS = 0;
string [] runs = SqliteRun.SelectRuns(currentSession.UniqueID, person.UniqueID, "");
Sqlite.Open();
foreach(string myRun in runs) {
string [] js = myRun.Split(new char[] {':'});
//select run
Run test = SqliteRun.SelectRunData(Convert.ToInt32(js[1]), true); //uniqueID
//fix it to server person, session keys
test.PersonID = person.ServerUniqueID;
test.SessionID = currentSession.ServerUniqueID;
if(test.Simulated == 0) {
RunType type = SqliteRunType.SelectAndReturnRunType(test.Type, true);
if( ! type.IsPredefined) {
string insertedType = myServer.UploadRunType(type, evalSID);
if(insertedType != "-1") {
test.Type = insertedType;
sessionUploadPersonData.testTypes += testTypesSeparator + type.Name;
testTypesSeparator = ", ";
}
}
}
//upload...
uCode = serverUploadTest(myServer, Constants.TestTypes.RUN, Constants.RunTable, test);
if(uCode == Constants.UploadCodes.OK)
countU ++;
else if(uCode == Constants.UploadCodes.EXISTS)
countE ++;
else //SIMULATED
countS ++;
}
Sqlite.Close();
//other thread updates the gui:
sessionUploadPersonData.runsU = countU;
sessionUploadPersonData.runsE = countE;
sessionUploadPersonData.runsS = countS;
//upload runs intervallic
countU = 0;
countE = 0;
countS = 0;
string [] runsI = SqliteRunInterval.SelectRuns(currentSession.UniqueID, person.UniqueID, "");
Sqlite.Open();
foreach(string myRun in runsI) {
string [] js = myRun.Split(new char[] {':'});
//select run
RunInterval test = SqliteRunInterval.SelectRunData(Constants.RunIntervalTable, Convert.ToInt32(js[1]), true); //uniqueID
//fix it to server person, session keys
test.PersonID = person.ServerUniqueID;
test.SessionID = currentSession.ServerUniqueID;
if(test.Simulated == 0) {
RunType type = SqliteRunIntervalType.SelectAndReturnRunIntervalType(test.Type, true);
if( ! type.IsPredefined) {
string insertedType = myServer.UploadRunIntervalType(type, evalSID);
if(insertedType != "-1") {
test.Type = insertedType;
sessionUploadPersonData.testTypes += testTypesSeparator + type.Name;
testTypesSeparator = ", ";
}
}
}
//upload...
uCode = serverUploadTest(myServer, Constants.TestTypes.RUN_I, Constants.RunIntervalTable, test);
if(uCode == Constants.UploadCodes.OK)
countU ++;
else if(uCode == Constants.UploadCodes.EXISTS)
countE ++;
else //SIMULATED
countS ++;
}
Sqlite.Close();
//other thread updates the gui:
sessionUploadPersonData.runsIU = countU;
sessionUploadPersonData.runsIE = countE;
sessionUploadPersonData.runsIS = countS;
//upload reaction times
countU = 0;
countE = 0;
countS = 0;
string [] rts = SqliteReactionTime.SelectReactionTimes(currentSession.UniqueID, person.UniqueID);
Sqlite.Open();
foreach(string myRt in rts) {
string [] js = myRt.Split(new char[] {':'});
//select rt
ReactionTime test = SqliteReactionTime.SelectReactionTimeData(Convert.ToInt32(js[1]), true); //uniqueID
//fix it to server person, session keys
test.PersonID = person.ServerUniqueID;
test.SessionID = currentSession.ServerUniqueID;
//upload...
uCode = serverUploadTest(myServer, Constants.TestTypes.RT, Constants.ReactionTimeTable, test);
if(uCode == Constants.UploadCodes.OK)
countU ++;
else if(uCode == Constants.UploadCodes.EXISTS)
countE ++;
else //SIMULATED
countS ++;
}
Sqlite.Close();
//other thread updates the gui:
sessionUploadPersonData.rtsU = countU;
sessionUploadPersonData.rtsE = countE;
sessionUploadPersonData.rtsS = countS;
//upload pulses
countU = 0;
countE = 0;
countS = 0;
string [] pulses = SqlitePulse.SelectPulses(currentSession.UniqueID, person.UniqueID);
Sqlite.Open();
foreach(string myPulse in pulses) {
string [] js = myPulse.Split(new char[] {':'});
//select pulse
Pulse test = SqlitePulse.SelectPulseData(Convert.ToInt32(js[1]), true); //uniqueID
//fix it to server person, session keys
test.PersonID = person.ServerUniqueID;
test.SessionID = currentSession.ServerUniqueID;
//upload...
uCode = serverUploadTest(myServer, Constants.TestTypes.PULSE, Constants.PulseTable, test);
if(uCode == Constants.UploadCodes.OK)
countU ++;
else if(uCode == Constants.UploadCodes.EXISTS)
countE ++;
else //SIMULATED
countS ++;
}
Sqlite.Close();
//other thread updates the gui:
sessionUploadPersonData.pulsesU = countU;
sessionUploadPersonData.pulsesE = countE;
sessionUploadPersonData.pulsesS = countS;
//upload multiChronopic
countU = 0;
countE = 0;
countS = 0;
string [] mcs = SqliteMultiChronopic.SelectTests(currentSession.UniqueID, person.UniqueID);
Sqlite.Open();
foreach(string mc in mcs) {
string [] js = mc.Split(new char[] {':'});
//select mc
MultiChronopic test = SqliteMultiChronopic.SelectMultiChronopicData(Convert.ToInt32(js[1]), true); //uniqueID
//fix it to server person, session keys
test.PersonID = person.ServerUniqueID;
test.SessionID = currentSession.ServerUniqueID;
//upload...
uCode = serverUploadTest(myServer, Constants.TestTypes.MULTICHRONOPIC, Constants.MultiChronopicTable, test);
if(uCode == Constants.UploadCodes.OK)
countU ++;
else if(uCode == Constants.UploadCodes.EXISTS)
countE ++;
else //SIMULATED
countS ++;
}
Sqlite.Close();
//other thread updates the gui:
sessionUploadPersonData.mcsU = countU;
sessionUploadPersonData.mcsE = countE;
sessionUploadPersonData.mcsS = countS;
needUpdateServerSession = true;
while(needUpdateServerSession) {
//wait until data is printed on the other thread
}
}
state = (int) Constants.ServerSessionStates.DONE;
//myServer.UpdateSession(currentSession.ServerUniqueID, (ServerSessionStates) Constants.ServerSessionStates.DONE);
myServer.UpdateSession(currentSession.ServerUniqueID, state);
Log.WriteLine(myServer.DisConnectDatabase());
} catch {
//other thread updates the gui:
serverSessionError = true;
}
}
//upload a person
private static Person serverUploadPerson(ChronojumpServer myServer, Person person, int serverSessionID)
{
int idAtServer = myServer.UploadPerson(person, serverSessionID);
//update person (serverUniqueID) on client database
person.ServerUniqueID = idAtServer;
SqlitePerson.Update(person);
return person;
}
private static void serverUploadPersonSessionIfNeeded(ChronojumpServer myServer,
int personServerID, int sessionServerID, PersonSession ps, int sportUserDefinedLocal)
{
//when update locally, don't put the user defined sport id at server
if(sportUserDefinedLocal != -1)
ps.SportID = sportUserDefinedLocal;
ps.UniqueID = -1;
ps.PersonID = personServerID;
ps.SessionID = sessionServerID;
myServer.UploadPersonSessionIfNeeded(ps);
}
//upload a test
private static Constants.UploadCodes serverUploadTest(ChronojumpServer myServer, Constants.TestTypes type, string tableName, Event myTest)
{
Constants.UploadCodes uCode;
if(myTest.Simulated == Constants.Simulated) {
//Test is simulated, don't upload
uCode = Constants.UploadCodes.SIMULATED;
} else if(myTest.Simulated > 0) {
//Test is already uploaded, don't upload
uCode = Constants.UploadCodes.EXISTS;
} else {
int idAtServer = -1;
switch (type) {
case Constants.TestTypes.JUMP :
Jump jump = (Jump)myTest;
idAtServer = myServer.UploadJump(jump);
break;
case Constants.TestTypes.JUMP_RJ :
JumpRj jumpRj = (JumpRj)myTest;
idAtServer = myServer.UploadJumpRj(jumpRj);
break;
case Constants.TestTypes.RUN :
Run run = (Run)myTest;
idAtServer = myServer.UploadRun(run);
break;
case Constants.TestTypes.RUN_I :
RunInterval runI = (RunInterval)myTest;
idAtServer = myServer.UploadRunI(runI);
break;
case Constants.TestTypes.RT :
ReactionTime rt = (ReactionTime)myTest;
idAtServer = myServer.UploadRT(rt);
break;
case Constants.TestTypes.PULSE :
Pulse pulse = (Pulse)myTest;
idAtServer = myServer.UploadPulse(pulse);
break;
case Constants.TestTypes.MULTICHRONOPIC :
MultiChronopic mc = (MultiChronopic)myTest;
idAtServer = myServer.UploadMultiChronopic(mc);
break;
}
//update test (simulated) on client database
myTest.Simulated = idAtServer;
SqliteEvent.UpdateSimulated(true, tableName, myTest.UniqueID, idAtServer);
uCode = Constants.UploadCodes.OK;
}
return uCode;
}
public static void ServerUploadEvaluator () {
try {
ChronojumpServer myServer = new ChronojumpServer();
Log.WriteLine(myServer.ConnectDatabase());
ServerEvaluator myEval = SqliteServer.SelectEvaluator(1);
bool success = false;
int evalSID = Convert.ToInt32(SqlitePreferences.Select("evaluatorServerID"));
if(evalSID == Constants.ServerUndefinedID) {
string idCode = myServer.UploadEvaluator(myEval);
myEval.Code = Util.FetchName(idCode);
myEval.Update(false);
evalSID = Util.FetchID(idCode);
SqlitePreferences.Update("evaluatorServerID", evalSID.ToString(), false);
success = true;
} else
success = myServer.EditEvaluator(myEval, evalSID);
if(success)
new DialogMessage(Constants.MessageTypes.INFO,
string.Format(Catalog.GetString("Successfully Uploaded evaluator with ID: {0}"), evalSID));
else
new DialogMessage(Constants.MessageTypes.WARNING,
string.Format(Catalog.GetString("Evaluator {0} has not been correctly uploaded. Maybe codes doesn't match."), evalSID));
Log.WriteLine(myServer.DisConnectDatabase());
} catch {
new DialogMessage(Constants.MessageTypes.WARNING, Constants.ServerOffline);
}
}
}