public static void EstimatePaymentBillingNoticeSend(StringBuilder messageBody, string subject)
        {
            var addedTo = false;
             var fromAddress = GetStandardFromAddress();
             var siteProperties = new SitePropertiesService();
             var toAddresses = siteProperties.EmailEstimatePayment.Split(',').ToList();

             var mailMessage = new MailMessage
             {
            From = fromAddress,
            Subject = subject,
            Body = messageBody.ToString(),
            IsBodyHtml = true
             };

             foreach (var email in toAddresses.Where(Email.IsValidEmail))
             {
            if (addedTo)
            {
               mailMessage.CC.Add(new MailAddress(email.Trim()));
            }
            else
            {
               mailMessage.To.Add(new MailAddress(email.Trim()));
               addedTo = true;
            }
             }

             SendMessage(mailMessage);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                m_grdList.PageSize = ApplicationContext.GetGridPageSize();

                Business.Services.SitePropertiesService propertiesService = new Business.Services.SitePropertiesService();
                m_txtRequestThreshold.Text = MemberProtect.Utility.FormatInteger(propertiesService.RecutRequestThreshold);
                m_txtRequestActivityInterval.Text = MemberProtect.Utility.FormatInteger(propertiesService.ActivityInterval);
                m_txtFeedbackQuestion.Text = propertiesService.FeedbackEmailQuestion;
                m_txtFeedbackProblem.Text = propertiesService.FeedbackEmailProblem;
                m_txtEmailSystemNotifications.Text = propertiesService.EmailSystemNotifications;
                m_txtEmailBillings.Text = propertiesService.EmailBillings;
                m_txtEmailEstimatePayment.Text = propertiesService.EmailEstimatePayment;
            }
        }
        protected void OnSave(object sender, EventArgs e)
        {
            Business.Services.SitePropertiesService propertiesService = new Business.Services.SitePropertiesService();

            IAProperty oIAProperty = propertiesService.GetSiteProperties(true);
            oIAProperty.RecutRequestThreshold = MemberProtect.Utility.ValidateInteger(m_txtRequestThreshold.Text);
            oIAProperty.ActivityInterval = MemberProtect.Utility.ValidateInteger(m_txtRequestActivityInterval.Text);
            oIAProperty.FeedbackEmailQuestion = ApplicationContext.CleanAddressList(m_txtFeedbackQuestion.Text);
            oIAProperty.FeedbackEmailProblem = ApplicationContext.CleanAddressList(m_txtFeedbackProblem.Text);
            oIAProperty.EmailSystemNotifications = ApplicationContext.CleanAddressList(m_txtEmailSystemNotifications.Text);
            oIAProperty.EmailBillings = ApplicationContext.CleanAddressList(m_txtEmailBillings.Text);
            oIAProperty.EmailEstimatePayment = ApplicationContext.CleanAddressList(m_txtEmailEstimatePayment.Text);
            propertiesService.UpdateSiteProperties(oIAProperty);

            ShowMessage("Settings saved.", InetSolution.Web.MessageTone.Positive);
        }
        public CreditCardService(Guid customerMemberProtectUserId, MemberProtect memberProtect, DataAccessDataContext dataContext, SitePropertiesService siteProperties)
        {
            _memberProtect = memberProtect;
             _dataContext = dataContext;
             _siteProperties = siteProperties;

             _enableDebug = siteProperties.AuthorizeNetIsDebug;
             _loginId = _memberProtect.Cryptography.Decrypt(_siteProperties.AuthorizeNetLoginID);
             _transactionKey = _memberProtect.Cryptography.Decrypt(_siteProperties.AuthorizeNetTransactionKey);
             _customerMemberProtectUserId = customerMemberProtectUserId;

             // audit
             if (memberProtect.CurrentUser.UserID != customerMemberProtectUserId)
             {
            // log that user is access customer credit card data?
             }
        }
        internal static MailAddress GetStandardFromAddress()
        {
            var siteProperties = new SitePropertiesService();
             var fromAddress = new MailAddress(siteProperties.EmailAddressFrom, siteProperties.EmailAddressFromName);

             return fromAddress;
        }
        internal static MailAddress GetStandardBillingFromAddress()
        {
            var siteProperties = new SitePropertiesService();
             var billingEmailAddresses = siteProperties.EmailBillings.Split(',').ToList();
             var fromAddress = new MailAddress(billingEmailAddresses[0], siteProperties.EmailAddressFromName + " Billing");

             return fromAddress;
        }
        public static void UserReactivateNoticeSend(StringBuilder messageBody)
        {
            var siteProperties = new SitePropertiesService();
             var notifyEmails = siteProperties.EmailSystemNotifications.Split(',').ToList();
             var addedTo = false;

             var mailMessage = new MailMessage
             {
            From = GetStandardFromAddress(),
            Subject = "Customer Reactivation Request",
            Body = messageBody.ToString(),
            IsBodyHtml = false
             };

             foreach (var email in notifyEmails.Where(Email.IsValidEmail))
             {
            if (addedTo)
            {
               mailMessage.CC.Add(new MailAddress(email.Trim()));
            }
            else
            {
               mailMessage.To.Add(new MailAddress(email.Trim()));
               addedTo = true;
            }
             }

             SendMessage(mailMessage);
        }
        public static void UserCancelRequestNoticeSend(int requestId, string requestNumberForDisplay, Guid orgId, string optionalMessage)
        {
            var siteProperties = new SitePropertiesService();

             var fullName = string.Format("{0} {1}", RequestContextHelper.MemberProtect.CurrentUser.GetDataItem("FirstName"),
                                      RequestContextHelper.MemberProtect.CurrentUser.GetDataItem("LastName"));
             var requestUrl = string.Format(RequestContextHelper.GetRootUrl("/sms/create-job.aspx?s=r&rid={0}"), requestId);
             var notifyEmails = siteProperties.EmailSystemNotifications.Split(',').ToList();
             var addedTo = false;
             var messageBody = string.Empty;
             var subject = string.Empty;

             if (orgId != Guid.Empty)
             {
            var companyName = RequestContextHelper.MemberProtect.Organization.GetName(orgId);
            messageBody = string.Format("{0} of {1} has cancelled <a href=\"{2}\">request #{3}</a>.", fullName, companyName, requestUrl,
                                        requestNumberForDisplay);
            subject = string.Format("Customer Canceled Request #{0}", requestNumberForDisplay);
             }
             else
             {
            messageBody = string.Format("{0} has cancelled <a href=\"{1}\">request #{2}</a>.", fullName, requestUrl, requestNumberForDisplay);
            subject = string.Format("Staff Canceled Request #{0}", requestNumberForDisplay);
             }

             if (!string.IsNullOrWhiteSpace(optionalMessage))
             {
            messageBody += string.Format("<br />Noting: {0}", optionalMessage.Replace("\n", "<br />"));
             }

             var mailMessage = new MailMessage
             {
            From = GetStandardFromAddress(),
            Subject = subject,
            Body = messageBody,
            IsBodyHtml = true
             };

             foreach (var email in notifyEmails.Where(Email.IsValidEmail))
             {
            if (addedTo)
            {
               mailMessage.CC.Add(new MailAddress(email.Trim()));
            }
            else
            {
               mailMessage.To.Add(new MailAddress(email.Trim()));
               addedTo = true;
            }
             }

             SendMessage(mailMessage);
        }
        public static void SystemNotificationSend(string subject, string body)
        {
            var fromAddress = GetStandardFromAddress();
             var siteProperties = new SitePropertiesService();
             var toAddresses = siteProperties.EmailSystemNotifications.Split(',').ToList();

             var mailMessage = new MailMessage
             {
            From = fromAddress,
            Subject = subject,
            Body = body,
            IsBodyHtml = true
             };

             foreach (var email in toAddresses)
             {
            if (Email.IsValidEmail(email))
            {
               mailMessage.To.Clear();
               mailMessage.To.Add(new MailAddress(email.Trim()));
            }

            SendMessage(mailMessage);
             }
        }
        public static void PaymentBillingNoticeSend(StringBuilder messageBody)
        {
            var addedTo = false;
             var siteProperties = new SitePropertiesService();
             var billingEmails = siteProperties.EmailBillings.Split(',').ToList();

             var mailMessage = new MailMessage
             {
            From = GetStandardFromAddress(),
            Subject = "Payment made on SpeedySpots.com",
            Body = messageBody.ToString(),
            IsBodyHtml = false
             };

             foreach (var email in billingEmails.Where(Email.IsValidEmail))
             {
            if (addedTo)
            {
               mailMessage.CC.Add(new MailAddress(email.Trim()));
            }
            else
            {
               mailMessage.To.Add(new MailAddress(email.Trim()));
               addedTo = true;
            }
             }

             SendMessage(mailMessage);
        }
        public static void JobReactivedBillingNotificationSend(string messageBody, string subject, string fromAddress, string fromName)
        {
            var addedTo = false;
             var siteProperties = new SitePropertiesService();
             var billingEmailAddresses = siteProperties.EmailBillings.Split(',').ToList();

             var fromMailAddress = GetStandardFromAddress();
             var replyToAddress = new MailAddress(fromAddress, fromName);

             var mailMessage = new MailMessage
             {
            From = fromMailAddress,
            ReplyTo = replyToAddress,
            Subject = subject,
            Body = messageBody,
            IsBodyHtml = false,
            Priority = MailPriority.High
             };

             foreach (var email in billingEmailAddresses.Where(Email.IsValidEmail))
             {
            if (addedTo)
            {
               mailMessage.CC.Add(new MailAddress(email.Trim()));
            }
            else
            {
               mailMessage.To.Add(new MailAddress(email.Trim()));
               addedTo = true;
            }
             }

             SendMessage(mailMessage);
        }