Example #1
0
        // TODO
        public ResponseDTO CreateMember(RequestDTO<McMember> request)
        {
            ResponseDTO response = new ResponseDTO();
            McMember newMember = request.Inputs.First();

            if (newMember != null)
            {
                // New Member Validation
                if (!string.IsNullOrWhiteSpace(newMember.MemId)
                   && !string.IsNullOrWhiteSpace(newMember.FirstName)
                   && !string.IsNullOrWhiteSpace(newMember.LastName)
                   && newMember.DOB.HasValue)
                {
                    UnitOfWork.MemberRepo.Add(newMember);
                    UnitOfWork.Commit();

                    response.Results = ResponseResults.Success;
                }
                else
                {
                    response = ResponseUtility.CreateErrorResponse(ResponseResults.FailAndNoRetry, MemberExceptions.AddValidationFail);
                }
            }
            else
            {
                response = ResponseUtility.CreateErrorResponse(ResponseResults.FailAndNoRetry, MemberExceptions.InvalidMember);
            }

            return response;
        }
		private static RequestDTO GetRequestDTO(int index)
		{
			var requestDto = new RequestDTO
			                 	{
			                 		ID = index,
			                 		Name = "Request " + index,
			                 		Description = "Hello, world",
			                 		EntityStateID = 1,
			                 		SourceType = RequestSourceEnum.Email,
			                 		RequestTypeID = 2
			                 	};
			return requestDto;
		}
        public ResponseDTO<ClienteModel> Listar(RequestDTO<ClienteModel> pedido_)
        {
            // Simulamos uma lista de registros
            _resposta.DataExecucao = DateTime.Now;
            _cronometro.Start();

            _resposta.ListModel = new List<ClienteModel>
            {
                new ClienteModel { Codigo = 1, Nome = "Zina", Email = "Zinamen" },
                new ClienteModel { Codigo = 2, Nome = "RachaCuca", Email = "RachaCucamen" }
            };

            _cronometro.Stop();
            _resposta.TempoExecucao = _cronometro.Elapsed;
            _resposta.MensagemProcessamento = "Clientes Recuperados com sucesso";
            _resposta.TipoMensagem = TipoMensagem.Sucesso;

            return _resposta;
        }
        public ResponseDTO<ClienteModel> Cadastrar(RequestDTO<ClienteModel> pedido_)
        {
            // Assim que entrou no serviço já setamos os campos administrativos (rastreamento)
            _resposta.DataExecucao = DateTime.Now;

            // Começou a monitorar, contrar o tempo
            _cronometro.Start();

            if (pedido_.NovoCliente == null)
            {
                _resposta.MensagemProcessamento = "Cliente Vazio";
                _resposta.TipoMensagem = TipoMensagem.Aviso;

                _cronometro.Stop();
                _resposta.TempoExecucao = _cronometro.Elapsed;

                return _resposta;
            }

            if (String.IsNullOrEmpty(pedido_.NovoCliente.Nome))
            {
                _resposta.MensagemProcessamento = "Informe o Nome";
                _resposta.TipoMensagem = TipoMensagem.Aviso;

                _cronometro.Stop();
                _resposta.TempoExecucao = _cronometro.Elapsed;

                return _resposta;
            }

            // Desligou o cronometro (parou de contar)
            _cronometro.Stop();
            // Pegando o tempo de monitoramento, pelo atributo Elapsed;
            _resposta.TempoExecucao = _cronometro.Elapsed;

            _resposta.MensagemProcessamento = "Cadastro com Sucesso";
            _resposta.TipoMensagem = TipoMensagem.Sucesso;

            return _resposta;
        }
Example #5
0
        // TODO
        public ResponseDTO UpdateMember(RequestDTO<McMember> request)
        {
            ResponseDTO response = new ResponseDTO();

            return response;
        }
Example #6
0
        public ResponseDTO UpdateCaseDocumentStatus(RequestDTO<CaseDocument> request)
        {
            ResponseDTO response = new ResponseDTO();

            CaseDocument caseDocumentCriteria = request.Inputs.First();

            if (caseDocumentCriteria != null)
            {
                var modifiedCaseDoc = UnitOfWork.CaseDocumentRepo.GetFirst(x => x.CaseDocumentId == caseDocumentCriteria.CaseDocumentId);

                modifiedCaseDoc.CaseDocumentStatusId = caseDocumentCriteria.CaseDocumentStatusId;
                UnitOfWork.CaseDocumentRepo.Update(modifiedCaseDoc);
                UnitOfWork.Commit();
                response.Results = ResponseResults.Success;

            }
            else
            {
                response = ResponseUtility.CreateErrorResponse(
                                ResponseResults.FailAndNoRetry,
                                new string[] { CaseDocumentExceptions.InvalidCaseDocument }
                                );
            }

            return response;
        }
Example #7
0
        public ResponseDTO GetProcessById(RequestDTO<Process> request)
        {
            Process criteria = request.Inputs.First();

            return ProcessSearchEngine.Search(x => x == criteria);
        }
Example #8
0
        public ResponseDTO GetMemberTypeById(RequestDTO<McMemberType> request)
        {
            McMemberType criteria = request.Inputs.First();

            return MemberTypeSearchEngine.Search(x => x == criteria);
        }
Example #9
0
        public ResponseDTO GetMemberBySSN(RequestDTO<McMember> request)
        {
            McMember criteria = request.Inputs.First();

            if (criteria == null)
                throw new ArgumentNullException(MemberExceptions.InvalidMember);

            return MemberSearchEngine.Search(x => x.SSN == criteria.SSN);
        }
Example #10
0
 public void AddToRequests(RequestDTO requestDTO)
 {
     base.AddObject("Requests", requestDTO);
 }
Example #11
0
        public ResponseDTO GetAllProcessesByMember(RequestDTO<McMember> request)
        {
            McMember criteria = request.Inputs.First();

            if (criteria == null)
                throw new ArgumentNullException(MemberExceptions.InvalidMember);

            return ProcessSearchEngine.Search(x => x.McMemberId == criteria.McMemberId);
        }
Example #12
0
        public ResponseDTO GetAllMembersByName(RequestDTO<McMember> request)
        {
            McMember criteria = request.Inputs.First();

            if (criteria == null)
                throw new ArgumentNullException(MemberExceptions.InvalidMember);

            // Last Name Only
            if (!string.IsNullOrWhiteSpace(criteria.LastName) && string.IsNullOrWhiteSpace(criteria.FirstName))
            {
                return MemberSearchEngine.SearchAll(x => x.LastName.ToLower() == criteria.LastName.Trim().ToLower());
            }
            // First Name Only
            if (string.IsNullOrWhiteSpace(criteria.LastName.ToLower()) && !string.IsNullOrWhiteSpace(criteria.FirstName))
            {
                return MemberSearchEngine.SearchAll(x => x.FirstName.ToLower() == criteria.FirstName.Trim().ToLower());
            }
            // Both
            return MemberSearchEngine.SearchAll(x => x.FirstName.ToLower() == criteria.FirstName.Trim().ToLower()
                                                && x.LastName.ToLower() == criteria.LastName.Trim().ToLower()
                                                );
        }
Example #13
0
        public ResponseDTO GetAllCaseDocumentsBySyncDate(RequestDTO<CaseDocument> request)
        {
            CaseDocument criteria = request.Inputs.First();

            if (criteria == null)
                throw new ArgumentNullException(CaseDocumentExceptions.InvalidCaseDocument);

            return CaseDocSearchEngine.SearchAll(x => x.SyncDate == criteria.SyncDate);
        }
Example #14
0
        public ResponseDTO GetAllCaseDocumentsByProcess(RequestDTO<Process> request)
        {
            Process criteria = request.Inputs.First();

            if (criteria == null)
                throw new ArgumentNullException(CaseDocumentExceptions.InvalidCaseDocument);

            return CaseDocSearchEngine.SearchAll(x => x.ProcessId == criteria.ProcessId);
        }
Example #15
0
        public ResponseDTO GetAllCaseDocumentsByMember(RequestDTO<McMember> request)
        {
            McMember criteria = request.Inputs.First();

            if (criteria == null)
                throw new ArgumentNullException(CaseDocumentExceptions.InvalidCaseDocument);

            return CaseDocSearchEngine.SearchAll(x => x.McMemberId == criteria.McMemberId);
        }
Example #16
0
        // TODO
        public ResponseDTO CreateMemberAttribute(RequestDTO<McMemberAttribute> request)
        {
            ResponseDTO response = new ResponseDTO();

            return response;
        }
Example #17
0
        public ResponseDTO GetCaseDocumentByGuid(RequestDTO<CaseDocument> request)
        {
            CaseDocument criteria = request.Inputs.First();

            if (criteria == null)
                throw new ArgumentNullException(CaseDocumentExceptions.InvalidCaseDocument);

            return CaseDocSearchEngine.Search(x => x.CaseDocumentUid == criteria.CaseDocumentUid);
        }
Example #18
0
        public ResponseDTO GetCaseDocumentById(RequestDTO<CaseDocument> request)
        {
            CaseDocument criteria = request.Inputs.First();

            return CaseDocSearchEngine.Search(x => x == criteria);
        }
Example #19
0
 public static RequestDTO CreateRequestDTO(global::System.Guid ID, bool isFinished, global::System.DateTime createDate, int status, global::System.Guid caacDocumentId, global::System.Guid airlinesId, global::System.Collections.ObjectModel.ObservableCollection<ApprovalHistoryDTO> approvalHistories)
 {
     RequestDTO requestDTO = new RequestDTO();
     requestDTO.Id = ID;
     requestDTO.IsFinished = isFinished;
     requestDTO.CreateDate = createDate;
     requestDTO.Status = status;
     requestDTO.CaacDocumentId = caacDocumentId;
     requestDTO.AirlinesId = airlinesId;
     if ((approvalHistories == null))
     {
         throw new global::System.ArgumentNullException("approvalHistories");
     }
     requestDTO.ApprovalHistories = approvalHistories;
     return requestDTO;
 }