Exemplo n.º 1
0
        public SearchContactsDataResponse SearchContacts(SearchContactsDataRequest request)
        {
            var response = new SearchContactsDataResponse();

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

                var searchTotalCount = repo.GetSearchContactsCount(request);
                if (searchTotalCount > 0)
                {
                    response.Contacts = repo.SearchContacts(request) as List <ContactData>;
                }
                else
                {
                    response.Contacts = new List <ContactData>();
                }


                response.Version    = request.Version;
                response.TotalCount = searchTotalCount;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }
Exemplo n.º 2
0
        public SearchContactsDataResponse Post(SearchContactsDataRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }
            var response = new SearchContactsDataResponse();

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

                response         = Manager.SearchContacts(request);
                response.Version = request.Version;
            }
            catch (Exception ex)
            {
                CommonFormatter.FormatExceptionResponse(response, base.Response, ex);

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

            return(response);
        }