Neues Server Deployment

(Version 5.5)
This commit is contained in:
Daniel Schick 2019-08-16 05:41:45 +00:00
parent 39e9f4d9f2
commit a5950b3683
3 changed files with 155 additions and 126 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
(c) 2017 Informatikbüro Daniel Schick
(c) 2017-present Informatikbüro Daniel Schick
-->
<configuration>
<configSections>

Binary file not shown.

View File

@ -590,59 +590,72 @@ namespace bsmd.database
{
if (!entity.IsNew)
{
SqlCommand cmd = new SqlCommand();
using (SqlCommand cmd = new SqlCommand())
{
entity.PrepareDelete(cmd);
int queryResult = this.PerformNonQuery(cmd);
this.LogNonQueryResult(cmd.CommandText, queryResult);
}
}
if (this._closeConnectionAfterUse) this.Disconnect();
}
public void DeleteMessageErrors(Message message)
{
SqlCommand cmd = new SqlCommand();
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = string.Format("UPDATE Error SET Deleted = 1 WHERE MessageHeaderId='{0}'", message.Id);
int queryResult = this.PerformNonQuery(cmd);
this.LogNonQueryResult(cmd.CommandText, queryResult);
}
}
public void DeleteMessageViolations(Message message)
{
SqlCommand cmd = new SqlCommand();
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = string.Format("UPDATE Violation SET Deleted = 1 WHERE MessageHeaderId='{0}'", message.Id);
int queryResult = this.PerformNonQuery(cmd);
this.LogNonQueryResult(cmd.CommandText, queryResult);
}
}
public void DeleteSystemErrors(Message message)
{
SqlCommand cmd = new SqlCommand();
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = string.Format("UPDATE SystemError SET Deleted = 1 WHERE MessageHeaderId='{0}'", message.Id);
int queryResult = this.PerformNonQuery(cmd);
this.LogNonQueryResult(cmd.CommandText, queryResult);
}
}
public void Save(MessageCore core)
{
if (core.Customer != null)
{
SqlCommand cCmd = new SqlCommand();
using (SqlCommand cCmd = new SqlCommand())
{
core.Customer.PrepareSave(cCmd);
_log.DebugFormat("Saved Customer to Core: {0}", this.PerformNonQuery(cCmd));
core.CustomerId = core.Customer.Id;
}
}
SqlCommand cmd = new SqlCommand();
using (SqlCommand cmd = new SqlCommand())
{
core.PrepareSave(cmd);
int queryResult = this.PerformNonQuery(cmd);
this.LogNonQueryResult(cmd.CommandText, queryResult);
}
if (this._closeConnectionAfterUse) this.Disconnect();
}
public bool? GetMessageCoreQueryStatusFlag(Guid messageCoreId)
{
SqlCommand cmd = new SqlCommand();
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = string.Format("SELECT QueryNSWStatus FROM MessageCore WHERE Id = '{0}'", messageCoreId);
bool? result = this.PerformReadFlagQuery(cmd);
@ -650,12 +663,14 @@ namespace bsmd.database
return result;
}
}
public List<MessageHistory> GetMessageHistories(Guid messageId)
{
try
{
SqlCommand cmd = new SqlCommand();
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = MessageHistory.GetLoadCommand();
cmd.Parameters.AddWithValue("@ENTITYID", messageId);
IDataReader reader = this.PerformCommand(cmd);
@ -663,6 +678,7 @@ namespace bsmd.database
reader.Close();
return result;
}
}
catch(Exception ex)
{
_log.ErrorFormat("Error loadin message history: {0}", ex.Message);
@ -709,8 +725,8 @@ namespace bsmd.database
this.LoadViolationList(message);
this.LoadSystemErrorList(message);
SqlCommand cmd = new SqlCommand();
using (SqlCommand cmd = new SqlCommand())
{
DatabaseEntity msgClass = DBManager.CreateMessage(message.MessageNotificationClass);
if (msgClass != null)
@ -722,9 +738,9 @@ namespace bsmd.database
List<DatabaseEntity> statList = msgClass.LoadList(reader);
foreach (DatabaseEntity derivedMessage in statList)
{
if(message.MessageNotificationClass == Message.NotificationClass.HAZD)
if (message.MessageNotificationClass == Message.NotificationClass.HAZD)
{
if(derivedMessage is HAZ hAZ)
if (derivedMessage is HAZ hAZ)
(hAZ).IsDeparture = true;
}
message.Elements.Add(derivedMessage);
@ -733,12 +749,7 @@ namespace bsmd.database
}
}
}
/* Meldung ist überflüssig
else
{
_log.DebugFormat("cannot create a message class for notification type {0}", message.MessageNotificationClass);
}
*/
}
}
@ -784,12 +795,14 @@ namespace bsmd.database
// 3. MessageHistory Element speichern
// TODO: das könnte auch in einem Background Thread passieren, da der Wert erst irgendwann gelesen wird und aktuell nicht relevant ist
SqlCommand cmd = new SqlCommand();
using (SqlCommand cmd = new SqlCommand())
{
mh.PrepareSave(cmd);
int queryResult = this.PerformNonQuery(cmd);
this.LogNonQueryResult(cmd.CommandText, queryResult);
}
}
}
private void InitializeMessageHistoryTypes()
{
@ -1130,14 +1143,18 @@ namespace bsmd.database
#region WasteDisposalServiceProvider
/*
if (databaseEntity.GetType().IsAssignableFrom(typeof(WasteDisposalServiceProvider)))
{
WasteDisposalServiceProvider wdsp = databaseEntity as WasteDisposalServiceProvider;
}
*/
#endregion
cmd.Dispose();
}
#endregion
@ -1179,7 +1196,8 @@ namespace bsmd.database
internal Dictionary<int, string> LoadErrorTexts()
{
SqlCommand cmd = new SqlCommand();
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "SELECT ErrorCode, ErrorText FROM ErrorText";
SqlDataReader reader = this.PerformCommand(cmd);
Dictionary<int, string> result = new Dictionary<int, string>();
@ -1192,10 +1210,12 @@ namespace bsmd.database
reader.Close();
return result;
}
}
internal Dictionary<int, string> LoadViolationTexts()
{
SqlCommand cmd = new SqlCommand();
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "SELECT ViolationCode, ViolationText FROM ViolationText";
SqlDataReader reader = this.PerformCommand(cmd);
Dictionary<int, string> result = new Dictionary<int, string>();
@ -1208,6 +1228,7 @@ namespace bsmd.database
reader.Close();
return result;
}
}
#endregion
@ -1230,17 +1251,18 @@ namespace bsmd.database
internal void LoadSTATShipName(MessageCore core)
{
if (core == null) return;
SqlCommand cmd = new SqlCommand();
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "SELECT STAT.ShipName, STAT.GrossTonnage FROM STAT JOIN MessageHeader ON STAT.MessageHeaderId = MessageHeader.Id WHERE MessageHeader.MessageCoreId = @ID";
cmd.Parameters.AddWithValue("@ID", core.Id);
SqlDataReader reader = this.PerformCommand(cmd);
if(reader.Read())
if (reader.Read())
{
if (reader.IsDBNull(0))
core.Shipname = "";
else
core.Shipname = reader.GetString(0);
if(!reader.IsDBNull(1))
if (!reader.IsDBNull(1))
{
int grossTonnage = reader.GetInt32(1);
core.IsSmallShip = grossTonnage < 500;
@ -1248,11 +1270,13 @@ namespace bsmd.database
}
reader.Close();
}
}
internal void LoadETA_ETD(MessageCore core)
{
if (core == null) return;
SqlCommand cmd = new SqlCommand();
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "SELECT NOA_NOD.ETAToPortOfCall, NOA_NOD.ETAToKielCanal, NOA_NOD.ETDFromPortOfCall, NOA_NOD.ETDFromKielCanal FROM NOA_NOD JOIN MessageHeader ON NOA_NOD.MessageHeaderId = MessageHeader.Id WHERE MessageHeader.MessageCoreId = @ID";
cmd.Parameters.AddWithValue("@ID", core.Id);
SqlDataReader reader = this.PerformCommand(cmd);
@ -1270,6 +1294,7 @@ namespace bsmd.database
}
}
reader.Close();
}
if (!core.ETA_NOA_NOD.HasValue && !core.IsTransit && core.ETA.HasValue)
{
@ -1288,7 +1313,8 @@ namespace bsmd.database
internal void LoadATA(MessageCore core)
{
if (core == null) return;
SqlCommand cmd = new SqlCommand();
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "SELECT ATA.ATAPortOfCall FROM ATA JOIN MessageHeader ON ATA.MessageHeaderId = MessageHeader.Id WHERE MessageHeader.MessageCoreId = @ID";
cmd.Parameters.AddWithValue("@ID", core.Id);
SqlDataReader reader = this.PerformCommand(cmd);
@ -1298,11 +1324,13 @@ namespace bsmd.database
}
reader.Close();
}
}
internal void LoadATD(MessageCore core)
{
if (core == null) return;
SqlCommand cmd = new SqlCommand();
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "SELECT ATD.ATDPortOfCall FROM ATD JOIN MessageHeader ON ATD.MessageHeaderId = MessageHeader.Id WHERE MessageHeader.MessageCoreId = @ID";
cmd.Parameters.AddWithValue("@ID", core.Id);
SqlDataReader reader = this.PerformCommand(cmd);
@ -1312,6 +1340,7 @@ namespace bsmd.database
}
reader.Close();
}
}
#endregion