Exemple #1
0
        public async Task <CreditAppSubmissionResult> SubmitCreditApp()
        {
            //must send email if photo taken for customer info
            if (!string.IsNullOrWhiteSpace(_creditApp.PhotoFilePath))
            {
                IEmailService _emailService = AppContainer.Container.Resolve <IEmailService>();
                _emailService.CreateEmail(_creditApp.ToSubmissionEmail());
                return(CreditAppSubmissionResult.Success);
            }

            //if all data manually entered (no photo), send to API
            ICreditAppService _creditAppService = AppContainer.Container.Resolve <ICreditAppService>();
            var response = await _creditAppService.SubmitCreditApp(_creditApp);

            if (response != null)
            {
                if (response.ApplicationID != 0)
                {
                    _creditApp.AppId = response.ApplicationID;
                    return(CreditAppSubmissionResult.Success);
                }
                else if (response.ErrorStatusCode == 401)
                {
                    return(CreditAppSubmissionResult.Unauthorized);
                }
                else
                {
                    return(CreditAppSubmissionResult.Failure);
                }
            }
            else
            {
                return(CreditAppSubmissionResult.Failure);
            }
        }
        public bool EmailQuote()
        {
            IEmailService _emailService = AppContainer.Container.Resolve <IEmailService>();

            _emailService.CreateEmail(_quote.ToQuoteEmail());
            return(true);
        }
Exemple #3
0
        public void Execute(IActionContext context)
        {
            IEmailService service = (IEmailService)Core.PluginLoader.GetPluginService(typeof(IEmailService));
            string        subject = context.CurrentPageTitle;

            if (string.IsNullOrEmpty(subject))
            {
                subject = context.CurrentUrl;
            }
            service.CreateEmail(subject, context.CurrentUrl, EmailBodyFormat.PlainText, (EmailRecipient[])null, null, true);
        }
Exemple #4
0
        public override void Execute(IActionContext context)
        {
            IResource     fragment     = context.SelectedResources [0];
            IEmailService emailService = (IEmailService)Core.PluginLoader.GetPluginService(typeof(IEmailService));

            if (emailService != null)
            {
                emailService.CreateEmail(fragment.GetPropText(Core.Props.Subject),
                                         fragment.GetPropText(Core.Props.LongBody),
                                         fragment.HasProp(Core.Props.LongBodyIsHTML) ? EmailBodyFormat.Html : EmailBodyFormat.PlainText,
                                         Core.ResourceStore.EmptyResourceList, new string[] {}, true);
            }
        }
Exemple #5
0
        public override void Execute(IActionContext context)
        {
            IEmailService service = (IEmailService)Core.PluginLoader.GetPluginService(typeof(IEmailService));
            IResource     weblink = context.SelectedResources[0];
            string        body    = weblink.GetPropText(FavoritesPlugin._propURL);

            if (weblink.HasProp("Annotation"))
            {
                body += "\r\n\r\n";
                body += weblink.GetPropText("Annotation");
            }
            service.CreateEmail(weblink.DisplayName, body, EmailBodyFormat.PlainText, (EmailRecipient[])null, null, true);
        }
Exemple #6
0
        private void OnSend(object sender, System.EventArgs e)
        {
            IEmailService emailService = (IEmailService)Core.PluginLoader.GetPluginService(typeof(IEmailService));

            if (emailService != null)
            {
                string fullFileName = Path.Combine(Path.GetTempPath(), ResourceSerializer.ResourceTransferFileName);
                _resourceSerializer.GenerateXML(fullFileName);
                string[] attachments = new string[1];
                attachments[0] = fullFileName;
                emailService.CreateEmail(null, null, EmailBodyFormat.PlainText, (EmailRecipient[])null, attachments, true);
                File.Delete(fullFileName);
            }
        }
Exemple #7
0
        public override void Execute(IActionContext context)
        {
            IEmailService service = GetEmailService();

            IResourceList resources   = context.SelectedResources;
            ArrayList     attachments = new ArrayList();

            for (int i = 0; i < resources.Count; ++i)
            {
                attachments.Add(FoldersCollection.Instance.GetFullName(resources[i]));
            }
            service.CreateEmail(null, null, EmailBodyFormat.PlainText, (EmailRecipient[])null,
                                (string[])attachments.ToArray(typeof(string)), true);
        }
Exemple #8
0
 public override void Execute(IActionContext context)
 {
     InitializeEmailService();
     if (_emailService != null)
     {
         foreach (IResource selItem in context.SelectedResources.ValidResources)
         {
             if (!selItem.IsDeleted)
             {
                 string html = _convManager.ToHtmlString(selItem, _propDisplayName);
                 _emailService.CreateEmail(selItem.GetPropText("Subject"), html,
                                           EmailBodyFormat.Html, Core.ResourceStore.EmptyResourceList, new string[] {}, false);
             }
         }
     }
 }
Exemple #9
0
        public void CreateEmail_Service_Fail()
        {
            // Arrange
            emailService = new EmailService(mockRepository.Object, mockLogger.Object, mockCache.Object, mockTelemetry.Object);
            mockRepository.Setup(x => x.Insert(It.IsAny <Email>())).Returns(false).Verifiable();

            // Act
            var email    = new EmailDto();
            var response = emailService.CreateEmail(email);

            // Assert
            Assert.IsNotNull(response);
            Assert.IsFalse(response.Result);
            Assert.IsTrue(response.Notifications.HasErrors());
            Assert.IsInstanceOfType(response, typeof(GenericServiceResponse <bool>));
            mockRepository.Verify(x => x.Insert(It.IsAny <Email>()), Times.Once);
        }
        internal void SendQuoteEmail()
        {
            var app = _quoteBuilder.GetQuote();

            _emailService.CreateEmail(app.ToQuoteEmail());
        }
        internal void SendConfirmationEmail()
        {
            var app = _creditAppBuilder.GetCreditApp();

            _emailService.CreateEmail(app.ToConfirmationEmail());
        }