Beispiel #1
0
        public UIElement GetRegisterElement()
        {
            AnalyticRegisterViewModel viewModel = new AnalyticRegisterViewModel(new AnalyticRegisterModel());
            RegisterAnalyticControl   control   = new RegisterAnalyticControl(viewModel);

            viewModel.AnalyticCreated += (s, e) =>
            {
                AnalyticRegisterModel analytic    = e.Analytic;
                AnalyticRegisterDTO   analyticDTO = Mapper.Map <AnalyticRegisterModel, AnalyticRegisterDTO>(analytic);

                using (IAccountService service = factory.CreateAccountService())
                {
                    ServiceMessage serviceMessage = service.Register(analyticDTO);
                    RaiseReceivedMessageEvent(serviceMessage.IsSuccessful, serviceMessage.Message);

                    if (serviceMessage.IsSuccessful)
                    {
                        viewModel.FirstName       = String.Empty;
                        viewModel.LastName        = String.Empty;
                        viewModel.PhoneNumber     = String.Empty;
                        viewModel.Login           = String.Empty;
                        viewModel.Password        = String.Empty;
                        viewModel.ConfirmPassword = String.Empty;
                        Notify();
                    }
                }
            };

            return(control);
        }
 public RegisterAnalyticControl(AnalyticRegisterViewModel viewModel)
 {
     InitializeComponent();
     this.DataContext = viewModel;
 }