public void Aprovar(Model.orcamento orc) { //mudar orc para aprovado orcamento bllOrc = new orcamento(); bllOrc.Update(orc); Model.servico srv = new Model.servico(); servico bllServico = new servico(); srv.idServico = orc.idOrcamento; srv.idCliente = orc.idCliente; srv.idVeiculo = orc.idVeiculo; srv.idProduto = orc.idProduto; srv.idFuncionario = orc.idFuncionario; srv.tipo = orc.tipo; srv.serv_lateral = orc.serv_lateral; srv.serv_frontal = orc.serv_frontal; srv.valor = orc.valor; srv.status = orc.status; bllServico.Insert(srv); }
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(); } } }