/[projects]/dao/DaoMqPump2/DaoMqPump2/Transport.cs
ViewVC logotype

Diff of /dao/DaoMqPump2/DaoMqPump2/Transport.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2165 by torben, Wed Mar 26 14:00:14 2014 UTC revision 2166 by torben, Fri May 16 18:24:05 2014 UTC
# Line 9  using IBM.WMQ; Line 9  using IBM.WMQ;
9  using MySql.Data.MySqlClient;  using MySql.Data.MySqlClient;
10  using System.Globalization;  using System.Globalization;
11    
12    using DaoCommon;
13    
14  namespace DaoMqPump2  namespace DaoMqPump2
15  {  {
16      public class Transport      public class Transport
# Line 124  namespace DaoMqPump2 Line 126  namespace DaoMqPump2
126    
127              if (statusData.lastrunOk == true)              if (statusData.lastrunOk == true)
128              {              {
129                  statusData.lastOkTime = getNowString();                  statusData.lastOkTime = DaoUtil.getNowString();
130    
131                  if (statusData.counter != startCounter)                  if (statusData.counter != startCounter)
132                  {                  {
133                      //Vi har transporteret beskeder - så gemmer vi lige transfer tidspunktet                      //Vi har transporteret beskeder - så gemmer vi lige transfer tidspunktet
134                      statusData.lastTransferTime = getNowString();                      statusData.lastTransferTime = DaoUtil.getNowString();
135                  }                  }
136              }              }
137              else              else
138              {              {
139                  addLogEntry(statusData.lastErrorMessage);                  addLogEntry(statusData.lastErrorMessage);
140                  statusData.lastErrorTime = getNowString();                  statusData.lastErrorTime = DaoUtil.getNowString();
141              }              }
142          }          }
143    
# Line 189  namespace DaoMqPump2 Line 191  namespace DaoMqPump2
191                          MySqlCommand updateCmd = new MySqlCommand(updateSql, sqlWriteConnection);                          MySqlCommand updateCmd = new MySqlCommand(updateSql, sqlWriteConnection);
192                          int numrows = updateCmd.ExecuteNonQuery();                          int numrows = updateCmd.ExecuteNonQuery();
193    
194                          translog.WriteLine(getNowString() + " " + msgString);                          translog.WriteLine(DaoUtil.getNowString() + " " + msgString);
195    
196                          if (numrows != 1)                          if (numrows != 1)
197                          {                          {
# Line 290  namespace DaoMqPump2 Line 292  namespace DaoMqPump2
292                                          string discarded_filename = getLogFilename(LogfileType.LogDiscarded);                                          string discarded_filename = getLogFilename(LogfileType.LogDiscarded);
293                                          using (StreamWriter discardedlog = new StreamWriter(discarded_filename, true))                                          using (StreamWriter discardedlog = new StreamWriter(discarded_filename, true))
294                                          {                                          {
295                                              discardedlog.WriteLine(getNowString() + " " + msgString);                                              discardedlog.WriteLine( DaoUtil.getNowString() + " " + msgString );
296                                          }                                          }
297                                          mqMgr.Commit();//fjern den afviste transaktion fra køen                                          mqMgr.Commit();//fjern den afviste transaktion fra køen
298                                          statusData.discardedCounter++;                                          statusData.discardedCounter++;
# Line 305  namespace DaoMqPump2 Line 307  namespace DaoMqPump2
307    
308                                      if (numrows == 1)                                      if (numrows == 1)
309                                      {                                      {
310                                          translog.WriteLine(getNowString() + " " + msgString);                                          translog.WriteLine( DaoUtil.getNowString() + " " + msgString );
311                                          mqMgr.Commit();                                          mqMgr.Commit();
312                                          statusData.counter++;                                          statusData.counter++;
313    
# Line 462  namespace DaoMqPump2 Line 464  namespace DaoMqPump2
464              return filename;              return filename;
465          }          }
466    
         public string getNowString()  
         {  
             DateTime now = DateTime.Now;  
   
             return now.ToString("s");  
         }  
   
         /* no used any where used added here for reference/ just in case */  
         private void sendErrorMail(string sub, string msg)  
         {  
             System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();  
             message.To.Add("thn@daoas.dk");  
             message.Subject = "Error from DaoMqPump2: " + sub;  
             message.From = new System.Net.Mail.MailAddress("no-reply@daoas.dk");  
             message.Body = msg;  
   
             System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("mail.dao.int");  
             smtp.Send(message);  
         }  
   
467          private bool validateSalt2Header(string salt2String)          private bool validateSalt2Header(string salt2String)
468          {          {
469              if (salt2String.Length < 66)              if (salt2String.Length < 66)
# Line 544  namespace DaoMqPump2 Line 526  namespace DaoMqPump2
526    
527          private void addLogEntry(string msg)          private void addLogEntry(string msg)
528          {          {
529              msg = getNowString() + " " + msg;              msg = DaoUtil.getNowString() + " " + msg;
530              lock (logEntries)              lock (logEntries)
531              {              {
532                  logEntries.AddFirst(msg);                  logEntries.AddFirst(msg);

Legend:
Removed from v.2165  
changed lines
  Added in v.2166

  ViewVC Help
Powered by ViewVC 1.1.20