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(); } }
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(); } } }
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(); } } }
private void Activate(string activationId) { RegistrationService.CustomerServiceClient rs = null; try { rs = new RegistrationService.CustomerServiceClient(); rs.ActivateCustomer(activationId, CurrentCulture.TwoLetterISOLanguageName); if (CurrentCulture.TwoLetterISOLanguageName == "da") { recieptLabel.Text = GetContentFromUrl(ConfigurationManager.AppSettings["recieptTextUrl_da"]); } else { recieptLabel.Text = GetContentFromUrl(ConfigurationManager.AppSettings["recieptTextUrl_en"]); } } catch (EndpointNotFoundException exception) { OnError(exception); StatusLabel.Text = GetLocalResourceObject("FailureMessage").ToString(); } catch (TimeoutException exception) { OnError(exception); StatusLabel.Text = GetLocalResourceObject("FailureMessage").ToString(); } finally { if (rs != null) { rs.Close(); } } }