Ejemplo n.º 1
0
 private void telaPrincipalToolStripMenuItem_Click(object sender, EventArgs e)
 {
     {
         this.Hide();
         var tela_principal = new Tela_Principal(tslUsuario.Text);
         tela_principal.Closed += (s, args) => this.Close();
         tela_principal.Show();
     }
 }
Ejemplo n.º 2
0
 private void toolStripTextBox1_Click_1(object sender, EventArgs e)
 {
     {
         panel.Controls.Clear();
         Tela_Principal myForm = new Tela_Principal(tslUsuario.Text);
         myForm.FormBorderStyle = FormBorderStyle.None;
         myForm.TopLevel        = false;
         myForm.AutoScroll      = true;
         panel.Controls.Add(myForm);
         myForm.Show();
     }
 }
Ejemplo n.º 3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            SqlConnection conexao = new SqlConnection();

            conexao.ConnectionString = Properties.Settings.Default.DB_TCM_OutturnConnectionString;
            try
            {
                conexao.Open();
                SqlCommand comando = new SqlCommand();
                comando.CommandText = "SELECT USUARIO, SENHA FROM TB_LOGAR WHERE USUARIO = \'" + txtUsuario.Text + "\'";
                comando.CommandType = CommandType.Text;
                comando.Connection  = conexao;
                SqlDataReader DR;
                DR = comando.ExecuteReader();
                if (DR.HasRows)
                {
                    while (DR.Read())
                    {
                        if (DR.GetValue(1).ToString() == txtSenha.Text)
                        {
                            this.Hide();
                            var tela_principal = new Tela_Principal(txtUsuario.Text);
                            tela_principal.Closed += (s, args) => this.Close();
                            tela_principal.Show();
                        }

                        if (DR.GetValue(1).ToString() != txtSenha.Text)
                        {
                            MessageBox.Show("Senha incorreta", "Aviso");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Usuario ou senha incorretos", "Aviso");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro: " + ex.Message);
            }
        }