private void Initialize(CallUser customer)
 {
     parameters = new Dictionary<string, string>();
     parameters.Add("##IMAGE_URL##", GetImagesUrl());
     if (customer != null)
     {
         parameters.Add("##CUSTOMER_NAME##", customer.Forename + ", " + customer.Surname);
         parameters.Add("##USER_NAME##", customer.Email);
     }
 }
 public static void SendCallMeEmailToUser(CallUser customer,string email)
 {
     MailMessage message = new MailMessage();
     message.To.Add(new MailAddress(email));
     EmailTemplateFactory templateFactory = new EmailTemplateFactory(customer);
     EmailTemplate emailTemplate = templateFactory.GetEmailContents(WebConstants.TemplateNames.CALLUSER);
     if (emailTemplate != null)
     {
         message.Body = emailTemplate.HTML;
         message.Subject = emailTemplate.Subject;
     }
     else
     {
         message.Subject = "Simplicity Call Me Request";
         message.Body = "Thank you for submitting your request. We will call you back shortly.";
     }
     message.IsBodyHtml = true;
     SendEmail(message);
 }
 public EmailTemplateFactory(CallUser customer)
 {
     Initialize(customer);
 }
 public static void SendCallMeEmailToAdmin(CallUser customer,string contents, string request)
 {
     SendCallMeEmailToAdmin(customer, contents, "Simplicity Call Me Request", request);
 }
 private static void SendCallMeEmailToAdmin(CallUser customer,string contents, string subject, string request)
 {
     MailMessage message = new MailMessage();
     string[] adminEmailAddresses = ConfigurationSettings.AppSettings[WebConstants.Config.ADMIN_EMAIL_ADDRESSES].Split(',');
     foreach (string adminEmailAddress in adminEmailAddresses)
     {
         message.To.Add(new MailAddress(adminEmailAddress));
     }
     EmailTemplateFactory templateFactory = new EmailTemplateFactory(customer);
     templateFactory.Paramters.Add("##REQUEST##", request);
     templateFactory.Paramters.Add("##FIRSTNAME##",customer.Forename);
     templateFactory.Paramters.Add("##SURNAME##",customer.Surname);
     templateFactory.Paramters.Add("##USEREMAIL##",customer.Email);
     templateFactory.Paramters.Add("##CONTENTS##",contents);
     EmailTemplate emailTemplate;
     if (request == "Call ME")
     {
         emailTemplate = templateFactory.GetEmailContents(WebConstants.TemplateNames.CALLADMIN);
     }
     else{
         emailTemplate = templateFactory.GetEmailContents(WebConstants.TemplateNames.VIEWDEMOADMIN);
     }
     if (emailTemplate != null)
     {
         message.Body = emailTemplate.HTML;
         message.Subject = emailTemplate.Subject;
     }
     else
     {
         message.Subject = subject;
         message.Body = contents;
     }
     message.IsBodyHtml = true;
     SendEmail(message);
 }
        public static void SendViewDemoEmailToUser(CallUser customer,string email)
        {
            MailMessage message = new MailMessage();
            message.To.Add(new MailAddress(email));
            EmailTemplateFactory templateFactory = new EmailTemplateFactory(customer);
            EmailTemplate emailTemplate = templateFactory.GetEmailContents(WebConstants.TemplateNames.VIEWDEMO);
            if (emailTemplate != null)
            {
                message.Body = emailTemplate.HTML;
                message.Subject = emailTemplate.Subject;
            }
            else
            {
                message.Subject = "Simplicity View Demo Request";
                message.Body = "Thank you for Viewing Demo.";
            }
            message.IsBodyHtml = true;

            SendEmail(message);
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the CallUsers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCallUsers(CallUser callUser)
 {
     base.AddObject("CallUsers", callUser);
 }
 /// <summary>
 /// Create a new CallUser object.
 /// </summary>
 /// <param name="callMeID">Initial value of the CallMeID property.</param>
 /// <param name="forename">Initial value of the Forename property.</param>
 /// <param name="surname">Initial value of the Surname property.</param>
 /// <param name="telephone">Initial value of the Telephone property.</param>
 /// <param name="cellNumber">Initial value of the CellNumber property.</param>
 /// <param name="email">Initial value of the Email property.</param>
 /// <param name="viewDemo">Initial value of the ViewDemo property.</param>
 public static CallUser CreateCallUser(global::System.Int32 callMeID, global::System.String forename, global::System.String surname, global::System.String telephone, global::System.String cellNumber, global::System.String email, global::System.Boolean viewDemo)
 {
     CallUser callUser = new CallUser();
     callUser.CallMeID = callMeID;
     callUser.Forename = forename;
     callUser.Surname = surname;
     callUser.Telephone = telephone;
     callUser.CellNumber = cellNumber;
     callUser.Email = email;
     callUser.ViewDemo = viewDemo;
     return callUser;
 }