示例#1
0
 /// <summary>
 /// 组织查询fetch
 /// </summary>
 /// <param name="originalclueListRequest"></param>
 /// <returns></returns>
 public async Task <XDocument> GetGetQueryListFetchXml(OriginalclueListRequest originalclueListRequest)
 {
     return(await Task <XDocument> .Run(() =>
     {
         var filterStr = "";
         if (!string.IsNullOrEmpty(originalclueListRequest.Search))
         {
             filterStr = $@"<filter type='or'>
             <condition attribute = 'mobilephone' operator= 'like' value = '%{originalclueListRequest.Search}%' />
             <condition attribute = 'fullname' operator= 'like' value = '%{originalclueListRequest.Search}%' />
             </filter >";
         }
         if (!string.IsNullOrEmpty(originalclueListRequest.DealerId))
         {
             filterStr = $@"<filter type='and'>
             <condition attribute='mcs_dealerid' operator='eq'  value='{originalclueListRequest.DealerId}'/>
             </filter >";
         }
         var fetchXml = $@"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false' count='{originalclueListRequest.PageSize}' page='{originalclueListRequest.PageIndex}'>
           <entity name='lead'>
             <attribute name='fullname' />
             <attribute name='leadid' />
             <attribute name='mcs_leadorigin' />
             <attribute name='mcs_gender' />
             <attribute name='mobilephone' />
             <order attribute='createdon' descending='true' />
             <filter type='and'>
              <condition attribute='statecode' operator='eq' value='0' />
              {filterStr}
             </filter>
             <link-entity name='mcs_terminal' from='mcs_terminalid' to='mcs_terminalid' visible='false' link-type='outer' alias='mcs_terminal'>
               <attribute name='mcs_name' />
             </link-entity>
           </entity>
         </fetch>";
         return XDocument.Parse(fetchXml);
     }));
 }
示例#2
0
        /// <summary>
        /// 获取原始线索列表数据
        /// </summary>
        public async Task <OriginalclueListResponse> GetOriginalclueList(OriginalclueListRequest originalclueListRequest)
        {
            try
            {
                var response = new OriginalclueListResponse()
                {
                };
                var fetchXdoc = await _originalclueRepository.GetGetQueryListFetchXml(originalclueListRequest);

                var crmRequestHelper = new CrmRequestHelper();
                var entities         = await crmRequestHelper.ExecuteAsync(_crmService, entityName, fetchXdoc);

                response.originalclues = entities.Results;
                response.ALLTotalCount = entities.Count;
                response.PageSize      = originalclueListRequest.PageSize;
                response.CurrentPage   = originalclueListRequest.PageIndex;
                return(response);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
 public async Task <NewtonsoftJsonActionResult <OriginalclueListResponse> > getlist(OriginalclueListRequest originalclueListRequest)
 {
     return(await _appOriginalclue.GetOriginalclueList(originalclueListRequest));
 }
示例#4
0
 /// <summary>
 /// 获取原始线索列表数据
 /// </summary>
 public async Task <OriginalclueListResponse> GetOriginalclueList(OriginalclueListRequest originalclueListRequest)
 {
     return(await _service.GetOriginalclueList(originalclueListRequest));
 }