7 |
public class DaoUtil |
public class DaoUtil |
8 |
{ |
{ |
9 |
|
|
|
public static string getNowString() |
|
|
{ |
|
|
DateTime now = DateTime.Now; |
|
10 |
|
|
11 |
return now.ToString("s"); |
|
12 |
} |
|
13 |
|
|
14 |
/* no used any where used added here for reference/ just in case */ |
/* no used any where used added here for reference/ just in case */ |
15 |
private void sendErrorMail(string sub, string msg) |
private void sendErrorMail(string sub, string msg) |
23 |
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("mail.dao.int"); |
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("mail.dao.int"); |
24 |
smtp.Send(message); |
smtp.Send(message); |
25 |
} |
} |
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
public static bool validateSalt2Header(string salt2String) |
31 |
|
{ |
32 |
|
if (salt2String.Length < 66) |
33 |
|
{ |
34 |
|
//addLogEntry("Transaction too short - discarding"); |
35 |
|
return false; |
36 |
|
} |
37 |
|
|
38 |
|
|
39 |
|
int result; |
40 |
|
long result_long; |
41 |
|
|
42 |
|
string afsender = salt2String.Substring(0, 5); |
43 |
|
string modtager = salt2String.Substring(5, 5); |
44 |
|
string afsenderTegnSaet = salt2String.Substring(10, 6); |
45 |
|
string standardNavn = salt2String.Substring(16, 6); |
46 |
|
string standardVersion = salt2String.Substring(22, 3); |
47 |
|
string afsenderSekvensnr = salt2String.Substring(25, 6); |
48 |
|
string afsenderTidsstempel = salt2String.Substring(31, 14); |
49 |
|
string afsenderBakkeIdent = salt2String.Substring(45, 5); |
50 |
|
string modtagerBakkeIdent = salt2String.Substring(50, 5); |
51 |
|
string transaktionForkortelse = salt2String.Substring(55, 4); |
52 |
|
string transaktionsLaengde = salt2String.Substring(59, 5); |
53 |
|
string prioritet = salt2String.Substring(64, 1); |
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
if (int.TryParse(standardVersion.Trim(), out result) == false) // standardVersion _skal_ være en int |
58 |
|
{ |
59 |
|
//addLogEntry("standardVersion not an integer, discarding"); |
60 |
|
return false; |
61 |
|
} |
62 |
|
|
63 |
|
if (int.TryParse(afsenderSekvensnr.Trim(), out result) == false) // afsenderSekvensnr _skal_ være en int |
64 |
|
{ |
65 |
|
//addLogEntry("afsenderSekvensnr not an integer, discarding"); |
66 |
|
return false; |
67 |
|
} |
68 |
|
|
69 |
|
if (long.TryParse(afsenderTidsstempel.Trim(), out result_long) == false) // afsenderTidsstempel _skal_ være en long |
70 |
|
{ |
71 |
|
//addLogEntry("afsenderTidsstempel not a long integer, discarding"); |
72 |
|
return false; |
73 |
|
} |
74 |
|
|
75 |
|
if (int.TryParse(transaktionsLaengde.Trim(), out result) == false) // transaktionsLaengde _skal_ være en int |
76 |
|
{ |
77 |
|
//addLogEntry("transaktionsLaengde not an integer, discarding"); |
78 |
|
return false; |
79 |
|
} |
80 |
|
|
81 |
|
if (int.TryParse(prioritet.Trim(), out result) == false) // prioritet _skal_ være en int |
82 |
|
{ |
83 |
|
//addLogEntry("prioritet not an integer, discarding"); |
84 |
|
return false; |
85 |
|
} |
86 |
|
|
87 |
|
return true; |
88 |
|
} |
89 |
|
|
90 |
} |
} |
91 |
} |
} |