/// <summary> /// 维修项目基础数据 /// </summary> /// <param name="repairItemInfoRequest"></param> /// <returns></returns> public async Task <QueryResult <CrmEntity> > QueryRepairItemInfo(RepairItemInfoRequest repairItemInfoRequest) { try { var fetchString = _baseDataRepository.QueryRepairItemInfo(repairItemInfoRequest); 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 = repairItemInfoRequest.page; queryResult.TotalCount = 0; return(queryResult); } catch (Exception ex) { throw ex; } }
public async Task <NewtonsoftJsonActionResult <QueryResult <CrmEntity> > > QueryRepairItemInfo(string dealerid, string seachkey = "", string sort = "", int pageSize = 10, int page = 1) { var repairItemInfoRequest = new RepairItemInfoRequest() { search = seachkey, page = page, pageSize = pageSize, sort = sort, mcs_dealerid = dealerid }; var list = await app.QueryRepairItemInfo(repairItemInfoRequest); return(list); }
/// <summary> /// 维修项目基础数据 /// </summary> /// <param name="repairItemInfoRequest"></param> /// <returns></returns> public string QueryRepairItemInfo(RepairItemInfoRequest repairItemInfoRequest) { var filter = string.Empty; if (!string.IsNullOrWhiteSpace(repairItemInfoRequest.search)) { filter += $"<filter type='and'>"; filter += $"<condition attribute='mcs_name' operator='like' value='%{repairItemInfoRequest.search}%' />"; filter += $"<condition attribute='mcs_pinyincode' operator='like' value='%{repairItemInfoRequest.search}%' />"; filter += $"</filter>"; } if (!string.IsNullOrWhiteSpace(repairItemInfoRequest.mcs_dealerid)) { filter += $"<filter type='or'>"; filter += $"<condition attribute='mcs_dealerid' operator='eq' value='{repairItemInfoRequest.mcs_dealerid}' />"; filter += $"<condition attribute='mcs_isdealeritem' operator='ne' value='1' />"; filter += $"</filter>"; } var fetchString = $@"<fetch version='1.0' count='{repairItemInfoRequest.pageSize}' page='{repairItemInfoRequest.page}' output-format='xml-platform' mapping='logical' distinct='false'> <entity name='mcs_repairiteminfo'> <attribute name='mcs_name' /> <attribute name='createdon' /> <attribute name='mcs_pinyincode' /> <attribute name='mcs_price' /> <attribute name='mcs_workinghour' /> <attribute name='mcs_repairitemcode' /> <attribute name='mcs_isbatteryrepairitem' /> <attribute name='mcs_isdealeritem' /> <attribute name='mcs_dealerid' /> <attribute name='mcs_repairiteminfoid' /> <order attribute='createdon' descending='true' /> <filter type='and'> <condition attribute='statecode' operator='eq' value='0' /> {filter} </filter> <link-entity name='mcs_dealer' from='mcs_dealerid' to='mcs_dealerid' visible='false' link-type='outer' alias='dealer'> <attribute name='mcs_name' /> </link-entity> </entity> </fetch>"; return(fetchString); }
/// <summary> /// 查询维修项目基础数据 /// </summary> /// <param name="repairItemInfoRequest"></param> /// <returns></returns> public async Task <QueryResult <CrmEntity> > QueryRepairItemInfo(RepairItemInfoRequest repairItemInfoRequest) { return(await _baseDataService.QueryRepairItemInfo(repairItemInfoRequest)); }