Beispiel #1
0
        public IEnumerable <OrcamentoGeralModel> Get()
        {
            try
            {
                var listOrcamento = OrcamentoRepository.List();

                foreach (OrcamentoGeralModel orcamento in listOrcamento)
                {
                    var pessoaId = MetodosGenericosService.DlookupOrcamentaria("PESSOA_ID", "T_ORCA_ORCAMENTO", $"ORCAMENTO_ID = {orcamento.ORCAMENTO_ID}");
                    orcamento.CLIENTE_ORCAMENTO = PessoaService.GetComParametro(new PessoaQO(int.Parse(pessoaId), "")).ToArray()[0];

                    orcamento.LIST_ITENS_ORCAMENTO_GERAL = ItensOrcamentoGeralService.GetComParametro(new ItensOrcamentoQO(0, orcamento.ORCAMENTO_ID)).ToList();
                    orcamento.LIST_MAO_OBRA_ORCAMENTO    = MaoObraOrcamentoService.Get(orcamento.ORCAMENTO_ID).ToList();
                    orcamento.LIST_CUSTO_ORCAMENTO       = CustoOrcamentoService.GetComParametro(new CustoOrcamentoQO(0, orcamento.ORCAMENTO_ID)).ToList();
                    orcamento.LIST_EQUIPAMENTO_ORCAMENTO = EquipamentoOrcamentoService.GetComParametro(new EquipamentoOrcamentoQO(0, orcamento.ORCAMENTO_ID)).ToList();
                    orcamento.LIST_MATERIAL_ORCAMENTO    = MaterialOrcamentoService.GetComParametro(new MaterialOrcamentoQO(0, orcamento.ORCAMENTO_ID)).ToList();
                    orcamento.TOTAIS_ORCAMENTO           = TotaisOrcamentoRepository.FindPorOrcamentoId(orcamento.ORCAMENTO_ID);
                }

                return(listOrcamento);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #2
0
        public IEnumerable <OrcamentoIntumescenteModel> Get()
        {
            try
            {
                var listOrcamentoIntumescente = OrcamentoIntumescenteRepository.List();

                foreach (OrcamentoIntumescenteModel orcamentoIntumescente in listOrcamentoIntumescente)
                {
                    var pessoaId = MetodosGenericosService.DlookupOrcamentaria("PESSOA_ID", "T_ORCA_ORCAMENTO", $"ORCAMENTO_ID = {orcamentoIntumescente.ORCAMENTO_ID}");
                    orcamentoIntumescente.CLIENTE_ORCAMENTO = PessoaService.GetComParametro(new PessoaQO(int.Parse(pessoaId), "")).FirstOrDefault();

                    var materialId = MetodosGenericosService.DlookupOrcamentaria("MATERIAL_ID", "T_ORCA_ORCAMENTO_INTUMESCENTE", $"ORCAMENTO_ID = {orcamentoIntumescente.ORCAMENTO_ID}");
                    if (materialId != "")
                    {
                        orcamentoIntumescente.PRODUTO = MaterialService.GetComParametro(new MaterialQO(int.Parse(materialId), "", "")).FirstOrDefault();
                    }

                    orcamentoIntumescente.LIST_ITENS_ORCAMENTO_INTUMESCENTE = ItensOrcamentoIntumescenteService.GetComParametro(new ItensOrcamentoQO(0, orcamentoIntumescente.ORCAMENTO_ID)).ToList();
                    orcamentoIntumescente.LIST_MAO_OBRA_ORCAMENTO           = MaoObraOrcamentoService.Get(orcamentoIntumescente.ORCAMENTO_ID).ToList();
                    orcamentoIntumescente.LIST_CUSTO_ORCAMENTO       = CustoOrcamentoService.GetComParametro(new CustoOrcamentoQO(0, orcamentoIntumescente.ORCAMENTO_ID)).ToList();
                    orcamentoIntumescente.LIST_EQUIPAMENTO_ORCAMENTO = EquipamentoOrcamentoService.GetComParametro(new EquipamentoOrcamentoQO(0, orcamentoIntumescente.ORCAMENTO_ID)).ToList();
                    orcamentoIntumescente.LIST_MATERIAL_ORCAMENTO    = MaterialOrcamentoService.GetComParametro(new MaterialOrcamentoQO(0, orcamentoIntumescente.ORCAMENTO_ID)).ToList();
                    orcamentoIntumescente.TOTAIS_ORCAMENTO           = TotaisOrcamentoRepository.FindPorOrcamentoId(orcamentoIntumescente.ORCAMENTO_ID);
                }

                return(listOrcamentoIntumescente);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #3
0
        public void Put(int pessoaId, FuncionarioModel funcionario)
        {
            try
            {
                var where = $"PESSOA_ID = {pessoaId}";
                if (string.IsNullOrEmpty(MetodosGenericosService.DlookupOrcamentaria("PESSOA_ID", "T_ORCA_FUNCIONARIO", where)))
                {
                    throw new Exception();
                }

                if (funcionario.TIPO_CADASTRO != "Funcionario")
                {
                    throw new Exception();
                }
                var pessoa   = MetodosGenericosService.CopiarPropriedadesObj(funcionario, new PessoaModel());
                var pessoaDB = PessoaService.GetComParametro(new PessoaQO(pessoaId, "")).ToArray()[0];

                ComparisonResult resultando = new CompareLogic().Compare(pessoa, pessoaDB);

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

                    PessoaService.Put(pessoaId, pessoa);
                }

                FuncionarioRepository.Update(pessoaId, funcionario);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #4
0
        public IEnumerable <EquipamentoModel> Get()
        {
            try
            {
                var listEquipamento = EquipamentoRepository.List();

                foreach (EquipamentoModel equipamento in listEquipamento)
                {
                    var pessoaId = MetodosGenericosService.DlookupOrcamentaria("PESSOA_ID", "T_ORCA_EQUIPAMENTO", $"EQUIPAMENTO_ID = {equipamento.EQUIPAMENTO_ID}");

                    equipamento.FABRICANTE = PessoaService.GetComParametro(new PessoaQO(int.Parse(pessoaId), "")).ToArray()[0];
                }

                return(listEquipamento);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #5
0
 public IEnumerable <PessoaModel> Get([FromQuery] PessoaQO pessoa)
 {
     try
     {
         return(PessoaService.GetComParametro(pessoa));
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #6
0
        public IEnumerable <MaterialModel> Get()
        {
            try
            {
                var listMaterial = MaterialRepository.List();

                foreach (MaterialModel materialModel in listMaterial)
                {
                    var pessoaId = MetodosGenericosService.DlookupOrcamentaria("PESSOA_ID", "T_ORCA_MATERIAL", $"MATERIAL_ID = {materialModel.MATERIAL_ID}");

                    materialModel.FABRICANTE = PessoaService.GetComParametro(new PessoaQO(int.Parse(pessoaId), "")).ToArray()[0];
                }

                return(listMaterial);
            }
            catch (Exception)
            {
                throw;
            }
        }