/// <summary> /// Gets the statistics from every registered logger. /// </summary> /// <returns>Retrieved statistics.</returns> private CommunicationStatistics GetStatistics() { CommunicationStatistics stats = new CommunicationStatistics(); Logging.LogMessage msg; if (this.ExecutorLogger != null) { msg = this.ExecutorLogger.PopLastMessage(); if (msg != null) { stats.LastExecutionMessage = new MessageData(msg.Message, msg.MessageTime); } stats.LastExecutionTime = (DateTime?)this.ExecutorLogger.GetProperty("LastExecutionTime"); } if (this.ReceiverLogger != null) { msg = this.ReceiverLogger.PopLastMessage(); if (msg != null) { stats.LastReceiveMessage = new MessageData(msg.Message, msg.MessageTime); } } if (this.SenderLogger != null) { msg = this.SenderLogger.PopLastMessage(); if (msg != null) { stats.LastSendMessage = new MessageData(msg.Message, msg.MessageTime); } } using (IUnitOfWork uow = Manager.CreateUnitOfWork()) { uow.MapperFactory = this.mapperFactory; CommunicationPackageRepository repo = new CommunicationPackageRepository(uow); stats.PackagesToExecute = repo.GetUnprocessedPackagesQuantity(); stats.PackagesToSend = repo.GetUndeliveredPackagesQuantity(); if (String.IsNullOrEmpty(this.Manager.TransmitterConfiguration.AdditionalDataStoreProcedure) == false) { string newData = repo.GetAdditionalData(this.Manager.TransmitterConfiguration.AdditionalDataStoreProcedure).ToString(System.Xml.Linq.SaveOptions.DisableFormatting); if (newData != this.additionalData) { stats.AdditionalData = repo.GetAdditionalData(this.Manager.TransmitterConfiguration.AdditionalDataStoreProcedure).ToString(System.Xml.Linq.SaveOptions.DisableFormatting); this.additionalData = newData; } } } return(stats); }
private AdditionalInfo GetUndeliveredPackagesQuantity(AdditionalInfo additionalData, CommunicationPackageRepository repository, GetDataParameters source) { int packagesLeft = repository.GetUndeliveredPackagesQuantity(source.DatabaseId); if (packagesLeft > 0) { if (additionalData == null) { additionalData = new AdditionalInfo(); } additionalData.UndeliveredPackagesQuantity = packagesLeft; } return(additionalData); }
/// <summary> /// Retrives new portion of undelivered packages. /// </summary> private void GetNewXmlPackages(Guid databaseId) { if (this.XmlList.Count == 0) { using (IUnitOfWork uow = Manager.CreateUnitOfWork()) { uow.MapperFactory = this.mapperFactory; CommunicationPackageRepository repo = new CommunicationPackageRepository(uow); this.XmlList = repo.FindUndeliveredPackages(Manager.TransmitterConfiguration.MaxTransactionCount, databaseId); if (this.XmlList.Count > 0) { this.WaitingPackages = repo.GetUndeliveredPackagesQuantity(); } else { this.WaitingPackages = 0; } } } }