Example #1
0
        /// <summary>
        /// 查询车型颜色
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <QueryResult <CrmEntity> > QueryVehicleColor(VehicleColorRequest request)
        {
            try
            {
                var fetchString = _baseDataRepository.QueryVehicleColor(request);

                var fetchXdoc    = XDocument.Parse(fetchString);
                var fetchRequest = new CrmRetrieveMultipleFetchRequestMessage()
                {
                    EntityName = "mcs_vehiclecolor",
                    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 = request.page;
                queryResult.TotalCount  = 0;
                return(queryResult);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        /// <summary>
        /// 获取车型颜色
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public string QueryVehicleColor(VehicleColorRequest request)
        {
            var filter = string.Empty;

            if (!string.IsNullOrWhiteSpace(request.search))
            {
                filter += $"<filter type='or'>";
                filter += $"<condition attribute='mcs_code' operator='like' value='%{request.search}%' />";
                filter += $"<condition attribute='mcs_name' operator='like' value='%{request.search}%' />";
                filter += $"</filter>";
            }
            if (!string.IsNullOrWhiteSpace(request.carmodel))
            {
                filter += $"<condition attribute='mcs_vehtypeid' operator='eq' value='{request.carmodel}' />";
            }


            var fetchString = $@"<fetch version='1.0' count='{request.pageSize}' page='{request.page}' output-format='xml-platform' mapping='logical' distinct='false'>
                  <entity name='mcs_vehiclecolor'>
                    <attribute name='mcs_name' /> 
                    <attribute name='mcs_code' />  
                    <order attribute='createdon' descending='true' />
                    <filter type='and'>
                      <condition attribute='statecode' operator='eq' value='0' />
                        {filter}
                    </filter>
                    <link-entity name='mcs_vehicletype' from='mcs_vehicletypeid' to='mcs_vehtypeid' visible='false' link-type='outer' >
                      <attribute name='mcs_name' alias='vehicletypename'/>
                    </link-entity> 
                  </entity>
                </fetch>";

            return(fetchString);
        }
Example #3
0
        public async Task <NewtonsoftJsonActionResult <QueryResult <CrmEntity> > > QueryVehicleColor(string carmodel, string seachkey = "", string sort = "", int pageSize = 10, int page = 1)
        {
            var req = new VehicleColorRequest()
            {
                carmodel = carmodel,
                search   = seachkey,
                page     = page,
                pageSize = pageSize,
                sort     = sort
            };
            var list = await app.QueryVehicleColor(req);

            return(list);
        }
Example #4
0
 /// <summary>
 /// 车型颜色
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public async Task <QueryResult <CrmEntity> > QueryVehicleColor(VehicleColorRequest request) =>
 await _baseDataService.QueryVehicleColor(request);