Example #1
0
        public EntrevistaDTO AddEntrevista(EntrevistaDTO entrevistaDTO)
        {
            try
            {
                if (entrevistaDTO == null)
                {
                    throw new ArgumentNullException("EntrevistaDTO");
                }
                if (entrevistaDTO.Telefone != null)
                {
                    entrevistaDTO.Telefone.Replace("_", "").Replace("-", "").Trim();
                }

                var Entrevista = EntrevistaFactory.CreateEntrevista(
                    entrevistaDTO.NomeDaEmpresa1,
                    entrevistaDTO.NomeDaEmpresa2,
                    entrevistaDTO.NomeDaEmpresa3,
                    entrevistaDTO.Iptu,
                    entrevistaDTO.NomeFantasia,
                    entrevistaDTO.CapitalSocial,
                    entrevistaDTO.Objetivo,
                    entrevistaDTO.Metragem,
                    entrevistaDTO.PontoDeReferencia,
                    entrevistaDTO.LivroRegistroEmpregados,
                    entrevistaDTO.InspencaoTrabalho,
                    entrevistaDTO.LivroTermoOcorrencia,
                    entrevistaDTO.Telefone,
                    entrevistaDTO.Email,
                    entrevistaDTO.ClienteId,
                    entrevistaDTO.UsuarioId,
                    entrevistaDTO.ResponsalvelId,
                    DateTime.Now,
                    entrevistaDTO.CopiaRg,
                    entrevistaDTO.CopiaCpf,
                    entrevistaDTO.CopiaEndereco,
                    entrevistaDTO.CopiaCnh,
                    entrevistaDTO.CopiaCasamento
                    );

                SalvarEntrevista(Entrevista);

                var adapter = TypeAdapterFactory.CreateAdapter();
                return(adapter.Adapt <Entrevista, EntrevistaDTO>(Entrevista));
            }
            catch (Exception ex)
            {
                throw ManipuladorDeExcecao.TrateExcecao(ex);
            }
        }
        public ActionResult Editar()
        {
            try
            {
                if (Session["ResponsavelId"] == null)
                {
                    throw new Exception("Responsável ID inválido.");
                }

                int?responsavelId = (int)Session["ResponsavelId"];

                if (!responsavelId.HasValue)
                {
                    throw new Exception("Responsável ID inválido.");
                }

                var existeEntrevista = _entrevistaService.FindEntrevistaPorResponsavel(responsavelId.Value).ToList();

                EntrevistaDTO entrevistaDTO;

                if (existeEntrevista.Any())
                {
                    entrevistaDTO = _entrevistaService.FindEntrevista(existeEntrevista.First().Id);
                }
                else
                {
                    entrevistaDTO = new EntrevistaDTO {
                        ResponsalvelId = responsavelId
                    };
                }

                AjusteContextoEditar();

                return(View(entrevistaDTO));
            }
            catch (Exception ex)
            {
                return(View("Error", ex));
            }
        }
Example #3
0
 public EntrevistaDTO UpdatePerfilEntrevista(EntrevistaDTO entrevistaDTO)
 {
     throw new NotImplementedException();
 }