Esempio n. 1
0
        public NewCustomerEmailComposer(TrexCustomer trexCustomer)
        {
            _trexCustomer = trexCustomer;

            Title  = "A new customer has just activated a T.Rex database";
            IsHtml = false;
        }
Esempio n. 2
0
        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;
            }
        }
Esempio n. 3
0
        private void SendWelcomeMail(string language, TrexCustomer trexCustomer)
        {
            var welcomeMailComposer = new WelcomeMailComposer(language);

            welcomeMailComposer.Recipients.Add(trexCustomer.CreatorEmail);
            welcomeMailComposer.Sender = _appSettings.TrexSupportEmail;
            _emailService.SendEmail(welcomeMailComposer);
        }
Esempio n. 4
0
        private void SendNewCustomerMail(TrexCustomer trexCustomer)
        {
            var newCustomerComposer = new NewCustomerEmailComposer(trexCustomer);

            newCustomerComposer.Recipients.Add(_appSettings.RegistrationNotificationEmail);
            newCustomerComposer.Sender = _appSettings.TrexSupportEmail;
            _emailService.SendEmail(newCustomerComposer);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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();
                }
            }
        }
Esempio n. 7
0
        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;
        }
Esempio n. 8
0
        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();
        }