コード例 #1
0
        /// <summary>
        /// 预约列表xml
        /// </summary>
        /// <param name="filterstr"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageNum"></param>
        /// <returns></returns>
        public string QueryListByPage(AppointmentInfoRequest filterstr)
        {
            var filter = string.Empty;

            if (filterstr.status != 0)
            {
                filter += $"<condition attribute='mcs_status' operator='eq' value='{filterstr.status}' />";
            }
            if (filterstr.DealerId != null)
            {
                filter += $"<condition attribute='mcs_dealerid' operator='eq' value='{filterstr.DealerId}' />";
            }
            if (filterstr.AppointmentAt != null)
            {
                filter += $"<condition attribute='mcs_appointmentat' operator='on' value='{filterstr.AppointmentAt}' />";
            }
            if (!string.IsNullOrWhiteSpace(filterstr.mcs_customerphone))
            {
                filter += $"<condition attribute='mcs_customerphone' operator='eq' value='{filterstr.mcs_customerphone}' />";
            }
            if (!string.IsNullOrWhiteSpace(filterstr.seachkey))
            {
                filter += $"<filter type='or'>";
                filter += $"<condition attribute='mcs_carplate' operator='like' value='%{filterstr.seachkey}%' />";
                filter += $"<condition attribute='mcs_customerphone' operator='like' value='%{filterstr.seachkey}%' />";
                filter += $"<condition attribute='mcs_customername' operator='like' value='%{filterstr.seachkey}%' />";
                filter += $"</filter>";
            }


            var fetchString = $@"<fetch version='1.0' count='{filterstr.pageSize}' page='{filterstr.page}' output-format='xml-platform' mapping='logical' distinct='false'>
                  <entity name='mcs_appointmentinfo'>
                    <all-attributes />
                    <order attribute='mcs_appointmentat' descending='true' />
                    <filter type='and'>
                      <condition attribute='statecode' operator='eq' value='0' />
                      {filter}
                    </filter>
                    <link-entity name='mcs_appointmentconfig' from='mcs_appointmentconfigid' to='mcs_appointmentconfigid' visible='false' link-type='outer' alias='appointmentconfig'>
                      <attribute name='mcs_name' />
                    </link-entity>
                  </entity>
                </fetch>";

            return(fetchString);
        }
コード例 #2
0
        /// <summary>
        /// 预约列表查询
        /// </summary>
        /// <param name="filterstr"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageNum"></param>
        /// <returns></returns>
        public async Task <AppointmentInfoListResponse <CrmEntity> > QueryListByPage(AppointmentInfoRequest filterstr)
        {
            try
            {
                var userInfo = ContextContainer.GetValue <UserInfo>(ContextExtensionTypes.CurrentUserInfo);
                #region 查询结果集
                var fetchString = _appointmentInfoRepository.QueryListByPage(filterstr);

                var fetchXdoc    = XDocument.Parse(fetchString);
                var fetchRequest = new CrmRetrieveMultipleFetchRequestMessage()
                {
                    EntityName  = "mcs_appointmentinfo",
                    FetchXml    = fetchXdoc,
                    ProxyUserId = userInfo?.systemuserid
                };
                fetchRequest.Headers.Add(dicHeadKey, dicHead[dicHeadKey]);
                var fetchResponse = await _crmService.Execute(fetchRequest);

                var fetchResponseResult = fetchResponse as CrmRetrieveMultipleFetchResponseMessage;
                #endregion

                #region 查询总条数
                var status = 0;
                var fetchAllTotalCountString = _appointmentInfoRepository.QueryListByCount(filterstr, status);
                var fetchAllTotalXdoc        = XDocument.Parse(fetchAllTotalCountString);
                fetchRequest = new CrmRetrieveMultipleFetchRequestMessage()
                {
                    EntityName  = "mcs_appointmentinfo",
                    FetchXml    = fetchAllTotalXdoc,
                    ProxyUserId = userInfo?.systemuserid
                };
                fetchRequest.Headers.Add(dicHeadKey, dicHead[dicHeadKey]);
                fetchResponse = await _crmService.Execute(fetchRequest);

                var allTotalCountResults = fetchResponse as CrmRetrieveMultipleFetchResponseMessage;
                #endregion

                #region 查询待跟进总条数
                status = 10;
                var fetchFollowingCountString = _appointmentInfoRepository.QueryListByCount(filterstr, status);
                var fetchFollowingXdoc        = XDocument.Parse(fetchFollowingCountString);
                fetchRequest = new CrmRetrieveMultipleFetchRequestMessage()
                {
                    EntityName  = "mcs_appointmentinfo",
                    FetchXml    = fetchFollowingXdoc,
                    ProxyUserId = userInfo?.systemuserid
                };
                fetchRequest.Headers.Add(dicHeadKey, dicHead[dicHeadKey]);
                fetchResponse = await _crmService.Execute(fetchRequest);

                var FollowingCountResults = fetchResponse as CrmRetrieveMultipleFetchResponseMessage;
                #endregion

                #region 查询已跟进总条数
                status = 20;
                var fetchFollowedCountString = _appointmentInfoRepository.QueryListByCount(filterstr, status);
                var fetchFollowedXdoc        = XDocument.Parse(fetchFollowedCountString);
                fetchRequest = new CrmRetrieveMultipleFetchRequestMessage()
                {
                    EntityName  = "mcs_appointmentinfo",
                    FetchXml    = fetchFollowedXdoc,
                    ProxyUserId = userInfo?.systemuserid
                };
                fetchRequest.Headers.Add(dicHeadKey, dicHead[dicHeadKey]);
                fetchResponse = await _crmService.Execute(fetchRequest);

                var FollowedCountResults = fetchResponse as CrmRetrieveMultipleFetchResponseMessage;
                #endregion

                var queryResult = new AppointmentInfoListResponse <CrmEntity>();
                queryResult.Results        = fetchResponseResult.Value.Results;
                queryResult.CurrentPage    = filterstr.page;
                queryResult.ALLTotalCount  = (int)allTotalCountResults.Value.Results[0].Attributes["count"];
                queryResult.FollowingCount = (int)FollowingCountResults.Value.Results[0].Attributes["count"];
                queryResult.FollowedCount  = (int)FollowedCountResults.Value.Results[0].Attributes["count"];
                return(queryResult);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
ファイル: AppAppointmentInfo.cs プロジェクト: rhw1111/DCEM
 /// <summary>
 /// 预约记录列表查询
 /// </summary>
 /// <param name="filterstr"></param>
 /// <param name="pageSize"></param>
 /// <param name="pageNum"></param>
 /// <returns></returns>
 public async Task<AppointmentInfoListResponse<CrmEntity>> QueryListByPage(AppointmentInfoRequest filterstr)
 {
     return await _appointmentInfoService.QueryListByPage(filterstr);
 }
コード例 #4
0
        public async Task <NewtonsoftJsonActionResult <AppointmentInfoListResponse <CrmEntity> > > GetList([FromQuery] AppointmentInfoRequest appointmentInfoRequest)
        {
            var list = await app.QueryListByPage(appointmentInfoRequest);

            return(list);
        }