示例#1
0
 private void btnExcluir_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Tem certeza que deseja excluir?", "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         if (Convert.ToInt32(lblid.Text) != -1)
         {
             Camadas.Model.orcamento orcamento    = new Camadas.Model.orcamento();
             Camadas.BLL.orcamento   bllOrcamento = new Camadas.BLL.orcamento();
             orcamento.idOrcamento = Convert.ToInt32(lblid.Text);
             orcamento.idCliente   = Convert.ToInt32(comboCliente.SelectedValue);
             orcamento.idVeiculo   = Convert.ToInt32(comboVeiculo.SelectedValue);
             orcamento.idProduto   = Convert.ToInt32(comboProduto.SelectedValue);
             //orcamento.idTipo_prod = Convert.ToInt32(comboTipo.SelectedValue);
             //orcamento.idTipo_serv = Convert.ToInt32(comboContador.SelectedValue);
             orcamento.idFuncionario = Convert.ToInt32(comboFuncionario.SelectedValue);
             orcamento.tipo          = comboTipo.Text;
             orcamento.serv_lateral  = comboServ_lateral.Text;
             orcamento.serv_frontal  = comboServ_frontal.Text;
             orcamento.valor         = Convert.ToDouble(textValor.Text);
             orcamento.status        = "";
             bllOrcamento.Delete(orcamento);
             dgvOrcamento.DataSource = (from p in bllOrcamento.Select()
                                        select new
             {
                 Orcamento = p.idOrcamento,
                 Cliente = new Camadas.BLL.cliente().Select().FirstOrDefault(t => t.idCliente == p.idCliente)?.nome ?? "Não encontrado",
                 Veiculo = new Camadas.BLL.veiculo().Select().FirstOrDefault(t => t.idVeiculo == p.idVeiculo)?.nome ?? "Não encontrado",
                 Produto = new Camadas.BLL.produto().Select().FirstOrDefault(t => t.idProduto == p.idProduto)?.tonalidade ?? "Não encontrado",
                 Funcionario = new Camadas.BLL.funcionario().Select().FirstOrDefault(t => t.idFuncionario == p.idFuncionario)?.nome ?? "Não Encontrado",
                 //TipoProduto = new Camadas.BLL.tipo_prod().Select().FirstOrDefault(t => t.idTipo_prod == p.idTipo_prod)?.tipo ?? "Não encontrado",
                 //TipoServiço = new Camadas.BLL.tipo_serv().Select().FirstOrDefault(t => t.idTipo_serv == p.idTipo_serv)?.idTipo_serv.ToString() ?? "Não encontrado",
                 TipoProduto = p.tipo,
                 ServiçoLateral = p.serv_lateral,
                 ServiçoFrontal = p.serv_frontal,
                 Valor = p.valor,
                 Status = p.status
             }).ToList();
         }
         else
         {
             MessageBox.Show("Não há nenhum cadastro para ser excluído!", "Confirmação", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         }
     }
     button1.Enabled = false;
     LimpaCampos();
 }
示例#2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (Valida())
     {
         Camadas.BLL.orcamento   bllOrcamento = new Camadas.BLL.orcamento();
         Camadas.Model.orcamento orcamento    = new Camadas.Model.orcamento();
         orcamento.idOrcamento   = Convert.ToInt32(lblid.Text);
         orcamento.idCliente     = Convert.ToInt32(comboCliente.SelectedValue);
         orcamento.idVeiculo     = Convert.ToInt32(comboVeiculo.SelectedValue);
         orcamento.idProduto     = Convert.ToInt32(comboProduto.SelectedValue);
         orcamento.idFuncionario = Convert.ToInt32(comboFuncionario.SelectedValue);
         orcamento.tipo          = comboTipo.Text;
         orcamento.serv_lateral  = comboServ_lateral.Text;
         orcamento.serv_frontal  = comboServ_frontal.Text;
         orcamento.valor         = Convert.ToDouble(textValor.Text);
         orcamento.status        = "APROVADO";
         bllOrcamento.Aprovar(orcamento);
         MessageBox.Show("Orçamento aprovado!", "Confirmação", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         this.Close();
     }
 }
示例#3
0
        private void btnGravar_Click(object sender, EventArgs e)
        {
            if (Valida())
            {
                Camadas.Model.orcamento orcamento    = new Camadas.Model.orcamento();
                Camadas.BLL.orcamento   bllOrcamento = new Camadas.BLL.orcamento();
                orcamento.idOrcamento = Convert.ToInt32(lblid.Text);
                orcamento.idCliente   = Convert.ToInt32(comboCliente.SelectedValue);
                orcamento.idVeiculo   = Convert.ToInt32(comboVeiculo.SelectedValue);
                orcamento.idProduto   = Convert.ToInt32(comboProduto.SelectedValue);
                //orcamento.idTipo_prod = Convert.ToInt32(comboTipo.SelectedValue);
                //orcamento.idTipo_serv = Convert.ToInt32(comboContador.SelectedValue);
                orcamento.idFuncionario = Convert.ToInt32(comboFuncionario.SelectedValue);
                orcamento.tipo          = comboTipo.Text;
                orcamento.serv_lateral  = comboServ_lateral.Text;
                orcamento.serv_frontal  = comboServ_frontal.Text;
                orcamento.valor         = Convert.ToDouble(textValor.Text);
                orcamento.status        = "ABERTO";
                if (orcamento.idOrcamento == -1)
                {
                    bllOrcamento.Insert(orcamento);
                }
                else
                {
                    bllOrcamento.Update(orcamento);
                }

                if (MessageBox.Show("Deseja incluir um orçamento?", "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    MessageBox.Show("Orçamento incluido com sucesso!", "Confirmação", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LimpaCampos();
                    Habilita(false);
                }
                else
                {
                    LimpaCampos();
                }
            }
        }