NSW Service für Wetris angelegt und getestet
This commit is contained in:
parent
cf869eff57
commit
878bef3dc3
Binary file not shown.
@ -10,6 +10,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace bsmd.database
|
||||
{
|
||||
@ -17,6 +18,7 @@ namespace bsmd.database
|
||||
/// <summary>
|
||||
/// message class for ship agent, new in NSW 3.0 (March 2016)
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class AGNT : DatabaseEntity
|
||||
{
|
||||
|
||||
@ -37,30 +39,35 @@ namespace bsmd.database
|
||||
[MaxLength(99)]
|
||||
[ENI2Validation]
|
||||
[Validation(ValidationCode.NOT_NULL)]
|
||||
[DataMember]
|
||||
public string AgentCompanyName { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[LookupName("AGNT.AgentStreetAndNumber")]
|
||||
[MaxLength(99)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string AgentStreetAndNumber { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[LookupName("AGNT.AgentPostalCode")]
|
||||
[MaxLength(99)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string AgentPostalCode { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[LookupName("AGNT.AgentCity")]
|
||||
[MaxLength(99)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string AgentCity { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[LookupName("AGNT.AgentCountry")]
|
||||
[MaxLength(99)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string AgentCountry { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
@ -69,12 +76,14 @@ namespace bsmd.database
|
||||
[MaxLength(99)]
|
||||
[ENI2Validation]
|
||||
[Validation(ValidationCode.NOT_NULL)]
|
||||
[DataMember]
|
||||
public string AgentLastName { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[LookupName("AGNT.AgentFirstName")]
|
||||
[MaxLength(99)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string AgentFirstName { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
@ -83,18 +92,21 @@ namespace bsmd.database
|
||||
[MaxLength(99)]
|
||||
[ENI2Validation]
|
||||
[Validation(ValidationCode.NOT_NULL)]
|
||||
[DataMember]
|
||||
public string AgentPhone { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[LookupName("AGNT.AgentFax")]
|
||||
[MaxLength(99)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string AgentFax { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[LookupName("AGNT.AgentEMail")]
|
||||
[MaxLength(99)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string AgentEMail { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -13,12 +13,14 @@ using System.Data.SqlClient;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace bsmd.database
|
||||
{
|
||||
|
||||
[TypeConverter(typeof(MessageClassConverter<CallPurpose>))]
|
||||
[JsonConverter(typeof(NoTypeConverterJsonConverter<CallPurpose>))]
|
||||
[DataContract]
|
||||
public class CallPurpose : DatabaseEntity, ISublistElement
|
||||
{
|
||||
|
||||
@ -35,12 +37,14 @@ namespace bsmd.database
|
||||
|
||||
[ShowReport]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public int CallPurposeCode { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[MaxLength(99)]
|
||||
[ENI2Validation]
|
||||
[Validation(ValidationCode.STRING_MAXLEN, 99)]
|
||||
[DataMember]
|
||||
public string CallPurposeDescription { get; set; }
|
||||
|
||||
public string Identifier { get; set; }
|
||||
|
||||
@ -19,6 +19,7 @@ using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using log4net;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace bsmd.database
|
||||
{
|
||||
@ -26,6 +27,7 @@ namespace bsmd.database
|
||||
[XmlInclude(typeof(Message))]
|
||||
[XmlInclude(typeof(MessageCore))]
|
||||
[XmlInclude(typeof(AGNT))]
|
||||
[DataContract]
|
||||
public abstract class DatabaseEntity : IDatabaseEntity, IMessageParagraph, IEquatable<DatabaseEntity>, ICloneable
|
||||
{
|
||||
protected Guid? id;
|
||||
|
||||
@ -9,10 +9,12 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Runtime.Serialization;
|
||||
using log4net;
|
||||
|
||||
namespace bsmd.database
|
||||
{
|
||||
[DataContract]
|
||||
public class INFO : DatabaseEntity
|
||||
{
|
||||
private static ILog _log = LogManager.GetLogger(typeof(INFO));
|
||||
@ -26,6 +28,7 @@ namespace bsmd.database
|
||||
[ShowReport]
|
||||
[Validation(ValidationCode.NOT_NULL)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public byte? ShippingArea { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
@ -33,23 +36,27 @@ namespace bsmd.database
|
||||
[LookupName("INFO.RequestedPositionInPortOfCall")]
|
||||
[MaxLength(100)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string RequestedPositionInPortOfCall { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[LookupName("INFO.SpecialRequirementsOfShipAtBerth")]
|
||||
[MaxLength(255)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string SpecialRequirementsOfShipAtBerth { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[LookupName("INFO.ConstructionCharacteristicsOfShip")]
|
||||
[MaxLength(100)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string ConstructionCharacteristicsOfShip { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[Validation(ValidationCode.NOT_NULL)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public byte? FumigatedBulkCargo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@ -74,6 +81,7 @@ namespace bsmd.database
|
||||
[ShowReport]
|
||||
[LookupName("INFO.DeadWeightSummer_TNE")]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public double? DeplacementSummerDraught_TNE { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
@ -81,19 +89,23 @@ namespace bsmd.database
|
||||
[Validation(ValidationCode.PORTAREA)] // ist bei NOK Transit leer
|
||||
[MaxLength(4)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string PortArea { get; set; }
|
||||
|
||||
[MaxLength(50)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string BowThrusterPower { get; set; }
|
||||
|
||||
[MaxLength(50)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string SternThrusterPower { get; set; }
|
||||
|
||||
[MaxLength(4)]
|
||||
[LookupName("INFO.PortFacility")]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string PortFacility { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -14,12 +14,14 @@ using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace bsmd.database
|
||||
{
|
||||
|
||||
[TypeConverter(typeof(MessageClassConverter<NOA_NOD>))]
|
||||
[JsonConverter(typeof(NoTypeConverterJsonConverter<NOA_NOD>))]
|
||||
[DataContract]
|
||||
public class NOA_NOD : DatabaseEntity, ISublistContainer
|
||||
{
|
||||
public NOA_NOD()
|
||||
@ -32,11 +34,13 @@ namespace bsmd.database
|
||||
[ShowReport]
|
||||
[Validation1(ValidationCode.NOT_NULL)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public DateTime? ETAToPortOfCall { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[Validation1(ValidationCode.NOT_NULL)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public DateTime? ETDFromPortOfCall { get; set; }
|
||||
|
||||
[Validation1(ValidationCode.LIST_EMPTY)]
|
||||
@ -45,31 +49,37 @@ namespace bsmd.database
|
||||
[ShowReport]
|
||||
[Validation2(ValidationCode.NOT_NULL)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public DateTime? ETAToKielCanal { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[Validation2(ValidationCode.NOT_NULL)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public DateTime? ETDFromKielCanal { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[Validation(ValidationCode.NOT_NULL)]
|
||||
[MaxLength(5)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string LastPort { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public DateTime? ETDFromLastPort { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[Validation(ValidationCode.LOCODE_SSN)]
|
||||
[MaxLength(5)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string NextPort { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public DateTime? ETAToNextPort { get; set; }
|
||||
|
||||
[ENI2Validation]
|
||||
|
||||
@ -13,9 +13,12 @@ using System.Data.SqlClient;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace bsmd.database
|
||||
{
|
||||
|
||||
[DataContract]
|
||||
public class STAT : DatabaseEntity
|
||||
{
|
||||
|
||||
@ -31,48 +34,56 @@ namespace bsmd.database
|
||||
[LookupName("STAT.ShipName")]
|
||||
[MaxLength(100)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string ShipName { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[Validation(ValidationCode.FRZ)]
|
||||
[MaxLength(50)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string CallSign { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[Validation(ValidationCode.MMSI)]
|
||||
[MaxLength(50)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string MMSINumber { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[Validation(ValidationCode.FLAG_CODE)]
|
||||
[MaxLength(2)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string Flag { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||
[LookupName("STAT.LengthOverall_MTR")]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public double? LengthOverall_MTR { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||
[LookupName("STAT.Beam_MTR")]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public double? Beam_MTR { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[Validation(ValidationCode.DOUBLE_GT_ZERO)]
|
||||
[LookupName("STAT.GrossTonnage")]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public int? GrossTonnage { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[Validation(ValidationCode.LOCODE_NOPORT)]
|
||||
[MaxLength(5)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string PortOfRegistry { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
@ -80,6 +91,7 @@ namespace bsmd.database
|
||||
[MaxLength(100)]
|
||||
[ENI2Validation]
|
||||
[Validation(ValidationCode.INVALID_NUMBER_CHARS)]
|
||||
[DataMember]
|
||||
public string InmarsatCallNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@ -88,6 +100,7 @@ namespace bsmd.database
|
||||
[Validation(ValidationCode.NOT_NULL)]
|
||||
[MaxLength(1)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string TransportMode { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
@ -110,42 +123,49 @@ namespace bsmd.database
|
||||
[LookupName("STAT.ShipType")]
|
||||
[MaxLength(5)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string ShipType { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[LookupName("STAT.ISMCompanyName")]
|
||||
[MaxLength(100)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string ISMCompanyName { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[Validation(ValidationCode.STRING_EXACT_LEN, 7)]
|
||||
[MaxLength(10)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string ISMCompanyId { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[LookupName("STAT.ISMCompanyStreetAndNumber")]
|
||||
[MaxLength(100)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string ISMCompanyStreetAndNumber { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[LookupName("STAT.ISMCompanyPostalCode")]
|
||||
[MaxLength(24)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string ISMCompanyPostalCode { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[LookupName("STAT.ISMCompanyCity")]
|
||||
[MaxLength(100)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string ISMCompanyCity { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
[LookupName("STAT.ISMCompanyCountry")]
|
||||
[MaxLength(100)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string ISMCompanyCountry { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
@ -159,15 +179,18 @@ namespace bsmd.database
|
||||
|
||||
[LookupName("STAT.NetTonnage")]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public double? NetTonnage { get; set; }
|
||||
|
||||
[LookupName("STAT.RegistryDate")]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public DateTime? RegistryDate { get; set; }
|
||||
|
||||
[LookupName("STAT.CertificateOfRegistryNumber")]
|
||||
[MaxLength(35)]
|
||||
[ENI2Validation]
|
||||
[DataMember]
|
||||
public string CertificateOfRegistryNumber { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using bsmd.database;
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using System.ServiceModel;
|
||||
using System.ServiceModel.Web;
|
||||
using System.Text;
|
||||
using bsmd.database;
|
||||
|
||||
namespace bsmd.nsw.service
|
||||
{
|
||||
@ -13,9 +10,14 @@ namespace bsmd.nsw.service
|
||||
[ServiceContract]
|
||||
public interface IService
|
||||
{
|
||||
|
||||
[
|
||||
WebInvoke( //Method = "GET",
|
||||
BodyStyle = WebMessageBodyStyle.Wrapped,
|
||||
RequestFormat = WebMessageFormat.Json,
|
||||
ResponseFormat = WebMessageFormat.Json)]
|
||||
// ,UriTemplate = "pasttrack/{mmsi}/{mins}")]
|
||||
[OperationContract]
|
||||
NSWEntry[] GetData(string poc, DateTime? from , DateTime? to);
|
||||
NSWEntry[] NSWData(string poc, string from , string to);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,36 +1,7 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("bsmd.nsw.service")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("bsmd.nsw.service")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyDescription("WCF Service to expose some nsw message classes to Wetris")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("ac61d284-d3c1-4139-86a1-83459dc1c4e0")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
|
||||
|
||||
@ -25,7 +25,8 @@ namespace bsmd.nsw.service.Properties {
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Initial Catalog=nsw;Data Source=192.168.2.24\\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;P" +
|
||||
"ersist Security Info=False;Connection Reset=false")]
|
||||
public string ConnectionString {
|
||||
get {
|
||||
return ((string)(this["ConnectionString"]));
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="ConnectionString" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)" />
|
||||
<Value Profile="(Default)">Initial Catalog=nsw;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -1 +1 @@
|
||||
<%@ ServiceHost Language="C#" Debug="true" Service="bsmd.nsw.service.Service1" CodeBehind="Service.svc.cs" %>
|
||||
<%@ ServiceHost Language="C#" Debug="true" Service="bsmd.nsw.service.Service" Factory="System.ServiceModel.Activation.WebServiceHostFactory" %>
|
||||
@ -5,21 +5,29 @@ using System.Collections.Generic;
|
||||
|
||||
namespace bsmd.nsw.service
|
||||
{
|
||||
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
|
||||
// NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging.
|
||||
public class Service : IService
|
||||
{
|
||||
|
||||
private readonly ILog _log = LogManager.GetLogger(typeof(Service));
|
||||
public NSWEntry[] GetData(string poc, DateTime? fromDate, DateTime? toDate)
|
||||
public NSWEntry[] NSWData(string poc, string fromDateString, string toDateString)
|
||||
{
|
||||
List<NSWEntry> entries = new List<NSWEntry>();
|
||||
List<NSWEntry> entries = new List<NSWEntry>();
|
||||
|
||||
DateTime? fromDate = null;
|
||||
if (DateTime.TryParse(fromDateString, out DateTime fromDateParsed))
|
||||
fromDate = fromDateParsed;
|
||||
DateTime? toDate = null;
|
||||
if (DateTime.TryParse(toDateString, out DateTime toDateParsed))
|
||||
toDate = toDateParsed;
|
||||
|
||||
_log.InfoFormat("Received request for {0} between {1} and {2}", poc, fromDate.HasValue ? fromDate.Value.ToString() : "?", toDate.HasValue ? toDate.Value.ToString() : "?");
|
||||
|
||||
if (DBManager.Instance.Connect(Properties.Settings.Default.ConnectionString))
|
||||
{
|
||||
// add search criteria
|
||||
if (!poc.IsNullOrEmpty())
|
||||
{
|
||||
{
|
||||
|
||||
Dictionary<MessageCore.SearchFilterType, string> filterDict = new Dictionary<MessageCore.SearchFilterType, string>();
|
||||
filterDict.Add(MessageCore.SearchFilterType.FILTER_PORT, poc);
|
||||
uint? from = null, to = null;
|
||||
@ -35,31 +43,35 @@ namespace bsmd.nsw.service
|
||||
filterDict.Add(MessageCore.SearchFilterType.FILTER_ETA, string.Format("{0}:{1}", from?.ToString() ?? "", to?.ToString() ?? ""));
|
||||
|
||||
int? resultLimit;
|
||||
int? expectedResultNum = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetNumCoresWithFilters(filterDict);
|
||||
int? expectedResultNum = DBManager.Instance.GetNumCoresWithFilters(filterDict);
|
||||
if ((expectedResultNum ?? 0) > 100)
|
||||
resultLimit = 100;
|
||||
else
|
||||
resultLimit = expectedResultNum;
|
||||
|
||||
foreach(MessageCore core in DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoresWithFilters(filterDict, resultLimit))
|
||||
foreach(MessageCore core in DBManager.Instance.GetMessageCoresWithFilters(filterDict, resultLimit))
|
||||
{
|
||||
NSWEntry entry = new NSWEntry();
|
||||
if(core.ETA.HasValue)
|
||||
entry.ETA = core.ETA.Value;
|
||||
entry.IMO_ENI = core.IMOENIDisplay;
|
||||
entry.PoC = core.PoC;
|
||||
|
||||
foreach(Message message in DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessagesForCore(core, DBManager.MessageLoad.EXCEL))
|
||||
{
|
||||
if ((message.MessageNotificationClass == Message.NotificationClass.AGNT) && (message.Elements.Count > 0))
|
||||
entry.AGNT = message.Elements[0] as AGNT;
|
||||
if ((message.MessageNotificationClass == Message.NotificationClass.NOA_NOD) && (message.Elements.Count > 0))
|
||||
entry.NOA_NOD = message.Elements[0] as NOA_NOD;
|
||||
if ((message.MessageNotificationClass == Message.NotificationClass.STAT) && (message.Elements.Count > 0))
|
||||
entry.STAT = message.Elements[0] as STAT;
|
||||
if ((message.MessageNotificationClass == Message.NotificationClass.INFO) && (message.Elements.Count > 0))
|
||||
entry.INFO = message.Elements[0] as INFO;
|
||||
}
|
||||
|
||||
Message agntMessage = DBManager.Instance.GetMessage(core, Message.NotificationClass.AGNT);
|
||||
if ((agntMessage != null) && (agntMessage.Elements.Count > 0))
|
||||
entry.AGNT = agntMessage.Elements[0] as AGNT;
|
||||
|
||||
Message noanodMessage = DBManager.Instance.GetMessage(core, Message.NotificationClass.NOA_NOD);
|
||||
if ((noanodMessage != null) && (noanodMessage.Elements.Count > 0))
|
||||
entry.NOA_NOD = noanodMessage.Elements[0] as NOA_NOD;
|
||||
|
||||
Message statMessage = DBManager.Instance.GetMessage(core, Message.NotificationClass.STAT);
|
||||
if ((statMessage != null) && (statMessage.Elements.Count > 0))
|
||||
entry.STAT = statMessage.Elements[0] as STAT;
|
||||
|
||||
Message infoMessage = DBManager.Instance.GetMessage(core, Message.NotificationClass.INFO);
|
||||
if ((infoMessage != null) && (infoMessage.Elements.Count > 0))
|
||||
entry.INFO = infoMessage.Elements[0] as INFO;
|
||||
|
||||
entries.Add(entry);
|
||||
}
|
||||
|
||||
@ -1,33 +1,44 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="bsmd.nsw.service.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="bsmd.nsw.service.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<appSettings>
|
||||
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
|
||||
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
|
||||
</appSettings>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.5.2" />
|
||||
<httpRuntime targetFramework="4.5.2"/>
|
||||
<compilation debug="true" targetFramework="4.5.2"/>
|
||||
<httpRuntime targetFramework="4.5.2" executionTimeout="600"/>
|
||||
</system.web>
|
||||
<system.serviceModel>
|
||||
<behaviors>
|
||||
<serviceBehaviors>
|
||||
<behavior>
|
||||
<behavior name="ServiceBehavior">
|
||||
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
|
||||
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
|
||||
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
|
||||
<serviceDebug includeExceptionDetailInFaults="false"/>
|
||||
</behavior>
|
||||
</serviceBehaviors>
|
||||
<endpointBehaviors>
|
||||
<behavior name="web">
|
||||
<webHttp/>
|
||||
</behavior>
|
||||
</endpointBehaviors>
|
||||
</behaviors>
|
||||
<services>
|
||||
<service name="bsmd.nsw.service.Service" behaviorConfiguration="ServiceBehavior">
|
||||
<endpoint binding="webHttpBinding" contract="bsmd.nsw.service.IService" behaviorConfiguration="web">
|
||||
</endpoint>
|
||||
</service>
|
||||
</services>
|
||||
<protocolMapping>
|
||||
<add binding="basicHttpsBinding" scheme="https" />
|
||||
<add binding="basicHttpsBinding" scheme="https"/>
|
||||
</protocolMapping>
|
||||
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
|
||||
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
|
||||
</system.serviceModel>
|
||||
<system.webServer>
|
||||
<modules runAllManagedModulesForAllRequests="true"/>
|
||||
@ -37,12 +48,35 @@
|
||||
-->
|
||||
<directoryBrowse enabled="true"/>
|
||||
</system.webServer>
|
||||
|
||||
<system.diagnostics>
|
||||
<trace autoflush="true" />
|
||||
<sources>
|
||||
<source name="System.ServiceModel"
|
||||
switchValue="Information, ActivityTracing"
|
||||
propagateActivity="true">
|
||||
<listeners>
|
||||
<add name="sdt"
|
||||
type="System.Diagnostics.XmlWriterTraceListener"
|
||||
initializeData="e:\temp\client.svclog" />
|
||||
</listeners>
|
||||
</source>
|
||||
</sources>
|
||||
</system.diagnostics>
|
||||
|
||||
<applicationSettings>
|
||||
<bsmd.nsw.service.Properties.Settings>
|
||||
<setting name="ConnectionString" serializeAs="String">
|
||||
<value />
|
||||
<value>Initial Catalog=nsw;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false</value>
|
||||
</setting>
|
||||
</bsmd.nsw.service.Properties.Settings>
|
||||
</applicationSettings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="log4net" publicKeyToken="669E0DDF0BB1AA2A" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.12.0" newVersion="2.0.12.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
||||
@ -68,6 +68,15 @@
|
||||
<Content Include="Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\bsmd.database\Properties\AssemblyProductInfo.cs">
|
||||
<Link>Properties\AssemblyProductInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\bsmd.database\Properties\AssemblyProjectInfo.cs">
|
||||
<Link>Properties\AssemblyProjectInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\bsmd.database\Properties\AssemblyProjectKeyInfo.cs">
|
||||
<Link>Properties\AssemblyProjectKeyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
@ -83,6 +92,7 @@
|
||||
<Folder Include="App_Data\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="log4net.config" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
|
||||
22
nsw/Source/bsmd.nsw.service/log4net.config
Normal file
22
nsw/Source/bsmd.nsw.service/log4net.config
Normal file
@ -0,0 +1,22 @@
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/>
|
||||
</configSections>
|
||||
<log4net>
|
||||
<root>
|
||||
<level value="DEBUG" />
|
||||
<appender-ref ref="LogFileAppender" />
|
||||
</root>
|
||||
<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender" >
|
||||
<param name="File" value="E:\Temp\nsw_service.log" />
|
||||
<param name="AppendToFile" value="true" />
|
||||
<rollingStyle value="Size" />
|
||||
<maxSizeRollBackups value="10" />
|
||||
<maximumFileSize value="10MB" />
|
||||
<staticLogFileName value="true" />
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<param name="ConversionPattern" value="%date [%thread] %-5level %logger - %message%newline" />
|
||||
</layout>
|
||||
</appender>
|
||||
</log4net>
|
||||
</configuration>
|
||||
Loading…
Reference in New Issue
Block a user