Beispiel #1
0
        private void login(object sender, RoutedEventArgs e)
        {
            try
            {
                string emailView = email.Text;
                string senhaView = senha.Password;

                if ((bool)usuario.IsChecked)
                {
                    UsuarioController usuController = new UsuarioController();

                    if (usuController.Autenticar(emailView, senhaView))
                    {
                        Application.Current.Properties["_user"] = usuController.carregaUsuarioEmail(emailView);

                        var usuario = Application.Current.Properties["_user"] as Usuario;
                        emailView = usuario.NomeUsuario;

                        AlterarUsuario altUsu = new AlterarUsuario();
                        Home           home   = new Home(1);
                        home.Show();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("E-mail e/ou senha inválidos!");
                    }
                }

                else if ((bool)estabelecimento.IsChecked)
                {
                    EstabelecimentoController estController = new EstabelecimentoController();

                    if (estController.Autenticar(emailView, senhaView))
                    {
                        Application.Current.Properties["_user"] = estController.carregaEstabelecimentoEmail(emailView);

                        var estabelecimento = Application.Current.Properties["_user"] as Estabelecimento;
                        emailView = estabelecimento.nomeFantasia;

                        AlterarEstabelecimento altEst = new AlterarEstabelecimento();
                        Home home = new Home(2);
                        home.Show();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("E-mail e/ou senha inválidos!");
                    }
                }
                else
                {
                    MessageBox.Show("Selecione uma das opções de login!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception: " + ex);
            }
        }
Beispiel #2
0
        private void salvar_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                _endEst.logradouroEstabelecimento = logradouro.Text;
                _endEst.numero = numero.Text;
                _endEst.bairro = bairro.Text;
                _endEst.cidade = cidade.Text;
                _endEst.uf     = uf.Text;

                EnderecoEstabelecimentoController endEstContr = new EnderecoEstabelecimentoController();

                int resp = endEstContr.Editar(_endEst);

                if (resp == 1)
                {
                    MessageBox.Show("Dados alterados com sucesso!");
                }
                else if (resp == 0)
                {
                    MessageBox.Show("Houston, temos um problema!");
                }

                this.Close();

                this.Close();

                AlterarEstabelecimento altEst = new AlterarEstabelecimento();
                altEst.btn_desativar.Visibility = Visibility.Collapsed;
                altEst.btn_ativar.Visibility    = Visibility.Collapsed;
                altEst.btn_editarEst.Visibility = Visibility.Visible;
                altEst.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ligue para o suporte: " + ex);
            }
        }
Beispiel #3
0
 private void alterarDadosEstabelecimento_Click(object sender, RoutedEventArgs e)
 {
     AlterarEstabelecimento altEst = new AlterarEstabelecimento();
     altEst.Show();
 }