private void SetUtente()
 {
     CreaSchedaAutomaticaPresenter.GetInstance().Utente = _utente;
     CreaSchedaManualePresenter.GetInstance().Utente    = _utente;
     ProfiloPresenter.GetInstance().Utente             = _utente;
     ProgressiPresenter.GetInstance().Utente           = _utente;
     SchermataPrincipalePresenter.GetInstance().Utente = _utente;
 }
        private void SaveUtente(object sender, EventArgs e)
        {
            if (!_creaAccountView.isCompleted() || !_creaAccountView.CheckPassword())
            {
                return;
            }
            try
            {
                if (_mpm.CheckUsername(_creaAccountView.textBoxUsername.Text))
                {
                    MessageBox.Show("Username già presente");
                    return;
                }
                Sesso sesso = _creaAccountView.RadioButtonFemmina.Checked ? Sesso.Femmina : Sesso.Maschio;
                _utente = new Utente(_creaAccountView.textBoxUsername.Text, _creaAccountView.TextBoxNome.Text, _creaAccountView.TextBoxCognome.Text,
                                     new DateTime(int.Parse(_creaAccountView.comboBoxAnno.Text), int.Parse(_creaAccountView.comboBoxMese.Text),
                                                  int.Parse(_creaAccountView.comboBoxGiorno.Text)), (int)_creaAccountView.numericUpDownPeso.Value,
                                     (int)_creaAccountView.numericUpDownAltezza.Value, sesso);

                //inseriamo l'utente nel DB
                _mpm.SaveUtente(_utente, _creaAccountView.CreaPassword.Text);

                if (_creaAccountView.checkBoxAutomatica.Checked)
                {
                    UserControl view = (CreaSchedaAutomaticaView)ViewFactory.GetView("CreaSchedaAutomaticaView");
                    CreaSchedaAutomaticaPresenter.GetInstance().Utente = _utente;
                    _mainForm.SetView(view);
                }
                else
                {
                    SetUtente();
                    CreaSchedaManualeView view = (CreaSchedaManualeView)ViewFactory.GetView("CreaSchedaManualeView");
                    view.buttonIndietro.Visible = false;
                    view.buttonIndietro.Enabled = false;
                    _mainForm.SetView(view);
                }
            }
            catch (SqlException)
            {
                MessageBox.Show("Errore nel database: verificare la procedura d'installazione", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
        private void CreatePresenters()
        {
            UserControl view;

            view = ViewFactory.GetView("CreaSchedaAutomaticaView");
            CreaSchedaAutomaticaPresenter.Create(_mpm, (CreaSchedaAutomaticaView)view, _gestorePianiAllenamento);

            view = ViewFactory.GetView("SchermataPrincipaleView");
            SchermataPrincipalePresenter.Create(_mpm, (SchermataPrincipaleView)view);

            view = ViewFactory.GetView("CreaSchedaManualeView");
            CreaSchedaManualePresenter.Create(_mpm, (CreaSchedaManualeView)view);

            view = ViewFactory.GetView("ProgressiView");
            ProgressiPresenter.Create(_mpm, (ProgressiView)view, _gestorePianiAllenamento);

            view = ViewFactory.GetView("ProfiloView");
            ProfiloPresenter.Create(_mpm, (ProfiloView)view);

            view = ViewFactory.GetView("VideoView");
            VideoPresenter.Create(_mpm, (VideoView)view);
        }