예제 #1
0
        public void Delete(int orcamentoId)
        {
            try
            {
                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.START);

                var where = $"ORCAMENTO_ID = {orcamentoId}";
                if (string.IsNullOrEmpty(MetodosGenericosService.DlookupOrcamentaria("ORCAMENTO_ID", "T_ORCA_ORCAMENTO", where)))
                {
                    throw new Exception();
                }

                TotaisOrcamentoRepository.DeletePorOrcamentoId(orcamentoId);

                MaoObraOrcamentoService.Delete(orcamentoId);

                CustoOrcamentoService.DeleteComParametro(new CustoOrcamentoQO(0, orcamentoId));

                EquipamentoOrcamentoService.DeleteComParamenro(new EquipamentoOrcamentoQO(0, orcamentoId));

                MaterialOrcamentoService.DeleteComParamenro(new MaterialOrcamentoQO(0, orcamentoId));

                ItensOrcamentoGeralService.DeleteComParametro(new ItensOrcamentoQO(0, orcamentoId));

                OrcamentoRepository.Delete(orcamentoId);

                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.COMMIT);
            }
            catch (Exception)
            {
                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.ROLLBACK);
                throw;
            }
        }
예제 #2
0
        public void Delete(int orcamentoId)
        {
            try
            {
                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.START);

                var where = $"ORCAMENTO_ID = {orcamentoId}";
                if (string.IsNullOrEmpty(MetodosGenericosService.DlookupOrcamentaria("ORCAMENTO_ID", "T_ORCA_ORCAMENTO", where)))
                {
                    throw new Exception();
                }

                ItensOrcamentoIntumescenteService.DeleteComParametro(new ItensOrcamentoQO(0, orcamentoId));

                OrcamentoIntumescenteRepository.Delete(orcamentoId);

                OrcamentoService.Delete(orcamentoId);

                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.COMMIT);
            }
            catch (Exception)
            {
                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.ROLLBACK);
                throw;
            }
        }
예제 #3
0
        public void Delete(int pessoaId)
        {
            try
            {
                var where = $"PESSOA_ID = {pessoaId}";
                if (string.IsNullOrEmpty(MetodosGenericosService.DlookupOrcamentaria("PESSOA_ID", "T_ORCA_PESSOA", where)))
                {
                    throw new Exception();
                }

                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.START);

                ContatoService.DeleteComParametro(new ContatoQO(0, pessoaId));
                EnderecoService.DeleteComParametro(new EnderecoQO(0, pessoaId));

                PessoaRepository.Delete(pessoaId);

                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.COMMIT);
            }
            catch (Exception)
            {
                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.ROLLBACK);
                throw;
            }
        }
예제 #4
0
        public MaoObraOrcamentoModel Post(MaoObraOrcamentoModel maoObraOrcamento)
        {
            try
            {
                var where = $"ORCAMENTO_ID = {maoObraOrcamento.ORCAMENTO_ID}";
                if (string.IsNullOrEmpty(MetodosGenericosService.DlookupOrcamentaria("ORCAMENTO_ID", "T_ORCA_ORCAMENTO", where)))
                {
                    throw new Exception();
                }

                where = $"PESSOA_ID = {maoObraOrcamento.FUNCIONARIO.PESSOA_ID}";
                if (string.IsNullOrEmpty(MetodosGenericosService.DlookupOrcamentaria("PESSOA_ID", "T_ORCA_PESSOA", where)))
                {
                    throw new Exception();
                }

                maoObraOrcamento.FUNCIONARIO = FuncionarioService.GetComParametro(new FuncionarioQO(maoObraOrcamento.FUNCIONARIO.PESSOA_ID, "")).ToArray()[0];

                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.START);

                var retorno = MaoObraOrcamentoRepository.Create(maoObraOrcamento);

                retorno.FUNCIONARIO = maoObraOrcamento.FUNCIONARIO;

                retorno.LIST_CUSTO = maoObraOrcamento.LIST_CUSTO;

                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.COMMIT);

                return(retorno);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #5
0
        public FuncionarioModel Post(FuncionarioModel funcionario)
        {
            try
            {
                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.START);

                var pessoa = MetodosGenericosService.CopiarPropriedadesObj(funcionario, new PessoaModel());

                pessoa = PessoaService.Post(pessoa);

                funcionario.PESSOA_ID = pessoa.PESSOA_ID;

                funcionario = FuncionarioRepository.Create(funcionario);

                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.COMMIT);

                return(funcionario);
            }
            catch (Exception)
            {
                PessoaService.Delete(funcionario.PESSOA_ID);
                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.ROLLBACK);
                throw;
            }
        }
예제 #6
0
        public void Delete(int cartaCoberturaId)
        {
            try
            {
                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.START);

                var where = $"CARTA_COBERTURA_ID = {cartaCoberturaId}";
                if (string.IsNullOrEmpty(MetodosGenericosService.DlookupOrcamentaria("CARTA_COBERTURA_ID", "T_ORCA_CARTA_COBERTURA", where)))
                {
                    throw new Exception();
                }

                ItensCartaCoberturaService.DeleteComParametro(new ItensCartaCoberturaQO(0, cartaCoberturaId, ""));

                CartaCoberturaRepository.Delete(cartaCoberturaId);

                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.COMMIT);
            }
            catch (Exception)
            {
                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.ROLLBACK);
                throw;
            }
        }
예제 #7
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;
            }
        }
예제 #8
0
        public ItensOrcamentoGeralModel Post(ItensOrcamentoGeralModel itensOrcamentoGeral)
        {
            try
            {
                var where = $"ORCAMENTO_ID = {itensOrcamentoGeral.ORCAMENTO_ID}";
                if (string.IsNullOrEmpty(MetodosGenericosService.DlookupOrcamentaria("ORCAMENTO_ID", "T_ORCA_ORCAMENTO", where)))
                {
                    throw new Exception();
                }

                where = $"MATERIAL_ID = {itensOrcamentoGeral.PRODUTO.MATERIAL_ID}";
                if (string.IsNullOrEmpty(MetodosGenericosService.DlookupOrcamentaria("MATERIAL_ID", "T_ORCA_MATERIAL", where)))
                {
                    throw new Exception();
                }

                if (itensOrcamentoGeral.VALOR_LARGURA < 0 || itensOrcamentoGeral.VALOR_M_2 < 0)
                {
                    throw new Exception();
                }

                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.START);

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

                itensOrcamento = ItensOrcamentoService.Post(itensOrcamento);

                itensOrcamentoGeral.ITENS_ORCAMENTO_ID = itensOrcamento.ITENS_ORCAMENTO_ID;

                itensOrcamentoGeral.NUMERO_LINHA = itensOrcamento.NUMERO_LINHA;

                var produto = MaterialService.GetComParametro(new MaterialQO(itensOrcamentoGeral.PRODUTO.MATERIAL_ID, "", "")).FirstOrDefault();

                itensOrcamentoGeral.PRODUTO = produto;

                ItensOrcamentoGeralRepository.Create(itensOrcamentoGeral);

                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.COMMIT);

                return(itensOrcamentoGeral);
            }
            catch (Exception)
            {
                MetodosGenericosService.StartTransactionCommitRollbackOrcamentaria(MetodosGenericosEnum.ROLLBACK);
                throw;
            }
        }