/[projects]/dao/DaoMqPump2/DaoCommon/DaoUtil.cs
ViewVC logotype

Annotation of /dao/DaoMqPump2/DaoCommon/DaoUtil.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2168 - (hide annotations) (download)
Fri May 16 20:56:22 2014 UTC (10 years, 1 month ago) by torben
File size: 3237 byte(s)
WIP
1 torben 2166 using System;
2     using System.Collections.Generic;
3     using System.Text;
4    
5     namespace DaoCommon
6     {
7     public class DaoUtil
8     {
9    
10    
11    
12 torben 2168
13    
14 torben 2166 /* no used any where used added here for reference/ just in case */
15     private void sendErrorMail(string sub, string msg)
16     {
17     System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
18     message.To.Add("thn@daoas.dk");
19     message.Subject = "Error from DaoMqPump2: " + sub;
20     message.From = new System.Net.Mail.MailAddress("no-reply@daoas.dk");
21     message.Body = msg;
22    
23     System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("mail.dao.int");
24     smtp.Send(message);
25     }
26 torben 2168
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 torben 2166 }
91     }

  ViewVC Help
Powered by ViewVC 1.1.20