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 FrmEditarCarros_Load(object sender, EventArgs e)
        {
            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());
            }

            //ClassConexao.Conectando();
            //ClassConexao.StrConexao = "select Modelo from dbo.Carros order by Modelo";
            //ClassConexao.Verificando();

            //for (int i = 0; i < ClassConexao.Table.Rows.Count; i++)
            //{
            //    cbbModelo.Items.Insert(i, ClassConexao.Table.Rows[i][0].ToString());
            //}

            gpbEditatCarros.Enabled = false;
            gpbAutenticar.Enabled   = true;

            dtpAno.Format       = DateTimePickerFormat.Custom;
            dtpAno.CustomFormat = "yyyy";
        }
示例#3
0
 private void cbbMarcas_SelectedIndexChanged(object sender, EventArgs e)
 {
     ClassConexao.Conectando();
     if (cbbMarcas.Text == "Todas as Marcas")
     {
         ClassConexao.StrConexao = "select * from dbo.Marcas";
         ClassConexao.Verificando();
         dgvMarcas.DataSource = ClassConexao.Table;
     }
 }
 private void cbbLoguin_SelectedIndexChanged(object sender, EventArgs e)
 {
     ClassConexao.Conectando();
     if (cbbLogin.Text == "Todos os Login")
     {
         ClassConexao.StrConexao = "select * from dbo.Login";
         ClassConexao.Verificando();
         dgvLogin.DataSource = ClassConexao.Table;
     }
 }
        private void FrmVisualizarCarros_Load(object sender, EventArgs e)
        {
            ClassConexao.Conectando();
            ClassConexao.StrConexao = "select Marca from dbo.Marcas order by Marca";
            ClassConexao.Verificando();

            for (int i = 0; i < ClassConexao.Table.Rows.Count; i++)
            {
                cbbCarros.Items.Insert(i, ClassConexao.Table.Rows[i][0].ToString());
            }
        }
示例#6
0
        private void FrmEditarLogin_Load(object sender, EventArgs e)
        {
            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());
            }
            gpbEditarLogin.Enabled = false;
        }
        private void FrmEditarMarcas_Load(object sender, EventArgs e)
        {
            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());
            }
            gpbAutenticar.Enabled   = true;
            gpbEditarMarcas.Enabled = false;
        }
        private void FrmCadastroCarros_Load(object sender, EventArgs e)
        {
            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());
            }
            dtpAno.Format       = DateTimePickerFormat.Custom;
            dtpAno.CustomFormat = "yyyy";
        }
        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 cbbCarros_SelectedIndexChanged(object sender, EventArgs e)
        {
            //// Atlerar o ComboBox Talks para Todos os Carros
            //ClassConexao.Conectando();
            //if (cbbCarros.Text == "Todos os Carros")
            //{
            //    ClassConexao.StrConexao = "select * from dbo.Carros ordem by Marca";
            //    ClassConexao.Verificando();
            //    dgvCarros.DataSource = ClassConexao.Table;
            //}
            ClassConexao.Conectando();
            ClassConexao.StrConexao = "select * from dbo.Carros where Marca='" + cbbCarros.Text + "'";
            ClassConexao.Verificando();

            dgvCarros.DataSource = ClassConexao.Table;
        }
示例#11
0
 private void btnEntrar_Click(object sender, EventArgs e)
 {
     ClassConexao.Conectando();
     ClassConexao.StrConexao = "select Usuario,Senha from dbo.Login where Usuario='" + txtUsuario.Text + "' and Senha='" + txtSenha.Text + "'";
     ClassConexao.Verificando();
     if (ClassConexao.Table.Rows.Count == 0)
     {
         MessageBox.Show("Não foi possiver se conectar com o sistema!");
         txtUsuario.Focus();
     }
     else
     {
         FrmMenu Menu = new FrmMenu();
         Menu.Show();
         this.Hide();
     }
 }
        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    = "";
        }
示例#13
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());
            }
        }
示例#15
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 btnCarregarMarca_Click(object sender, EventArgs e)
        {
            if (cbbMarca.Text == "")
            {
                MessageBox.Show("Nenhuma Marca Selecionada");
                return;
            }
            else
            {
                ClassConexao.Conectando();
                ClassConexao.StrConexao = "select Modelo from dbo.Carros where Marca='" + cbbMarca.Text + "'";
                ClassConexao.Verificando();

                for (int i = 0; i < ClassConexao.Table.Rows.Count; i++)
                {
                    cbbModelo.Items.Insert(i, ClassConexao.Table.Rows[i][0].ToString());
                }

                MessageBox.Show("Modelo Carregado com Sucesso");
            }
        }
        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            = "";
            }
        }
        private void btnAdicionar_Click(object sender, EventArgs e)
        {
            if (cbbMarca.Text == "" || txtModelo.Text == "" || dtpAno.Text == "" || txtVersao.Text == "" || txtCor.Text == "" || txtOpicionais.Text == "" || txtValorCompra.Text == "" || txtValorVenda.Text == "")
            {
                MessageBox.Show("Impossivel de Cadastrar um carro, Existe campos em branco");
                cbbMarca.Focus();
            }
            else
            {
                ClassConexao.Conectando();
                ClassConexao.StrConexao = "insert into dbo.Carros (Marca,Modelo,Ano,Versao,Cor,Opicionais,ValorCompra,ValorVenda) values ('" + cbbMarca.Text + "','" + txtModelo.Text + "','" + dtpAno.Text + "','" + txtVersao.Text + "','" + txtCor.Text + "','" + txtOpicionais.Text + "','" + txtValorCompra.Text + "','" + txtValorVenda.Text + "')";
                ClassConexao.Verificando();

                MessageBox.Show("Carro Cadastrado com Sucesso!");
                cbbMarca.Text       = "";
                txtModelo.Text      = "";
                txtVersao.Text      = "";
                txtCor.Text         = "";
                txtOpicionais.Text  = "";
                txtValorCompra.Text = "";
                txtValorVenda.Text  = "";
                cbbMarca.Focus();
            }
        }
        private void btnCarregarModelo_Click(object sender, EventArgs e)
        {
            if (cbbMarca.Text == "" || cbbModelo.Text == "")
            {
                MessageBox.Show("Nenhuma Marca / Modelo Selecionado");
                return;
            }
            else
            {
                ClassConexao.Conectando();
                ClassConexao.StrConexao = "select * from dbo.Carros where Marca='" + cbbMarca.Text + "' and Modelo='" + cbbModelo.Text + "'";
                ClassConexao.Verificando();

                txtAlterarModelo.Text = ClassConexao.Table.Rows[0]["Modelo"].ToString();
                dtpAno.Text           = ClassConexao.Table.Rows[0]["Ano"].ToString();
                txtVersao.Text        = ClassConexao.Table.Rows[0]["Versao"].ToString();
                txtCor.Text           = ClassConexao.Table.Rows[0]["Cor"].ToString();
                txtOpicionais.Text    = ClassConexao.Table.Rows[0]["Opicionais"].ToString();
                txtValorCompra.Text   = ClassConexao.Table.Rows[0]["ValorCompra"].ToString();
                txtValorVenda.Text    = ClassConexao.Table.Rows[0]["ValorVenda"].ToString();

                MessageBox.Show("Modelo Carregado com Sucesso");
            }
        }