Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            MainAdmin mainAdmin = new MainAdmin();

            mainAdmin.Show();
            this.Hide();
        }
Esempio n. 2
0
        private void bt1_Click(object sender, EventArgs e)
        {
            String user = tb_user.Text;
            String pw   = tb_pw.Text;
            bool   aux  = false;
            char   tipo;

            User utilizador = context.UserSet.Where(i => i.Username == user).FirstOrDefault();

            if (utilizador == null)
            {
                MessageBox.Show("utilizador não existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                aux = VerificarPW(utilizador, pw);
                if (aux == false)
                {
                    MessageBox.Show("Credenciais erradas", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    tipo = VerificarTipo(utilizador);
                    ProjectoESGPS.Properties.Settings.Default.User = user;
                    ProjectoESGPS.Properties.Settings.Default.Pw   = pw;
                    ProjectoESGPS.Properties.Settings.Default.Tipo = tipo;
                    ProjectoESGPS.Properties.Settings.Default.Save();

                    if (tipo == 'A')
                    {
                        MainAdmin mainAdmin = new MainAdmin();
                        mainAdmin.Show();
                        this.Hide();
                    }
                    else
                    {
                        Main main = new Main();
                        main.Show();
                        this.Hide();
                    }
                }
            }
        }