コード例 #1
0
        private void SaveShippingAddress()
        {
            _subscription.ShipToFirstName   = FirstName.Text;
            _subscription.ShipToLastName    = LastName.Text;
            _subscription.ShipToCompany     = Company.Text;
            _subscription.ShipToAddress1    = Address1.Text;
            _subscription.ShipToAddress2    = Address2.Text;
            _subscription.ShipToCity        = City.Text;
            _subscription.ShipToProvince    = Province.Text;
            _subscription.ShipToPostalCode  = PostalCode.Text;
            _subscription.ShipToCountryCode = CountryCode.Items[CountryCode.SelectedIndex].Value;
            _subscription.ShipToPhone       = Phone.Text;
            _subscription.ShipToFax         = Fax.Text;
            _subscription.ShipToResidence   = (Residence.SelectedIndex == 0);

            try
            {
                EmailProcessor.NotifySubscriptionUpdated(_subscription);
            }
            catch (Exception ex)
            {
                Logger.Error("Error sending subscription updated email.", ex);
            }

            _subscription.Save();
        }
コード例 #2
0
ファイル: UnitTest.cs プロジェクト: irina2870/FetchRewards
        public void StringRequest()
        {
            ResponseObject.ResponseList = new List <EmailResponse>();
            List <List <string> > testSet = new List <List <string> >()
            {
                new List <string> {
                    "*****@*****.**", "3"
                }, new List <string> {
                    "*****@*****.**", "1"
                }
            };
            string request = "[email protected],[email protected],[email protected],[email protected]";

            var controller = new EmailAPI();


            StringFormatRequest stringRequest = new StringFormatRequest(request);

            EmailProcessor.CountEmails(stringRequest.CreateList);

            for (int i = 0; i < ResponseObject.ResponseList.Count; i++)
            {
                Assert.Equal(ResponseObject.ResponseList[i].Email, testSet[i][0]);
                Assert.Equal(ResponseObject.ResponseList[i].Count, testSet[i][1]);
            }
        }
コード例 #3
0
 public void StartService()
 {
     Log.Message(LogLevel.Info, "[EmailService] - Email service starting...");
     _emailProcessor = new EmailProcessor();
     _emailProcessor.Start().Wait();
     Log.Message(LogLevel.Info, "[EmailService] - Email service started.");
 }
コード例 #4
0
        public async Task <bool> RemindAsync(string tenant, ReminderMessage message)
        {
            await Task.Delay(0).ConfigureAwait(false);

            string sendTo   = message.Contact.EmailAddresses;
            string timezone = message.Contact.TimeZone.Or(message.Event.TimeZone);

            if (string.IsNullOrWhiteSpace(sendTo))
            {
                return(false);
            }

            int alarm = message.Event.Alarm ?? 0;

            if (alarm == 0)
            {
                return(false);
            }

            string template  = Configs.GetNotificationEmailTemplate(tenant);
            string eventDate = TimeZoneInfo.ConvertTime(DateTime.UtcNow.AddMinutes(alarm), TimeZoneInfo.FindSystemTimeZoneById(timezone)).Date.ToString("D");
            string startTime = TimeZoneInfo.ConvertTime(message.Event.StartsAt, TimeZoneInfo.FindSystemTimeZoneById(timezone)).ToString("t");
            string endTime   = TimeZoneInfo.ConvertTime(message.Event.EndsOn, TimeZoneInfo.FindSystemTimeZoneById(timezone)).ToString("t");

            template = template.Replace("{Name}", message.Event.Name);
            template = template.Replace("{StartTime}", startTime);
            template = template.Replace("{EndTime}", endTime);
            template = template.Replace("{Date}", eventDate);
            template = template.Replace("{Location}", message.Event.Location);
            template = template.Replace("{Note}", message.Event.Note);


            var processor = EmailProcessor.GetDefault(tenant);

            if (processor == null)
            {
                return(false);
            }

            var email = new EmailQueue
            {
                AddedOn     = DateTimeOffset.UtcNow,
                SendOn      = DateTimeOffset.UtcNow,
                SendTo      = sendTo,
                FromName    = processor.Config.FromName,
                ReplyTo     = processor.Config.FromEmail,
                ReplyToName = processor.Config.FromName,
                Subject     = string.Format(I18N.CalendarNotificationEmailSubject, message.Event.Name, startTime),
                Message     = template
            };

            var manager = new MailQueueManager(tenant, email);
            await manager.AddAsync().ConfigureAwait(false);

            await manager.ProcessQueueAsync(processor).ConfigureAwait(false);

            return(true);
        }
コード例 #5
0
        public void ProcessMessageTest_NotExistFile()
        {
            moqDataSource.Setup(ds => ds.InsertMessage(It.IsAny <MessageModel>())).Returns(true);
            EmailProcessor processor = new EmailProcessor(moqDataSource.Object);

            bool result = true && processor.ProcessMessage(@".\TestData\Emails\NoSample.eml");

            Assert.False(result);
        }
コード例 #6
0
        public void SendCode()
        {
            EmailProcessor email = new EmailProcessor {
                Email = Recipient
            };

            email.Send("Fare matrix account recovery.",
                       $"Hello, Good Day.\nThis is your recovery code for your account : {recoveryCode} \n\n\n-Fare matrix developer");
        }
コード例 #7
0
        private void DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            WebBrowser browser = sender as WebBrowser;

            if (browser == null)
            {
                return;
            }

            if (browser.Document == null || browser.Document.Body == null)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(browser.Tag.ToString()))
            {
                return;
            }

            File.Delete(browser.Tag.ToString());

            browser.Document.Body.Style = "zoom:100%;";

            var element = browser.Document.GetElementById("ReportParameterPanel");

            if (element != null)
            {
                element.OuterHtml = "";
                element.InnerHtml = "";
            }

            if (browser.Document.Body != null)
            {
                const int margin    = 100;
                var       height    = browser.Document.Body.ScrollRectangle.Height + margin;
                var       width     = browser.Width;
                var       imagePath = browser.Tag.ToString().Replace(".html", ".png");

                using (Bitmap bitmap = new Bitmap(width + 2 * margin, height))
                {
                    using (Graphics g = Graphics.FromImage(bitmap))
                    {
                        g.Clear(Color.White);
                        g.DrawImage(bitmap, 0, 0, width + 2 * margin, height);
                    }

                    browser.DrawToBitmap(bitmap, new Rectangle(margin, 0, width, height));
                    bitmap.SetResolution(3200, 3200);
                    bitmap.Save(imagePath, GetEncoder(ImageFormat.Png), null);

                    EmailProcessor processor = new EmailProcessor();
                    processor.Send(this.Recipient, this.Subject, this.EmailBody, EmailAttachment.GetAttachments(imagePath));
                }
            }
        }
コード例 #8
0
        private string GetEmails(string tenant, int contactId)
        {
            var config  = EmailProcessor.GetDefaultConfig(tenant);
            var contact = DAL.Contacts.GetContact(contactId);

            if (contact == null)
            {
                return(config.FromEmail);
            }

            return(!string.IsNullOrWhiteSpace(contact.Recipients) ? contact.Recipients : contact.Email);
        }
コード例 #9
0
        public async Task SendAsync()
        {
            string template = GetTemplate();
            string parsed   = ParseTemplate(template);
            string subject  = "Welcome to " + HttpContext.Current.Request.Url.Authority;
            string catalog  = AppUsers.GetCatalog();
            var    email    = this.GetEmail(this._user, subject, parsed);
            var    queue    = new MailQueueManager(catalog, email);

            queue.Add();
            await queue.ProcessMailQueueAsync(EmailProcessor.GetDefault());
        }
コード例 #10
0
        public async Task <ActionResult> Contact(EmailDetails emailDetails, EmailProcessor emailProcessor)
        {
            if (ModelState.IsValid)
            {
                await emailProcessor.ProcessEmailAsync(emailDetails);

                ViewBag.Status = emailDetails.StatusMessage;
                return(View("Thankyou", emailDetails));
            }
            ;

            // return empty form if invalid
            return(View("Contact"));
        }
コード例 #11
0
        static Program()
        {
            var streams = new List <StreamReader>();

            logger            = new Logger();
            presentationLogic = new PresentationLogic();
            var encryptionProcessor          = new Processor();
            IScriptProcessor scriptProcessor = new ScriptProcessor(encryptionProcessor);
            IFileProcessor   fileProcessor   = new FileProcessor(streams);
            IEmailProcessor  emailProcessor  = new EmailProcessor();
            IDatabaseLogic   databaseLogic   = new DatabaseLogic();

            businessLogic = new BusinessLogic(logger, scriptProcessor, fileProcessor, emailProcessor, databaseLogic);
        }
コード例 #12
0
        public static async Task <bool> SendAsync(string tenant, EmailViewModel model)
        {
            var processor = EmailProcessor.GetDefault(tenant);

            if (processor == null)
            {
                return(false);
            }

            foreach (var contactId in model.Contacts)
            {
                var contact = await DAL.Contacts.GetContactAsync(tenant, model.UserId, contactId).ConfigureAwait(false);

                if (string.IsNullOrWhiteSpace(contact?.EmailAddresses) || !contact.EmailAddresses.Split(',').Any())
                {
                    continue;
                }

                //Only select the first email address
                string emailAddress = contact.EmailAddresses.Split(',').Select(x => x.Trim()).FirstOrDefault(IsValidEmail);

                if (string.IsNullOrWhiteSpace(emailAddress))
                {
                    continue;
                }

                string message = model.Message;
                message = MessageParser.ParseMessage(message, contact);

                var email = new EmailQueue
                {
                    AddedOn     = DateTimeOffset.UtcNow,
                    SendOn      = DateTimeOffset.UtcNow,
                    SendTo      = emailAddress,
                    FromName    = processor.Config.FromName,
                    ReplyTo     = processor.Config.FromEmail,
                    ReplyToName = processor.Config.FromName,
                    Subject     = model.Subject,
                    Message     = message
                };

                var manager = new MailQueueManager(tenant, email);
                await manager.AddAsync().ConfigureAwait(false);

                await manager.ProcessQueueAsync(processor).ConfigureAwait(false);
            }

            return(true);
        }
コード例 #13
0
ファイル: ContactUsEmail.cs プロジェクト: Rizx/frapid
        public async Task SendAsync(string catalog, ContactForm model)
        {
            try
            {
                var email   = this.GetEmail(catalog, model);
                var manager = new MailQueueManager(catalog, email);
                manager.Add();

                await manager.ProcessMailQueueAsync(EmailProcessor.GetDefault());
            }
            catch
            {
                throw new HttpException(500, "Internal Server Error");
            }
        }
コード例 #14
0
ファイル: ContactUsEmail.cs プロジェクト: evisional1/mixerp
        private async Task <string> GetEmailsAsync(string tenant, int contactId)
        {
            var contact = await Contacts.GetContactAsync(tenant, contactId).ConfigureAwait(false);

            if (contact == null)
            {
                var config = EmailProcessor.GetDefaultConfig(tenant);

                if (config != null)
                {
                    return(config.FromEmail);
                }
            }

            return(!string.IsNullOrWhiteSpace(contact.Recipients) ? contact.Recipients : contact.Email);
        }
コード例 #15
0
        private EmailQueue GetEmail(string tenant, Subscribe model)
        {
            var    config  = EmailProcessor.GetDefaultConfig(tenant);
            string domain  = HttpContext.Current.Request.Url.Host;
            string subject = string.Format(CultureInfo.InvariantCulture, "You are now unsubscribed on {0}", domain);

            return(new EmailQueue
            {
                AddedOn = DateTimeOffset.UtcNow,
                FromName = config.FromName,
                ReplyTo = config.FromEmail,
                Subject = subject,
                Message = this.GetMessage(tenant, model),
                SendTo = model.EmailAddress
            });
        }
コード例 #16
0
        public string Register(RegisterModel model)
        {
            // BUGBUG: access to this API must be controlled - e.g. the client must send a secret
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                try
                {
                    WebSecurity.CreateUserAndAccount(
                        model.UserName,
                        model.Password,
                        propertyValues: new
                    {
                        Name = model.Name,
                    },
                        requireConfirmationToken: false);
                    WebSecurity.Login(model.UserName, model.Password);
                    TraceLog.TraceInfo(string.Format("Created user {0}", model.UserName));

                    using (var repository = new UserDataRepository(model.UserName))
                    {
                        repository.InitializeNewUserAccount();
                    }

                    var sentMail = EmailProcessor.SendWelcomeEmail(model.UserName);
                    if (sentMail)
                    {
                        TraceLog.TraceInfo("Sent welcome email to user " + model.UserName);
                    }

                    FormsAuthentication.SetAuthCookie(model.UserName, createPersistentCookie: false);
                    return(model.UserName);
                }
                catch (MembershipCreateUserException ex)
                {
                    TraceLog.TraceException(string.Format("Could not create user {0}", model.UserName), ex);
                    return("Error: " + ex.Message);
                }
                catch (Exception ex)
                {
                    TraceLog.TraceException(string.Format("Could not create user {0}", model.UserName), ex);
                }
            }

            // If we got this far, something failed
            return(null);
        }
コード例 #17
0
ファイル: AccountController.cs プロジェクト: ogazitt/webtimer
        public ActionResult JsonRegister(RegisterModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                try
                {
                    WebSecurity.CreateUserAndAccount(
                        model.UserName,
                        model.Password,
                        propertyValues: new
                    {
                        Name = model.Name,
                    },
                        requireConfirmationToken: false);
                    WebSecurity.Login(model.UserName, model.Password);
                    TraceLog.TraceInfo(string.Format("Created user {0}", model.UserName));

                    using (var repository = new UserDataRepository(model.UserName))
                    {
                        repository.InitializeNewUserAccount();
                    }

                    var sentMail = EmailProcessor.SendWelcomeEmail(model.UserName);
                    if (sentMail)
                    {
                        TraceLog.TraceInfo("Sent welcome email to user " + model.UserName);
                    }

                    FormsAuthentication.SetAuthCookie(model.UserName, createPersistentCookie: false);
                    return(Json(new { success = true, redirect = returnUrl }));
                }
                catch (MembershipCreateUserException e)
                {
                    var error = ErrorCodeToString(e.StatusCode);
                    ModelState.AddModelError("", error);
                    TraceLog.TraceException(string.Format("Account creation failed: {0}", error), e);
                }
                catch (Exception ex)
                {
                    TraceLog.TraceException("Account creation failed", ex);
                }
            }

            // If we got this far, something failed
            return(Json(new { errors = GetErrorsFromModelState() }));
        }
コード例 #18
0
ファイル: EmailAPI.cs プロジェクト: irina2870/FetchRewards
        public JsonResult BodyJSON([FromBody] string request)
        {
            try
            {
                if (String.IsNullOrEmpty(request) || String.IsNullOrWhiteSpace(request))
                {
                    return(new JsonResult("No emails submitted"));
                }

                JSONFormatRequest jsonRequest = new JSONFormatRequest(request);
                return(new JsonResult(EmailProcessor.CountEmails(jsonRequest.CreateList)));
            }
            catch (Exception ex)
            {
                return(new JsonResult(String.Format("Error Code {0}: {1}", "500", ex.Message)));
            }
        }
コード例 #19
0
ファイル: ResetEmail.cs プロジェクト: sudesh1456/frapid
        public async Task SendAsync(string tenant)
        {
            string template = this.GetTemplate(tenant);
            string parsed   = this.ParseTemplate(template);
            string subject  = "Your Password Reset Link for " + HttpContext.Current.Request.Url.Authority;

            var processor = EmailProcessor.GetDefault(tenant);

            if (processor != null)
            {
                var email = this.GetEmail(processor, this._resetDetails, subject, parsed);

                var queue = new MailQueueManager(tenant, email);
                await queue.AddAsync().ConfigureAwait(false);

                await queue.ProcessMailQueueAsync(processor).ConfigureAwait(false);
            }
        }
コード例 #20
0
ファイル: WelcomeEmail.cs プロジェクト: evisional1/mixerp
        public async Task SendAsync(string tenant)
        {
            string template = this.GetTemplate(tenant);
            string parsed   = this.ParseTemplate(template);
            string subject  = string.Format(I18N.WelcometToSite, HttpContext.Current.Request.Url.Authority);

            var processor = EmailProcessor.GetDefault(tenant);

            if (processor != null)
            {
                var email = this.GetEmail(processor, this._user, subject, parsed);

                var queue = new MailQueueManager(tenant, email);
                await queue.AddAsync().ConfigureAwait(false);

                await queue.ProcessQueueAsync(processor).ConfigureAwait(false);
            }
        }
コード例 #21
0
        public void ProcessMessageTest_NormalFile()
        {
            string resultFile = @".\TestData\Emails\Sample_tmp.eml";

            moqDataSource.Setup(ds => ds.InsertMessage(It.IsAny <MessageModel>())).Returns(true);
            EmailProcessor processor = new EmailProcessor(moqDataSource.Object);

            File.Copy(@".\TestData\Emails\Sample2.eml", resultFile);

            bool result = false || processor.ProcessMessage(resultFile);

            if (File.Exists(resultFile))
            {
                File.Delete(resultFile);
            }

            Assert.True(result);
        }
コード例 #22
0
ファイル: SignUpEmail.cs プロジェクト: sudesh1456/frapid
        public async Task SendAsync(string tenant)
        {
            string template = this.GetTemplate(tenant);
            string parsed   = this.ParseTemplate(this._context, template);
            string subject  = "Confirm Your Registration at " + this._context.Request.Url.Authority;

            var processor = EmailProcessor.GetDefault(tenant);

            if (processor != null)
            {
                var email = this.GetEmail(processor, this._registration, subject, parsed);

                var queue = new MailQueueManager(tenant, email);

                await queue.AddAsync().ConfigureAwait(false);

                await queue.ProcessMailQueueAsync(processor).ConfigureAwait(false);
            }
        }
コード例 #23
0
ファイル: ContactUsEmail.cs プロジェクト: evisional1/mixerp
        public async Task SendAsync(string tenant, ContactForm model)
        {
            var email = await this.GetEmailAsync(tenant, model).ConfigureAwait(false);

            var manager = new MailQueueManager(tenant, email);
            await manager.AddAsync().ConfigureAwait(false);

            var processor = EmailProcessor.GetDefault(tenant);

            if (processor != null)
            {
                if (string.IsNullOrWhiteSpace(email.ReplyTo))
                {
                    email.ReplyTo = processor.Config.FromEmail;
                }

                await manager.ProcessQueueAsync(processor).ConfigureAwait(false);
            }
        }
コード例 #24
0
ファイル: WelcomeEmail.cs プロジェクト: Zero-Xiong/frapid
        public async Task SendAsync()
        {
            string template = this.GetTemplate();
            string parsed   = this.ParseTemplate(template);
            string subject  = "Welcome to " + HttpContext.Current.Request.Url.Authority;
            string tenant   = AppUsers.GetTenant();
            var    email    = this.GetEmail(this._user, subject, parsed);

            var processor = EmailProcessor.GetDefault(tenant);

            if (string.IsNullOrWhiteSpace(email.ReplyTo))
            {
                email.ReplyTo = processor.Config.FromEmail;
            }

            var queue = new MailQueueManager(tenant, email);

            queue.Add();
            await queue.ProcessMailQueueAsync(processor);
        }
コード例 #25
0
        private void Save()
        {
            _Subscription.Name = SubscriptionName.Text;
            int selectedGroupId = AlwaysConvert.ToInt(SubscriptionGroup.SelectedValue);

            _Subscription.GroupId  = selectedGroupId;
            _Subscription.IsActive = Active.Checked;
            short frequency = AlwaysConvert.ToInt16(Frequency.Text);

            // IF PAYMENT FREQUENCY IS CHANGED BY MERCHANT
            if (trFrequency.Visible && frequency > 0 && _Subscription.PaymentFrequency != frequency)
            {
                _Subscription.PaymentFrequency = frequency;

                // RECALCULATE NEXT ORDER DATE ACCORDING TO NEW FREQUENCY VALUE
                _Subscription.RecalculateNextOrderDueDate();

                // RECALCULATE EXPIRATION ACCORDING TO NEW FREQUENCY VALUE
                _Subscription.RecalculateExpiration();
            }

            short numberOfPayments = AlwaysConvert.ToInt16(NumberOfPayments.Text);

            if (numberOfPayments != _Subscription.NumberOfPayments)
            {
                _Subscription.NumberOfPayments = numberOfPayments;
                _Subscription.RecalculateExpiration();
            }

            try
            {
                EmailProcessor.NotifySubscriptionUpdated(_Subscription);
            }
            catch (Exception ex)
            {
                Logger.Error("Error sending subscription updated email.", ex);
            }

            _Subscription.Save();
            InitFormValues();
        }
コード例 #26
0
ファイル: Processor.cs プロジェクト: ashokmahla/YakShop
        /// <summary>
        /// Processes the email.
        /// </summary>
        /// <param name="testQueue">The test queue.</param>
        /// <param name="groupName">Name of the group.</param>
        /// <param name="schedulerExecutionStatus">The scheduler execution status.</param>
        private static void ProcessEmail(ResultMessage <List <TestQueue> > testQueue, string groupName, SchedulerExecutionStatus schedulerExecutionStatus)
        {
            var emailStatus = SchedulerHistoryEmailStatus.NotSent;

            if (testQueue != null && testQueue.Item != null && groupName.IsNotBlank())
            {
                var schedulerIds = testQueue.Item.Select(x => x.SchedulerId).Distinct();

                var resultData = TestDataApi.Post <SearchReportObject, SearchReportResult>(EndPoints.ReportSearch, new SearchReportObject {
                    ExecutionGroup = groupName
                });

                if (resultData == null || resultData.IsError)
                {
                    emailStatus = SchedulerHistoryEmailStatus.SendException;
                }
                else if (resultData.Item != null)
                {
                    var emailProcessor = new EmailProcessor();

                    foreach (var schedulerId in schedulerIds)
                    {
                        if (!schedulerId.HasValue)
                        {
                            continue;
                        }

                        var schedularData = TestDataApi.Get <Scheduler>(string.Format(EndPoints.SchedulerById, schedulerId));

                        if (schedularData != null && !schedularData.IsError && schedularData.Item != null)
                        {
                            schedularData.Item.Status = schedulerExecutionStatus;
                            var repostData = new ReportResultData(resultData.Item.Data, schedularData.Item, groupName);
                            emailStatus = emailProcessor.EmailReport(repostData);
                        }
                    }
                }
            }

            TestDataApi.Post(string.Format(EndPoints.SchedulerHistoryEmailStatus, groupName, (int)emailStatus), new List <SchedulerHistory>());
        }
コード例 #27
0
ファイル: ResetEmail.cs プロジェクト: manishkungwani/frapid
        public async Task SendAsync()
        {
            string template = this.GetTemplate();
            string parsed   = this.ParseTemplate(template);
            string subject  = "Your Password Reset Link for " + HttpContext.Current.Request.Url.Authority;

            string catalog = AppUsers.GetCatalog();
            var    email   = this.GetEmail(this._resetDetails, subject, parsed);

            var processor = EmailProcessor.GetDefault(catalog);

            if (string.IsNullOrWhiteSpace(email.ReplyTo))
            {
                email.ReplyTo = processor.Config.FromEmail;
            }

            var queue = new MailQueueManager(catalog, email);

            queue.Add();
            await queue.ProcessMailQueueAsync(processor);
        }
コード例 #28
0
        public async Task SendAsync(string tenant, Subscribe model)
        {
            try
            {
                var email   = this.GetEmail(tenant, model);
                var manager = new MailQueueManager(tenant, email);
                manager.Add();

                var processor = EmailProcessor.GetDefault(tenant);

                if (string.IsNullOrWhiteSpace(email.ReplyTo))
                {
                    email.ReplyTo = processor.Config.FromEmail;
                }

                await manager.ProcessMailQueueAsync(processor);
            }
            catch
            {
                throw new HttpException(500, "Internal Server Error");
            }
        }
コード例 #29
0
        protected void UpdateCardButton_Click(object sender, EventArgs e)
        {
            int profileId = AlwaysConvert.ToInt(PreferedCreditCard.SelectedValue);

            if (profileId > 0)
            {
                _Subscription.PaymentProfile = GatewayPaymentProfileDataSource.Load(profileId);
                IList <PaymentMethod> methods          = AbleCommerce.Code.StoreDataHelper.GetPaymentMethods(AbleContext.Current.UserId);
                PaymentMethod         newPaymentMethod = null;
                if (string.IsNullOrEmpty(_Subscription.PaymentProfile.PaymentMethodName))
                {
                    newPaymentMethod = methods.Where(m => m.PaymentInstrumentType == _Subscription.PaymentProfile.InstrumentType).FirstOrDefault();
                }
                else
                {
                    newPaymentMethod = methods.Where(m => m.Name == _Subscription.PaymentProfile.PaymentMethodName).SingleOrDefault();
                }

                if (newPaymentMethod != null)
                {
                    _Subscription.PaymentMethod = newPaymentMethod;
                }

                try
                {
                    EmailProcessor.NotifySubscriptionUpdated(_Subscription);
                }
                catch (Exception ex)
                {
                    Logger.Error("Error sending subscription updated email.", ex);
                }

                _Subscription.Save();
                BindPayments(profileId);
                CreditCardMessagePH.Visible = true;
            }
        }
コード例 #30
0
        public bool ValidateAccount()
        {
            bool           IsValid    = false;
            AdminAccount   admin      = new AdminAccount();
            EmailProcessor adminEmail = new EmailProcessor {
                Email = Email
            };

            if (RequiredFields() == true && PasswordConfirmation() == true && EmailValidation() == true &&
                PasswordValidation() == true)
            {
                string information = $"'{FirstName}', '{MiddleName}', '{Lastname}'";
                string account     = $"'{Username}', '{Email}', '{Password}'";

                admin.Save(information, account);
                admin.SaveImage(image);
                adminEmail.Send("Fare Matrix Registration",
                                "Your account is now verified. You can now safely use the Application.\nYou can use this email to recover your account on our application.\n\n-Fare Matrix Developer");

                IsValid = true;
            }

            return(IsValid);
        }