public void Put(int maoObraOrcamentoId, MaoObraOrcamentoModel maoObraOrcamento) { try { var where = $"MAO_OBRA_ORCAMENTO_ID = {maoObraOrcamento.MAO_OBRA_ORCAMENTO_ID}"; if (string.IsNullOrEmpty(MetodosGenericosService.DlookupOrcamentaria("MAO_OBRA_ORCAMENTO_ID", "T_ORCA_MAO_OBRA_ORCAMENTO", where))) { throw new Exception(); } maoObraOrcamento.FUNCIONARIO = FuncionarioService.GetComParametro(new FuncionarioQO(maoObraOrcamento.FUNCIONARIO.PESSOA_ID, "")).FirstOrDefault(); MaoObraOrcamentoRepository.Update(maoObraOrcamentoId, maoObraOrcamento); } catch (Exception) { throw; } }
public void Update(int maoObraOrcamentoId, MaoObraOrcamentoModel maoObraOrcamento) { try { using (var cn = Conexao.AbrirConexao()) { cn.Execute(@"UPDATE T_ORCA_MAO_OBRA_ORCAMENTO SET PESSOA_ID = @PESSOA_ID, NOME_PESSOA = @NOME_PESSOA, VALOR_DIA_TRABALHADO = @VALOR_DIA_TRABALHADO WHERE MAO_OBRA_ORCAMENTO_ID = @maoObraOrcamentoId", new { maoObraOrcamento.FUNCIONARIO.PESSOA_ID, maoObraOrcamento.FUNCIONARIO.NOME_PESSOA, maoObraOrcamento.FUNCIONARIO.VALOR_DIA_TRABALHADO, maoObraOrcamentoId }); } } catch (Exception) { throw; } }
public void Create(MaoObraOrcamentoModel maoObraOrcamento, CustoModel custo) { try { using (var cn = Conexao.AbrirConexao()) { cn.Execute(@"INSERT INTO T_ORCA_CUSTOS_MAO_OBRA (MAO_OBRA_ORCAMENTO_ID, CUSTO_ID, NOME_CUSTO, TIPO_CUSTO, VALOR_CUSTO) VALUES(@MAO_OBRA_ORCAMENTO_ID, @CUSTO_ID, @NOME_CUSTO, @TIPO_CUSTO, @VALOR_CUSTO)", new { maoObraOrcamento.MAO_OBRA_ORCAMENTO_ID, custo.CUSTO_ID, custo.NOME_CUSTO, custo.TIPO_CUSTO, custo.VALOR_CUSTO }); } } catch (Exception) { throw; } }
public void Post(MaoObraOrcamentoModel maoObraOrcamento, CustoModel custo) { try { var where = $"MAO_OBRA_ORCAMENTO_ID = {maoObraOrcamento.MAO_OBRA_ORCAMENTO_ID}"; if (string.IsNullOrEmpty(MetodosGenericosService.DlookupOrcamentaria("MAO_OBRA_ORCAMENTO_ID", "T_ORCA_MAO_OBRA_ORCAMENTO", where))) { throw new Exception(); } where = $"CUSTO_ID = {custo.CUSTO_ID}"; if (string.IsNullOrEmpty(MetodosGenericosService.DlookupOrcamentaria("CUSTO_ID", "T_ORCA_CUSTO", where))) { throw new Exception(); } CustosMaoObraRepository.Create(maoObraOrcamento, custo); } catch (Exception) { throw; } }
public void Update(int maoObraOrcamentoId, int custoId, MaoObraOrcamentoModel maoObraOrcamento, CustoModel custo) { try { using (var cn = Conexao.AbrirConexao()) { cn.Execute(@"UPDATE T_ORCA_CUSTOS_MAO_OBRA SET CUSTO_ID = @CUSTO_ID, NOME_CUSTO = @NOME_CUSTO, TIPO_CUSTO = @TIPO_CUSTO, VALOR_CUSTO = @VALOR_CUSTO WHERE MAO_OBRA_ORCAMENTO_ID = @maoObraOrcamentoId AND CUSTO_ID = @custoId", new { custo.CUSTO_ID, custo.NOME_CUSTO, custo.TIPO_CUSTO, custo.VALOR_CUSTO, maoObraOrcamentoId, custoId }); } } catch (Exception) { throw; } }