Beispiel #1
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();
                }
            }
        }
Beispiel #2
0
        private void finalize()
        {
            RegistrationService.CustomerServiceClient rs = null;
            var hasErrors = true;

            try
            {
                rs = ServiceAgent.GetServiceClient();

                var activationId = Guid.NewGuid().ToString();

                if (rs.A(activationId, (string)Session["app"]))
                {
                    hasErrors = false;
                }
            }
            catch (EndpointNotFoundException exception)
            {
                OnError(exception);
                hasErrors = true;
            }
            catch (TimeoutException exception)
            {
                OnError(exception);
                hasErrors = true;
            }
            catch (Exception exception)
            {
                OnError(exception);
                throw;
            }
            finally
            {
                if (rs != null)
                {
                    rs.Close();
                }

                if (hasErrors)
                {
                    StatusLabel.Text = GetLocalResourceObject("FailureMessage").ToString();
                    TitleLabel.Text  = GetLocalResourceObject("FailureTitleLabel").ToString();
                }
                else
                {
                    StatusLabel.Text = GetLocalResourceObject("SuccessMessage").ToString();
                    TitleLabel.Text  = GetLocalResourceObject("SuccessTitleLabel").ToString();
                }
                Session.Clear();
            }
        }
Beispiel #3
0
        private void CreateAdministrator()
        {
            RegistrationService.CustomerServiceClient rs = null;


            try
            {
                rs = ServiceAgent.GetServiceClient();
                var response = rs.RegisterNewUser(_customerId, UserNameTextBox.Text, PasswordTextBox.Text, _fullName, EmailTextBox.Text, CurrentCulture.TwoLetterISOLanguageName);

                if (response.Success)
                {
                    registrationFormPlaceholder.Visible = false;
                    RecieptPlaceHolder.Visible          = true;
                }
                else
                {
                    ServiceErrorLabel.Visible = true;
                    ServiceErrorLabel.Text    = response.Response;
                }
            }

            catch (EndpointNotFoundException exception)
            {
                OnError(exception);
                ServiceErrorLabel.Text    = (string)System.Web.HttpContext.GetLocalResourceObject("~/Activation.aspx", "User_CreateAdministrator_Could_not_contact_service_at_the_moment__Please_try_again_later");
                ServiceErrorLabel.Visible = true;
            }
            catch (TimeoutException exception)
            {
                OnError(exception);
                ServiceErrorLabel.Text    = (string)System.Web.HttpContext.GetLocalResourceObject("~/Activation.aspx", "User_CreateAdministrator_Could_not_contact_service_at_the_moment__Please_try_again_later");
                ServiceErrorLabel.Visible = true;
            }

            finally
            {
                if (rs != null)
                {
                    rs.Close();
                }
            }
        }
Beispiel #4
0
        private bool CheckCustomerId()
        {
            var exists = false;

            CustomerServiceClient rs = null;

            try
            {
                rs = ServiceAgent.GetServiceClient();

                if (rs.ExistsApplicationName(ApplicationNameTextBox.Text))
                {
                    exists = true;
                }
            }
            catch (EndpointNotFoundException exception)
            {
                OnError(exception);
                ApplicationNameAvailableValidator.ErrorMessage = GetLocalResourceObject("ApplicationNameUnableToValidate").ToString();
                ServiceErrorLabel.Visible = true;
            }
            catch (TimeoutException exception)
            {
                OnError(exception);
                ApplicationNameAvailableValidator.ErrorMessage = GetLocalResourceObject("ApplicationNameUnableToValidate").ToString();
                ServiceErrorLabel.Visible = true;
            }

            finally
            {
                if (rs != null)
                {
                    rs.Close();
                }
            }

            return(exists);
        }
Beispiel #5
0
        private void AppendCustomerDetails()
        {
            RegistrationService.CustomerServiceClient rs = null;



            try
            {
                rs = ServiceAgent.GetServiceClient();
                var customer = rs.GetCustomerByCustomerId(_customerId);


                customer.CreatorUserName = UserNameTextBox.Text;
                customer.CreatorEmail    = EmailConfirmTextBox.Text;

                rs.SaveCustomer(customer);
            }
            catch (EndpointNotFoundException exception)
            {
                OnError(exception);

                ServiceErrorLabel.Visible = true;
            }
            catch (TimeoutException exception)
            {
                OnError(exception);

                ServiceErrorLabel.Visible = true;
            }

            finally
            {
                if (rs != null)
                {
                    rs.Close();
                }
            }
        }