Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool logado = false;

            try {
                string login = textoEmail.Text;
                string senha = textoSenha.Text;

                foreach (Usuario u in usuarios)
                {
                    if (u.Email == login && u.Senha == senha)
                    {
                        if (u is Logista)
                        {
                            logado = true;
                            FormLogista logista = new FormLogista(u, this);
                            logista.ShowDialog();
                        }
                        else
                        {
                            logado = true;
                            FormCliente cliente = new FormCliente(u, this);
                            cliente.ShowDialog();
                        }
                    }
                }
                if (!logado)
                {
                    MessageBox.Show("Usuario ou senha incorretos");
                }
            } catch (Exception) {
                MessageBox.Show("Preemcha os campos corretamente");
            }
        }
 public FormCadastroProduto(FormLogista logista)
 {
     this.formLogista = logista;
     InitializeComponent();
 }