コード例 #1
0
        public dynamic CalcularValoresIntumescente(ItensOrcamentoIntumescenteModel itemItumescente, PerfilModel perfil, double valorEspessura)
        {
            try
            {
                double HpAux   = ((2 * perfil.VALOR_D) + (itemItumescente.NUMERO_FACES * perfil.VALOR_BF)) / 1000;
                double WDAux   = 39.70008 / (perfil.VALOR_KG_M * 2.2);
                double HpAAux  = HpAux / (perfil.VALOR_KG_M / 7850);
                double AreaAux = itemItumescente.VALOR_COMPRIMENTO * itemItumescente.QTDE * HpAux;

                double TotalLitrosAux = 0;
                if (valorEspessura > 0)
                {
                    TotalLitrosAux = 1.4 * valorEspessura * AreaAux;
                }

                return(new
                {
                    Hp = float.Parse(HpAux.ToString("N2")),
                    WD = float.Parse(WDAux.ToString("N2")),
                    HpA = float.Parse(HpAAux.ToString("N2")),
                    Area = float.Parse(AreaAux.ToString("N2")),
                    TotalLitros = float.Parse(TotalLitrosAux.ToString("N2"))
                });
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        public void Put(int itensOrcamentoId, ItensOrcamentoIntumescenteModel itensOrcamentoIntumescente)
        {
            try
            {
                var where = $"ITENS_ORCAMENTO_ID = {itensOrcamentoId}";
                if (string.IsNullOrEmpty(MetodosGenericosService.DlookupOrcamentaria("ITENS_ORCAMENTO_ID", "T_ORCA_ITENS_ORCAMENTO_INTUMESCENTE", where)))
                {
                    throw new Exception();
                }

                var itensOrcamento = MetodosGenericosService.CopiarPropriedadesObj(itensOrcamentoIntumescente, new ItensOrcamentoModel());

                var itensOrcamentoDB = ItensOrcamentoService.GetComParametro(new ItensOrcamentoQO(itensOrcamentoId, 0)).FirstOrDefault();

                ComparisonResult resultando = new CompareLogic().Compare(itensOrcamento, itensOrcamentoDB);

                if (!resultando.AreEqual)
                {
                    var res = resultando.Differences;

                    ItensOrcamentoService.Put(itensOrcamentoId, itensOrcamento);
                }

                if (itensOrcamentoIntumescente.VALOR_COMPRIMENTO < 0 || itensOrcamentoIntumescente.AREA < 0)
                {
                    throw new Exception();
                }

                ItensOrcamentoIntumescenteRepository.Update(itensOrcamentoId, itensOrcamentoIntumescente);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #3
0
 public void Put(int itensOrcamentoId, [FromBody] ItensOrcamentoIntumescenteModel itensOrcamentoIntumescente)
 {
     try
     {
         ItensOrcamentoIntumescenteService.Put(itensOrcamentoId, itensOrcamentoIntumescente);
         TotaisOrcamentoService.CalcularTotaisOrcamento(itensOrcamentoIntumescente.ORCAMENTO_ID);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #4
0
 public ItensOrcamentoIntumescenteModel Post([FromBody] ItensOrcamentoIntumescenteModel itensOrcamentoIntumescente)
 {
     try
     {
         var itens = ItensOrcamentoIntumescenteService.Post(itensOrcamentoIntumescente);
         TotaisOrcamentoService.CalcularTotaisOrcamento(itensOrcamentoIntumescente.ORCAMENTO_ID);
         return(itens);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #5
0
        public ItensOrcamentoIntumescenteModel Post(ItensOrcamentoIntumescenteModel itensOrcamentoIntumescente)
        {
            try
            {
                var where = $"ORCAMENTO_ID = {itensOrcamentoIntumescente.ORCAMENTO_ID}";
                if (string.IsNullOrEmpty(MetodosGenericosService.DlookupOrcamentaria("ORCAMENTO_ID", "T_ORCA_ORCAMENTO", where)))
                {
                    throw new Exception();
                }

                if (itensOrcamentoIntumescente.NUMERO_FACES < 0 || itensOrcamentoIntumescente.QTDE < 0)
                {
                    throw new Exception();
                }

                if (itensOrcamentoIntumescente.PERFIL.PERFIL_ID != 0)
                {
                    itensOrcamentoIntumescente.PERFIL = PerfilService.GetComParametro(new PerfilQO(itensOrcamentoIntumescente.PERFIL.PERFIL_ID, "")).ToArray()[0];
                }

                if (itensOrcamentoIntumescente.CARTA_COBERTURA.CARTA_COBERTURA_ID != 0)
                {
                    itensOrcamentoIntumescente.CARTA_COBERTURA = CartaCoberturaService.GetComParametro(new CartaCoberturaQO(itensOrcamentoIntumescente.CARTA_COBERTURA.CARTA_COBERTURA_ID, 0, 0, "")).ToArray()[0];
                }

                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.START);

                var itensOrcamento = MetodosGenericosService.CopiarPropriedadesObj(itensOrcamentoIntumescente, new ItensOrcamentoModel());

                itensOrcamento = ItensOrcamentoService.Post(itensOrcamento);

                itensOrcamentoIntumescente.ITENS_ORCAMENTO_ID = itensOrcamento.ITENS_ORCAMENTO_ID;

                var itensOrcamentoIntumescenteCadastrado = ItensOrcamentoIntumescenteRepository.Create(itensOrcamentoIntumescente);

                itensOrcamentoIntumescenteCadastrado.PERFIL          = itensOrcamentoIntumescente.PERFIL;
                itensOrcamentoIntumescenteCadastrado.CARTA_COBERTURA = itensOrcamentoIntumescente.CARTA_COBERTURA;

                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.COMMIT);

                return(itensOrcamentoIntumescenteCadastrado);
            }
            catch (Exception)
            {
                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.ROLLBACK);
                throw;
            }
        }
コード例 #6
0
        public ItensOrcamentoIntumescenteModel Create(ItensOrcamentoIntumescenteModel itensOrcamentoIntumescente)
        {
            try
            {
                using (var cn = Conexao.AbrirConexao())
                {
                    cn.Execute(@"INSERT INTO T_ORCA_ITENS_ORCAMENTO_INTUMESCENTE (ITENS_ORCAMENTO_ID, ORCAMENTO_ID, REFERENCIA, NUMERO_FACES,
                                VALOR_HP, VALOR_HP_A, VALOR_WD, QTDE, VALOR_ESPESSURA, QTDE_LITROS, PERFIL_ID, VALOR_D, VALOR_BF, 
                                VALOR_TW, VALOR_TF, VALOR_KG_M, CARTA_COBERTURA_ID) VALUES(@ITENS_ORCAMENTO_ID, @ORCAMENTO_ID, @REFERENCIA, @NUMERO_FACES,
                                @VALOR_HP, @VALOR_HP_A, @VALOR_WD, @QTDE, @VALOR_ESPESSURA, @QTDE_LITROS, @PERFIL_ID, @VALOR_D, @VALOR_BF, 
                                @VALOR_TW, @VALOR_TF, @VALOR_KG_M, @CARTA_COBERTURA_ID)", new
                    {
                        itensOrcamentoIntumescente.ITENS_ORCAMENTO_ID,
                        itensOrcamentoIntumescente.ORCAMENTO_ID,
                        itensOrcamentoIntumescente.REFERENCIA,
                        itensOrcamentoIntumescente.NUMERO_FACES,
                        itensOrcamentoIntumescente.VALOR_HP,
                        itensOrcamentoIntumescente.VALOR_HP_A,
                        itensOrcamentoIntumescente.VALOR_WD,
                        itensOrcamentoIntumescente.QTDE,
                        itensOrcamentoIntumescente.VALOR_ESPESSURA,
                        itensOrcamentoIntumescente.QTDE_LITROS,
                        itensOrcamentoIntumescente.PERFIL.PERFIL_ID,
                        itensOrcamentoIntumescente.PERFIL.VALOR_D,
                        itensOrcamentoIntumescente.PERFIL.VALOR_BF,
                        itensOrcamentoIntumescente.PERFIL.VALOR_TW,
                        itensOrcamentoIntumescente.PERFIL.VALOR_TF,
                        itensOrcamentoIntumescente.PERFIL.VALOR_KG_M,
                        itensOrcamentoIntumescente.CARTA_COBERTURA.CARTA_COBERTURA_ID
                    });

                    return(Find(cn.Query <int>("SELECT MAX(ITENS_ORCAMENTO_ID) FROM T_ORCA_ITENS_ORCAMENTO_INTUMESCENTE").FirstOrDefault()));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #7
0
 public void Update(int itensOrcamentoId, ItensOrcamentoIntumescenteModel itensOrcamentoIntumescente)
 {
     try
     {
         using (var cn = Conexao.AbrirConexao())
         {
             cn.Execute(@"UPDATE T_ORCA_ITENS_ORCAMENTO_INTUMESCENTE SET REFERENCIA = @REFERENCIA, NUMERO_FACES = @NUMERO_FACES,
                         VALOR_HP = @VALOR_HP, VALOR_HP_A = @VALOR_HP_A, VALOR_WD = @VALOR_WD, QTDE = @QTDE, 
                         VALOR_ESPESSURA = @VALOR_ESPESSURA, QTDE_LITROS = @QTDE_LITROS, PERFIL_ID = @PERFIL_ID, VALOR_D = @VALOR_D, 
                         VALOR_BF = @VALOR_BF, VALOR_TW = @VALOR_TW, VALOR_TF = @VALOR_TF, VALOR_KG_M = @VALOR_KG_M, 
                         CARTA_COBERTURA_ID = @CARTA_COBERTURA_ID WHERE ITENS_ORCAMENTO_ID = @itensOrcamentoId", new
             {
                 itensOrcamentoIntumescente.REFERENCIA,
                 itensOrcamentoIntumescente.NUMERO_FACES,
                 itensOrcamentoIntumescente.VALOR_HP,
                 itensOrcamentoIntumescente.VALOR_HP_A,
                 itensOrcamentoIntumescente.VALOR_WD,
                 itensOrcamentoIntumescente.QTDE,
                 itensOrcamentoIntumescente.VALOR_ESPESSURA,
                 itensOrcamentoIntumescente.QTDE_LITROS,
                 itensOrcamentoIntumescente.PERFIL.PERFIL_ID,
                 itensOrcamentoIntumescente.PERFIL.VALOR_D,
                 itensOrcamentoIntumescente.PERFIL.VALOR_BF,
                 itensOrcamentoIntumescente.PERFIL.VALOR_TW,
                 itensOrcamentoIntumescente.PERFIL.VALOR_TF,
                 itensOrcamentoIntumescente.PERFIL.VALOR_KG_M,
                 itensOrcamentoIntumescente.CARTA_COBERTURA.CARTA_COBERTURA_ID,
                 itensOrcamentoId
             });
         }
     }
     catch (Exception)
     {
         throw;
     }
 }