small bugfixes regarding failsave moving of files and setting core state after receiving dbh messages
This commit is contained in:
parent
259fe00f43
commit
56934660c1
@ -4,6 +4,7 @@
|
||||
using bsmd.database;
|
||||
using log4net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml.Serialization;
|
||||
@ -186,9 +187,21 @@ namespace bsmd.dbh
|
||||
|
||||
DBManager.Instance.Save(sentMessage);
|
||||
|
||||
if (!(aCore.Cancelled ?? false))
|
||||
// das hier ist too easy, der Core kann nur auf RESPONDED gehen wenn nichts mehr auf TOSEND
|
||||
// oder error steht
|
||||
List<Message> messages = DBManager.Instance.GetMessagesForCore(aCore, DBManager.MessageLoad.ALL);
|
||||
bool somethingStillInToSend = false;
|
||||
foreach (Message message in messages)
|
||||
{
|
||||
if((message.InternalStatus == Message.BSMDStatus.TOSEND) ||
|
||||
(message.InternalStatus == Message.BSMDStatus.SENT))
|
||||
somethingStillInToSend = true;
|
||||
}
|
||||
|
||||
if (!(aCore.Cancelled ?? false) && !somethingStillInToSend)
|
||||
aCore.BSMDStatusInternal = MessageCore.BSMDStatus.RESPONDED;
|
||||
|
||||
_log.InfoFormat("Core {0} set to status {1}", aCore.DisplayId, aCore.BSMDStatusInternal);
|
||||
DBManager.Instance.Save(aCore);
|
||||
result = true;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2015-2017 schick Informatik
|
||||
// Copyright (c) 2015- schick Informatik
|
||||
// Description: Bearbeitung von Antworten (dateibasiert..)
|
||||
|
||||
using bsmd.database;
|
||||
@ -300,10 +300,12 @@ namespace bsmd.hisnord
|
||||
{
|
||||
// archive file
|
||||
string answerArchiveDir = Path.Combine(Properties.Settings.Default.TransmitterRoot, Properties.Settings.Default.AnswerArchiveDir);
|
||||
|
||||
string archiveFile = Path.Combine(answerArchiveDir, Path.GetFileName(answerFile));
|
||||
try
|
||||
{
|
||||
File.Move(answerFile, Path.Combine(answerArchiveDir, Path.GetFileName(answerFile)));
|
||||
if(File.Exists(archiveFile))
|
||||
File.Delete(archiveFile);
|
||||
File.Move(answerFile, archiveFile);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user