Neues Server Deployment
(Version 5.5)
This commit is contained in:
parent
39e9f4d9f2
commit
a5950b3683
@ -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.
@ -590,78 +590,94 @@ namespace bsmd.database
|
||||
{
|
||||
if (!entity.IsNew)
|
||||
{
|
||||
SqlCommand cmd = new SqlCommand();
|
||||
entity.PrepareDelete(cmd);
|
||||
int queryResult = this.PerformNonQuery(cmd);
|
||||
this.LogNonQueryResult(cmd.CommandText, queryResult);
|
||||
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();
|
||||
cmd.CommandText = string.Format("UPDATE Error SET Deleted = 1 WHERE MessageHeaderId='{0}'", message.Id);
|
||||
int queryResult = this.PerformNonQuery(cmd);
|
||||
this.LogNonQueryResult(cmd.CommandText, queryResult);
|
||||
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();
|
||||
cmd.CommandText = string.Format("UPDATE Violation SET Deleted = 1 WHERE MessageHeaderId='{0}'", message.Id);
|
||||
int queryResult = this.PerformNonQuery(cmd);
|
||||
this.LogNonQueryResult(cmd.CommandText, queryResult);
|
||||
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();
|
||||
cmd.CommandText = string.Format("UPDATE SystemError SET Deleted = 1 WHERE MessageHeaderId='{0}'", message.Id);
|
||||
int queryResult = this.PerformNonQuery(cmd);
|
||||
this.LogNonQueryResult(cmd.CommandText, queryResult);
|
||||
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();
|
||||
core.Customer.PrepareSave(cCmd);
|
||||
_log.DebugFormat("Saved Customer to Core: {0}", this.PerformNonQuery(cCmd));
|
||||
core.CustomerId = core.Customer.Id;
|
||||
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();
|
||||
core.PrepareSave(cmd);
|
||||
int queryResult = this.PerformNonQuery(cmd);
|
||||
this.LogNonQueryResult(cmd.CommandText, queryResult);
|
||||
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();
|
||||
cmd.CommandText = string.Format("SELECT QueryNSWStatus FROM MessageCore WHERE Id = '{0}'", messageCoreId);
|
||||
bool? result = this.PerformReadFlagQuery(cmd);
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
cmd.CommandText = string.Format("SELECT QueryNSWStatus FROM MessageCore WHERE Id = '{0}'", messageCoreId);
|
||||
bool? result = this.PerformReadFlagQuery(cmd);
|
||||
|
||||
if (this._closeConnectionAfterUse) this.Disconnect();
|
||||
if (this._closeConnectionAfterUse) this.Disconnect();
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public List<MessageHistory> GetMessageHistories(Guid messageId)
|
||||
{
|
||||
try
|
||||
{
|
||||
SqlCommand cmd = new SqlCommand();
|
||||
cmd.CommandText = MessageHistory.GetLoadCommand();
|
||||
cmd.Parameters.AddWithValue("@ENTITYID", messageId);
|
||||
IDataReader reader = this.PerformCommand(cmd);
|
||||
List<MessageHistory> result = MessageHistory.LoadList(reader);
|
||||
reader.Close();
|
||||
return result;
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
cmd.CommandText = MessageHistory.GetLoadCommand();
|
||||
cmd.Parameters.AddWithValue("@ENTITYID", messageId);
|
||||
IDataReader reader = this.PerformCommand(cmd);
|
||||
List<MessageHistory> result = MessageHistory.LoadList(reader);
|
||||
reader.Close();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
@ -709,36 +725,31 @@ namespace bsmd.database
|
||||
this.LoadViolationList(message);
|
||||
this.LoadSystemErrorList(message);
|
||||
|
||||
SqlCommand cmd = new SqlCommand();
|
||||
|
||||
DatabaseEntity msgClass = DBManager.CreateMessage(message.MessageNotificationClass);
|
||||
|
||||
if (msgClass != null)
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
msgClass.PrepareLoadCommand(cmd, Message.LoadFilter.MESSAGEHEADER, message.Id);
|
||||
SqlDataReader reader = this.PerformCommand(cmd);
|
||||
if (reader != null)
|
||||
DatabaseEntity msgClass = DBManager.CreateMessage(message.MessageNotificationClass);
|
||||
|
||||
if (msgClass != null)
|
||||
{
|
||||
List<DatabaseEntity> statList = msgClass.LoadList(reader);
|
||||
foreach (DatabaseEntity derivedMessage in statList)
|
||||
msgClass.PrepareLoadCommand(cmd, Message.LoadFilter.MESSAGEHEADER, message.Id);
|
||||
SqlDataReader reader = this.PerformCommand(cmd);
|
||||
if (reader != null)
|
||||
{
|
||||
if(message.MessageNotificationClass == Message.NotificationClass.HAZD)
|
||||
List<DatabaseEntity> statList = msgClass.LoadList(reader);
|
||||
foreach (DatabaseEntity derivedMessage in statList)
|
||||
{
|
||||
if(derivedMessage is HAZ hAZ)
|
||||
(hAZ).IsDeparture = true;
|
||||
if (message.MessageNotificationClass == Message.NotificationClass.HAZD)
|
||||
{
|
||||
if (derivedMessage is HAZ hAZ)
|
||||
(hAZ).IsDeparture = true;
|
||||
}
|
||||
message.Elements.Add(derivedMessage);
|
||||
derivedMessage.MessageHeader = message;
|
||||
this.LoadDependingLists(derivedMessage);
|
||||
}
|
||||
message.Elements.Add(derivedMessage);
|
||||
derivedMessage.MessageHeader = message;
|
||||
this.LoadDependingLists(derivedMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Meldung ist überflüssig
|
||||
else
|
||||
{
|
||||
_log.DebugFormat("cannot create a message class for notification type {0}", message.MessageNotificationClass);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -784,10 +795,12 @@ 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();
|
||||
mh.PrepareSave(cmd);
|
||||
int queryResult = this.PerformNonQuery(cmd);
|
||||
this.LogNonQueryResult(cmd.CommandText, queryResult);
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
mh.PrepareSave(cmd);
|
||||
int queryResult = this.PerformNonQuery(cmd);
|
||||
this.LogNonQueryResult(cmd.CommandText, queryResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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,34 +1196,38 @@ namespace bsmd.database
|
||||
|
||||
internal Dictionary<int, string> LoadErrorTexts()
|
||||
{
|
||||
SqlCommand cmd = new SqlCommand();
|
||||
cmd.CommandText = "SELECT ErrorCode, ErrorText FROM ErrorText";
|
||||
SqlDataReader reader = this.PerformCommand(cmd);
|
||||
Dictionary<int, string> result = new Dictionary<int, string>();
|
||||
while (reader.Read())
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
int errorCode = reader.GetInt32(0);
|
||||
string errorText = reader.GetString(1);
|
||||
result[errorCode] = errorText;
|
||||
cmd.CommandText = "SELECT ErrorCode, ErrorText FROM ErrorText";
|
||||
SqlDataReader reader = this.PerformCommand(cmd);
|
||||
Dictionary<int, string> result = new Dictionary<int, string>();
|
||||
while (reader.Read())
|
||||
{
|
||||
int errorCode = reader.GetInt32(0);
|
||||
string errorText = reader.GetString(1);
|
||||
result[errorCode] = errorText;
|
||||
}
|
||||
reader.Close();
|
||||
return result;
|
||||
}
|
||||
reader.Close();
|
||||
return result;
|
||||
}
|
||||
|
||||
internal Dictionary<int, string> LoadViolationTexts()
|
||||
{
|
||||
SqlCommand cmd = new SqlCommand();
|
||||
cmd.CommandText = "SELECT ViolationCode, ViolationText FROM ViolationText";
|
||||
SqlDataReader reader = this.PerformCommand(cmd);
|
||||
Dictionary<int, string> result = new Dictionary<int, string>();
|
||||
while (reader.Read())
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
int violationCode = reader.GetInt32(0);
|
||||
string violationText = reader.GetString(1);
|
||||
result[violationCode] = violationText;
|
||||
cmd.CommandText = "SELECT ViolationCode, ViolationText FROM ViolationText";
|
||||
SqlDataReader reader = this.PerformCommand(cmd);
|
||||
Dictionary<int, string> result = new Dictionary<int, string>();
|
||||
while (reader.Read())
|
||||
{
|
||||
int violationCode = reader.GetInt32(0);
|
||||
string violationText = reader.GetString(1);
|
||||
result[violationCode] = violationText;
|
||||
}
|
||||
reader.Close();
|
||||
return result;
|
||||
}
|
||||
reader.Close();
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -1230,46 +1251,50 @@ namespace bsmd.database
|
||||
internal void LoadSTATShipName(MessageCore core)
|
||||
{
|
||||
if (core == null) return;
|
||||
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())
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
if (reader.IsDBNull(0))
|
||||
core.Shipname = "";
|
||||
else
|
||||
core.Shipname = reader.GetString(0);
|
||||
if(!reader.IsDBNull(1))
|
||||
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())
|
||||
{
|
||||
int grossTonnage = reader.GetInt32(1);
|
||||
core.IsSmallShip = grossTonnage < 500;
|
||||
if (reader.IsDBNull(0))
|
||||
core.Shipname = "";
|
||||
else
|
||||
core.Shipname = reader.GetString(0);
|
||||
if (!reader.IsDBNull(1))
|
||||
{
|
||||
int grossTonnage = reader.GetInt32(1);
|
||||
core.IsSmallShip = grossTonnage < 500;
|
||||
}
|
||||
}
|
||||
reader.Close();
|
||||
}
|
||||
reader.Close();
|
||||
}
|
||||
|
||||
internal void LoadETA_ETD(MessageCore core)
|
||||
{
|
||||
if (core == null) return;
|
||||
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);
|
||||
if (reader.Read())
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
if (core.IsTransit)
|
||||
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);
|
||||
if (reader.Read())
|
||||
{
|
||||
if (!reader.IsDBNull(1)) core.ETA_NOA_NOD = reader.GetDateTime(1);
|
||||
if (!reader.IsDBNull(3)) core.ETD_NOA_NOD = reader.GetDateTime(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!reader.IsDBNull(0)) core.ETA_NOA_NOD = reader.GetDateTime(0);
|
||||
if (!reader.IsDBNull(2)) core.ETD_NOA_NOD = reader.GetDateTime(2);
|
||||
if (core.IsTransit)
|
||||
{
|
||||
if (!reader.IsDBNull(1)) core.ETA_NOA_NOD = reader.GetDateTime(1);
|
||||
if (!reader.IsDBNull(3)) core.ETD_NOA_NOD = reader.GetDateTime(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!reader.IsDBNull(0)) core.ETA_NOA_NOD = reader.GetDateTime(0);
|
||||
if (!reader.IsDBNull(2)) core.ETD_NOA_NOD = reader.GetDateTime(2);
|
||||
}
|
||||
}
|
||||
reader.Close();
|
||||
}
|
||||
reader.Close();
|
||||
|
||||
if (!core.ETA_NOA_NOD.HasValue && !core.IsTransit && core.ETA.HasValue)
|
||||
{
|
||||
@ -1288,29 +1313,33 @@ namespace bsmd.database
|
||||
internal void LoadATA(MessageCore core)
|
||||
{
|
||||
if (core == null) return;
|
||||
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);
|
||||
if (reader.Read())
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
if (!reader.IsDBNull(0)) core.ATA = reader.GetDateTime(0);
|
||||
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);
|
||||
if (reader.Read())
|
||||
{
|
||||
if (!reader.IsDBNull(0)) core.ATA = reader.GetDateTime(0);
|
||||
}
|
||||
reader.Close();
|
||||
}
|
||||
reader.Close();
|
||||
}
|
||||
|
||||
internal void LoadATD(MessageCore core)
|
||||
{
|
||||
if (core == null) return;
|
||||
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);
|
||||
if (reader.Read())
|
||||
using (SqlCommand cmd = new SqlCommand())
|
||||
{
|
||||
if (!reader.IsDBNull(0)) core.ATD = reader.GetDateTime(0);
|
||||
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);
|
||||
if (reader.Read())
|
||||
{
|
||||
if (!reader.IsDBNull(0)) core.ATD = reader.GetDateTime(0);
|
||||
}
|
||||
reader.Close();
|
||||
}
|
||||
reader.Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Loading…
Reference in New Issue
Block a user