public NewCustomerEmailComposer(TrexCustomer trexCustomer) { _trexCustomer = trexCustomer; Title = "A new customer has just activated a T.Rex database"; IsHtml = false; }
public TrexCustomer SaveCustomer(TrexCustomer customer) { try { var context = ObjectFactory.GetInstance <ITrexBaseContextProvider>(); var entityContext = context.TrexBaseEntityContext; if (customer.Id != 0) { entityContext.Attach(customer); entityContext.DetectChanges(); entityContext.SaveChanges(); } else { entityContext.TrexCustomers.AddObject(customer); entityContext.SaveChanges(); } return(customer); } catch (Exception ex) { OnError(ex); throw; } }
private void SendWelcomeMail(string language, TrexCustomer trexCustomer) { var welcomeMailComposer = new WelcomeMailComposer(language); welcomeMailComposer.Recipients.Add(trexCustomer.CreatorEmail); welcomeMailComposer.Sender = _appSettings.TrexSupportEmail; _emailService.SendEmail(welcomeMailComposer); }
private void SendNewCustomerMail(TrexCustomer trexCustomer) { var newCustomerComposer = new NewCustomerEmailComposer(trexCustomer); newCustomerComposer.Recipients.Add(_appSettings.RegistrationNotificationEmail); newCustomerComposer.Sender = _appSettings.TrexSupportEmail; _emailService.SendEmail(newCustomerComposer); }
private void SendActivationMail(TrexCustomer customer, string password, string language) { throw new Exception("Online activation is no longer supported"); //var mailComposer = new TrexActivationEmailComposer(customer, password, language); //mailComposer.Recipients.Add(customer.CreatorEmail); //mailComposer.Sender = _appSettings.TrexSupportEmail; //_emailService.SendEmail(mailComposer); }
private void CreateCustomer() { Reset(); ServiceErrorLabel.Visible = false; CustomerServiceClient rs = null; try { rs = ServiceAgent.GetServiceClient(); var trexCustomer = new TrexCustomer(); trexCustomer.CompanyName = CompanyNameTextBox.Text; trexCustomer.Country = CountriesDropDownList.SelectedValue; trexCustomer.Address1 = Address1TextBox.Text; //trexCustomer.Address2 = Address2TextBox.Text; trexCustomer.Zipcode = ZipCodeTextBox.Text; trexCustomer.City = cityTextBox.Text; trexCustomer.CreatorFullName = FullNameTextBox.Text; trexCustomer.CreatorPhone = PhoneNumberTextBox.Text; trexCustomer.CustomerId = ApplicationNameTextBox.Text; trexCustomer.CreateDate = DateTime.Now; trexCustomer.VatNumber = string.Empty; rs.SaveCustomer(trexCustomer); Session["customerId"] = ApplicationNameTextBox.Text; Session["fullname"] = FullNameTextBox.Text; //Session["source"] = "stepone"; //Session["guid"] = Guid.NewGuid().ToString(); } catch (EndpointNotFoundException exception) { OnError(exception); ServiceErrorLabel.Visible = true; } catch (TimeoutException exception) { OnError(exception); ServiceErrorLabel.Visible = true; } finally { if (rs != null) { rs.Close(); } } }
public TrexActivationEmailComposer(TrexCustomer customer, string password, string language) { _customer = customer; _password = password; _language = language; if (_language == "da") { _mailSubject = ConfigurationManager.AppSettings["activationMailSubject_da"]; _mailTemplatePath = ConfigurationManager.AppSettings["activationMailTemplate_da"]; } else { _mailSubject = ConfigurationManager.AppSettings["activationMailSubject_en"]; _mailTemplatePath = ConfigurationManager.AppSettings["activationMailTemplate_en"]; } Title = _mailSubject; }
private void CreateUser(TrexCustomer trexCustomer) { var newUser = new User { UserName = trexCustomer.CreatorUserName, Name = trexCustomer.CreatorFullName, Email = trexCustomer.CreatorEmail, }; var connectionStringTemplate = ConfigurationManager.AppSettings["defaultEFConnectionString"]; var connectionString = string.Format(connectionStringTemplate, trexCustomer.ConnectionString); var entityConnectionStringBuilder = new EntityConnectionStringBuilder(connectionString); var entityConnection = new EntityConnection(entityConnectionStringBuilder.ToString()); var entityContext = new TrexEntities(entityConnection); entityContext.Users.AddObject(newUser); entityContext.SaveChanges(); }