Ejemplo n.º 1
0
 public CustoModel Post([FromBody] CustoModel custo)
 {
     try
     {
         return(CustoService.Post(custo));
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 2
0
 public void Put(int custoId, [FromBody] CustoModel custo)
 {
     try
     {
         CustoService.Put(custoId, custo);
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 3
0
 public CustoModel Post(CustoModel custo)
 {
     try
     {
         return(CustoRepository.Create(custo));
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 4
0
        public CustoModel Create(CustoModel custo)
        {
            try
            {
                using (var cn = Conexao.AbrirConexao())
                {
                    cn.Execute(@"INSERT INTO T_ORCA_CUSTO (NOME_CUSTO, DESCRICAO, TIPO_CUSTO, VALOR_CUSTO) 
                                VALUES(@NOME_CUSTO, @DESCRICAO, @TIPO_CUSTO, @VALOR_CUSTO)", custo);

                    return(Find(cn.Query <int>("SELECT LAST_INSERT_ID()").ToArray()[0]));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 5
0
        public void Put(int custoId, CustoModel custo)
        {
            try
            {
                var where = $"CUSTO_ID = {custoId}";
                if (string.IsNullOrEmpty(MetodosGenericosService.DlookupOrcamentaria("CUSTO_ID", "T_ORCA_CUSTO", where)))
                {
                    throw new Exception();
                }

                CustoRepository.Update(custoId, custo);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 6
0
 public void Update(int custoId, CustoModel custo)
 {
     try
     {
         using (var cn = Conexao.AbrirConexao())
         {
             cn.Execute(@"UPDATE T_ORCA_CUSTO SET NOME_CUSTO = @NOME_CUSTO, DESCRICAO = @DESCRICAO, 
                         TIPO_CUSTO = @TIPO_CUSTO, VALOR_CUSTO = @VALOR_CUSTO WHERE CUSTO_ID = @custoId", new
             {
                 custo.NOME_CUSTO,
                 custo.DESCRICAO,
                 custo.TIPO_CUSTO,
                 custo.VALOR_CUSTO,
                 custoId
             });
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 7
0
        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;
            }
        }
Ejemplo n.º 8
0
 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;
     }
 }
Ejemplo n.º 9
0
 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;
     }
 }