/// <summary>
        /// Brings buyers and sellers of equities together.
        /// </summary>
        static SettlementDocumentFactory()
        {
            try
            {
                // This is normally created by a channel when it establishes a connection.  But this is a daemon process without a connection, so an
                // authorization policy needs be created explicilty in order to have a thread that can run as an authorized user.
                SettlementDocumentFactory.authorizationPolicy = new AuthorizationPolicy();

                // This queue is filled up with Working Orders that need to be serviced because something changed the matching criteria.
                SettlementDocumentFactory.actionQueue = new WaitQueue <ObjectAction>();

                // This identity and set of claims gives the worker threads access to do anything to the data model.
                List <Claim> listClaims = new List <Claim>();
                listClaims.Add(new Claim(FluidTrade.Core.ClaimTypes.Create, Resources.Application, Rights.PossessProperty));
                listClaims.Add(new Claim(FluidTrade.Core.ClaimTypes.Update, Resources.Application, Rights.PossessProperty));
                listClaims.Add(new Claim(FluidTrade.Core.ClaimTypes.Read, Resources.Application, Rights.PossessProperty));
                listClaims.Add(new Claim(FluidTrade.Core.ClaimTypes.Destroy, Resources.Application, Rights.PossessProperty));
                ClaimSet adminClaims = new DefaultClaimSet(ClaimsAuthorizationPolicy.IssuerClaimSet, listClaims.ToArray());
                SettlementDocumentFactory.claimsPrincipal = new ClaimsPrincipal(
                    new GenericIdentity("*****@*****.**"),
                    adminClaims);

                // This will create an instance of the Mail Merge factory that takes templates and mail merge fields and generates a complete document.  It is
                // loaded up dymanically so that servers that don't have Microsoft Office installed on them will be able to run, but will not be able to
                // generate settlement letters.
                SettlementDocumentFactory.iMailMerge = new MailMerge();

                if (SettlementDocumentFactory.iMailMerge == null)
                {
                    EventLog.Information("This server is unable to process Mail Merge functions.");
                }
                else
                {
                    // These business rules will move negotiation information across the Chinese wall if a counter party exists.
                    DataModel.ConsumerDebtSettlement.ConsumerDebtSettlementRowChanged += OnConsumerDebtSettlementRowChanged;

                    // This thread will execution the actions that are created by changes to the data model.  The triggers themselves can't modify the data
                    // model because the triggers are called from the commit handlers.
                    SettlementDocumentFactory.factoryThread              = new Thread(new ThreadStart(SettlementDocumentFactory.FactoryThread));
                    SettlementDocumentFactory.factoryThread.Name         = "Crossing Thread";
                    SettlementDocumentFactory.factoryThread.IsBackground = true;
                    SettlementDocumentFactory.factoryThread.Start();
                }
            }
            catch (Exception exception)
            {
                if (exception.InnerException != null)
                {
                    EventLog.Error("{0}, {1}", exception.InnerException.Message, exception.InnerException.StackTrace);
                }

                EventLog.Error("{0}, {1}", exception.Message, exception.StackTrace);
            }
        }
예제 #2
0
        public Messenger(IMailMerge mailMerge)
        {
            Require.NotNull(mailMerge, "mailMerge");

            _mailMerge = mailMerge;
        }
예제 #3
0
 public MailMergeController(IMailMerge mailMerge)
 {
     _mailMerge = mailMerge;
 }
예제 #4
0
        private static void SaveAwardWinnerMemoMailMerge(WorkingDirectoryPath workingDirectoryPath, AwardType awardType,
                                                         NominationList nominationList, IMailMerge mailMerge)
        {
            if (!nominationList.HasWinnersForAward(awardType))
            {
                return;
            }

            var fileName = awardType.GetWinnersForMemoFileName(nominationList.AwardsPeriod);
            var filePath = workingDirectoryPath.GetFilePathForFileInDirectory(fileName, false, false);

            mailMerge.Execute(filePath);
        }