private void btnExcluir_Click(object sender, EventArgs e)
        {
            ClassConexao.Conectando();
            ClassConexao.StrConexao = "delete from dbo.Carros Where Modelo='" + cbbModelo.Text + "'";
            ClassConexao.Modificando();

            MessageBox.Show("Carro Deletadado com sucesso");
            cbbMarca.Text         = "";
            cbbModelo.Text        = "";
            txtAlterarModelo.Text = "";
            txtVersao.Text        = "";
            txtCor.Text           = "";
            txtOpicionais.Text    = "";
            txtValorCompra.Text   = "";
            txtValorVenda.Text    = "";

            ClassConexao.Conectando();
            ClassConexao.StrConexao = "select Marca from dbo.Marcas order by Marca";
            ClassConexao.Verificando();

            for (int i = 0; i < ClassConexao.Table.Rows.Count; i++)
            {
                cbbMarca.Items.Insert(i, ClassConexao.Table.Rows[i][0].ToString());
            }
        }
        private void btnCadastrar_Click(object sender, EventArgs e)
        {
            if (txtUsuario.Text == "" || txtSenha.Text == "")
            {
                MessageBox.Show("Impossivel de cadastrar Login, Campos em branco", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                ClassConexao.Conectando();
                ClassConexao.StrConexao = "insert into dbo.Login (Usuario,Senha) values('" + txtUsuario.Text + "','" + txtSenha.Text + "')";
                ClassConexao.Modificando();

                MessageBox.Show("Loguin Cadastrado com Sucesso");
            }
        }
        private void btnAlterar_Click(object sender, EventArgs e)
        {
            ClassConexao.Conectando();
            ClassConexao.StrConexao = "update dbo.Carros set Marca='" + cbbMarca.Text + "', Modelo='" + txtAlterarModelo.Text + "', Ano='" + dtpAno.Text + "', Versao='" + txtVersao.Text + "', Cor='" + txtCor.Text + "', Opicionais='" + txtOpicionais.Text + "', ValorCompra='" + txtValorCompra.Text + "', ValorVenda='" + txtValorVenda.Text + "' where Marca='" + cbbMarca.Text + "' and Modelo='" + cbbModelo.Text + "'";
            ClassConexao.Modificando();

            MessageBox.Show("Marca Alterada com sucesso");
            cbbMarca.Text         = "";
            cbbModelo.Text        = "";
            txtAlterarModelo.Text = "";
            dtpAno.Text           = "";
            txtVersao.Text        = "";
            txtCor.Text           = "";
            txtOpicionais.Text    = "";
            txtValorCompra.Text   = "";
            txtValorVenda.Text    = "";
        }
Пример #4
0
        private void btnAdicionar_Click(object sender, EventArgs e)
        {
            if (txtMarca.Text == "")
            {
                MessageBox.Show("Impossivel de Adicionar a Marca, Texto 'Marca' em Branco");
                txtMarca.Focus();
            }
            else
            {
                ClassConexao.Conectando();
                ClassConexao.StrConexao = "insert into dbo.Marcas(Marca) values('" + txtMarca.Text + "')";
                ClassConexao.Modificando();

                MessageBox.Show("Marca Adicionada com Sucesso");
                txtMarca.Text = "";
                txtMarca.Focus();
            }
        }
        private void btnAlterar_Click(object sender, EventArgs e)
        {
            ClassConexao.Conectando();
            ClassConexao.StrConexao = "update dbo.Marcas set Marca='" + txtAlterarMarca.Text + "' where Marca='" + cbbMarca.Text + "'";
            ClassConexao.Modificando();

            MessageBox.Show("Marca Alterada com sucesso");
            cbbMarca.Text        = "";
            txtAlterarMarca.Text = "";

            ClassConexao.Conectando();
            ClassConexao.StrConexao = "select Marca from dbo.Marcas order by Marca";
            ClassConexao.Verificando();

            for (int i = 0; i < ClassConexao.Table.Rows.Count; i++)
            {
                cbbMarca.Items.Insert(i, ClassConexao.Table.Rows[i][0].ToString());
            }
        }
Пример #6
0
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            ClassConexao.Conectando();
            ClassConexao.StrConexao = "delete from dbo.Login Where Usuario='" + cbbUsuario.Text + "'";
            ClassConexao.Modificando();

            MessageBox.Show("Login Deletadada com sucesso");
            cbbUsuario.Text        = "";
            txtAlterarUsuario.Text = "";
            txtSenha.Text          = "";

            ClassConexao.Conectando();
            ClassConexao.StrConexao = "select Usuario from dbo.Login order by Usuario";
            ClassConexao.Verificando();

            for (int i = 0; i < ClassConexao.Table.Rows.Count; i++)
            {
                cbbUsuario.Items.Insert(i, ClassConexao.Table.Rows[i][0].ToString());
            }
        }
        private void btnAutenticar_Click(object sender, EventArgs e)
        {
            if ((txtUsuarioAutenticado.Text == "usuario") && (txtSenhaAutenticado.Text == "123456"))
            {
                ClassConexao.Conectando();
                ClassConexao.StrConexao = "insert into dbo.Login (Usuario,Senha) values('" + txtUsuario.Text + "','" + txtSenha.Text + "')";
                ClassConexao.Modificando();


                gpbAutenticar.Enabled    = false;
                gpbCadastroLogin.Enabled = true;
                txtUsuario.Text          = "";
                txtSenha.Text            = "";
                txtUsuario.Focus();
            }
            else
            {
                gpbAutenticar.Enabled    = false;
                gpbCadastroLogin.Enabled = true;
                txtUsuario.Text          = "";
                txtSenha.Text            = "";
            }
        }