Exemplo n.º 1
0
        /// <summary>
        /// 维修类别基础数据
        /// </summary>
        /// <param name="repairItemTypeRequest"></param>
        /// <returns></returns>
        public async Task <QueryResult <CrmEntity> > QueryRepairItemType(RepairItemTypeRequest repairItemTypeRequest)
        {
            try
            {
                var fetchString = _baseDataRepository.QueryRepairItemType(repairItemTypeRequest);

                var fetchXdoc    = XDocument.Parse(fetchString);
                var fetchRequest = new CrmRetrieveMultipleFetchRequestMessage()
                {
                    EntityName = "mcs_repairitemtype",
                    FetchXml   = fetchXdoc
                };
                var fetchResponse = await _crmService.Execute(fetchRequest);

                var fetchResponseResult = fetchResponse as CrmRetrieveMultipleFetchResponseMessage;

                var queryResult = new QueryResult <CrmEntity>();
                queryResult.Results     = fetchResponseResult.Value.Results;
                queryResult.CurrentPage = repairItemTypeRequest.page;
                queryResult.TotalCount  = 0;
                return(queryResult);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 维修类别基础数据
        /// </summary>
        /// <param name="repairItemTypeRequest"></param>
        /// <returns></returns>
        public string QueryRepairItemType(RepairItemTypeRequest repairItemTypeRequest)
        {
            var filter = string.Empty;

            if (!string.IsNullOrWhiteSpace(repairItemTypeRequest.search))
            {
                filter += $"<filter type='or'>";
                filter += $"<condition attribute='mcs_name' operator='like' value='%{repairItemTypeRequest.search}%' />";
                filter += $"</filter>";
            }
            var fetchString = $@"<fetch version='1.0' count='{repairItemTypeRequest.pageSize}' page='{repairItemTypeRequest.page}' output-format='xml-platform' mapping='logical' distinct='false'>
                   <entity name='mcs_repairitemtype'> 
                <attribute name='mcs_name' /> 
                <attribute name='createdon' /> 
                <attribute name='mcs_remark' /> 
                <attribute name='mcs_type' /> 
                <attribute name='mcs_repairitemtypeid' /> 
                <order attribute='createdon' descending='true' /> 
                <filter type='and'> 
                  <condition attribute='statecode' operator='eq' value='0' /> 
                  {filter}
                </filter> 
              </entity> 
            </fetch>";

            return(fetchString);
        }
Exemplo n.º 3
0
        public async Task <NewtonsoftJsonActionResult <QueryResult <CrmEntity> > > QueryRepairItemType(string seachkey = "", string sort = "", int pageSize = 10, int page = 1)
        {
            var repairItemTypeRequest = new RepairItemTypeRequest()
            {
                search   = seachkey,
                page     = page,
                pageSize = pageSize,
                sort     = sort
            };
            var list = await app.QueryRepairItemType(repairItemTypeRequest);

            return(list);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 维修类别基础数据
 /// </summary>
 /// <param name="repairItemTypeRequest"></param>
 /// <returns></returns>
 public async Task <QueryResult <CrmEntity> > QueryRepairItemType(RepairItemTypeRequest repairItemTypeRequest)
 {
     return(await _baseDataService.QueryRepairItemType(repairItemTypeRequest));
 }