예제 #1
0
        public List <ContactData> GetContactsByContactIds(List <string> contactIds, double version, string contractNumber, string userId)
        {
            List <ContactData> result = null;

            if (contactIds.Count > 0)
            {
                IRestClient client = new JsonServiceClient();
                //[Route("/{Context}/{Version}/{ContractNumber}/Contact", "POST")]
                string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Contact",
                                                                  DDContactServiceUrl,
                                                                  "NG",
                                                                  version,
                                                                  contractNumber), userId);

                //[Route("/{Context}/{Version}/{ContractNumber}/Contact", "POST")]
                GetContactsByContactIdsDataResponse contactDataResponse = client.Post <GetContactsByContactIdsDataResponse>(url, new GetContactsByContactIdsDataRequest()
                {
                    ContactIds     = contactIds,
                    Context        = "NG",
                    ContractNumber = contractNumber,
                    UserId         = userId,
                    Version        = version
                } as object);

                if (contactDataResponse != null && contactDataResponse.Contacts != null)
                {
                    result = contactDataResponse.Contacts;
                }
            }
            return(result);
        }
예제 #2
0
        public GetContactsByContactIdsDataResponse GetContactsByContactId(GetContactsByContactIdsDataRequest request)
        {
            var response = new GetContactsByContactIdsDataResponse();

            try
            {
                IContactRepository repo = Factory.GetRepository(request, RepositoryType.Contact);

                response.Contacts = repo.GetContactsByContactIds(request) as List <ContactData>;
                response.Version  = request.Version;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }
예제 #3
0
        public GetContactsByContactIdsDataResponse Post(GetContactsByContactIdsDataRequest request)
        {
            var response = new GetContactsByContactIdsDataResponse();

            response.Version = request.Version;
            try
            {
                if (string.IsNullOrEmpty(request.UserId))
                {
                    throw new UnauthorizedAccessException("ContactDD:Post()::Unauthorized Access");
                }

                response = Manager.GetContactsByContactId(request);
            }
            catch (Exception ex)
            {
                CommonFormat.FormatExceptionResponse(response, base.Response, ex);

                string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0";
                Helpers.LogException(int.Parse(aseProcessID), ex);
            }
            return(response);
        }