public async Task <DeliveryListResponse> getlist(DeliveryListRequest deliveryListRequest) { try { var crmRequestHelper = new CrmRequestHelper(); var response = new DeliveryListResponse() { }; XDocument fetchXdoc = null; if (!string.IsNullOrWhiteSpace(deliveryListRequest.SearchKey)) { var deliveryListDtoModel = new DeliveryListDtoModel(); deliveryListDtoModel.vinEntitys = GetCrmEntities(vinEntityName, deliveryListRequest, crmRequestHelper).Result; deliveryListDtoModel.roEntitys = GetCrmEntities(roEntityName, deliveryListRequest, crmRequestHelper).Result; fetchXdoc = await _deliveryRepository.GetListFetchXml(deliveryListRequest, deliveryListDtoModel); } else { fetchXdoc = await _deliveryRepository.GetListFetchXml(deliveryListRequest, null); } var entities = await crmRequestHelper.ExecuteAsync(_crmService, entityName, fetchXdoc); response.Deliverys = entities.Results; response.ALLTotalCount = entities.Count; response.PageSize = deliveryListRequest.PageSize; response.CurrentPage = deliveryListRequest.PageIndex; return(response); } catch (Exception ex) { throw ex; } }
private async Task UpdateHistoryList() { historyList = new ObservableCollection <DeliveryListViewModel>(); userHistoryList.DataContext = historyList; DeliveryListResponse deliveryListResponse = await NetworkHelper.GetAsync(new DeliveryListRequest() { DelivererId = UserInfo.Id, State = DeliveryState.Finished }); foreach (Item item in deliveryListResponse.Items) { historyList.Add(new DeliveryListViewModel() { GUID = item.GUID.ToString(), Name = item.Name, Quantity = item.Quantity, StartID = item.StartID, FinishID = item.FinishID, Departure = item.Departure, Destination = item.Destination, StartTime = item.StartTime, FinishTime = item.FinishTime }); } }
private async Task UpdateHistoryList() { /* * DeliveryListResponse deliveryListResponse = await NetworkHelper.GetAsync(new DeliveryList * () * { * DelivererId = UserInfo.Id, * State = DeliveryState.Finished * }); *////todo 假数据 await Task.Delay(100); DeliveryListResponse deliveryListResponse = new DeliveryListResponse(); deliveryListResponse.Items = new List <Item>(); deliveryListResponse.Items.Add(new Item() { GUID = "qh1i2hisqh1is", Name = "水", Quantity = 100, StartID = 12345, FinishID = 98765, Departure = "a小区", Destination = "0仓库", StartTime = DateTime.Now, FinishTime = DateTime.Now }); ///////////////// foreach (Item item in deliveryListResponse.Items) { historyList.Add(new DeliveryListViewModel() { GUID = item.GUID, Name = item.Name, Quantity = item.Quantity, StartID = item.StartID, FinishID = item.FinishID, Departure = item.Departure, Destination = item.Destination, StartTime = item.StartTime, FinishTime = item.FinishTime }); } }
private async Task UpdateApplyList() { applyList = new ObservableCollection <DeliveryListViewModel>(); userApplyList.DataContext = applyList; DeliveryListResponse deliveryListResponse = await NetworkHelper.GetAsync(new DeliveryListRequest() { DelivererId = UserInfo.Id, State = DeliveryState.Alone }); foreach (Item item in deliveryListResponse.Items) { applyList.Add(new DeliveryListViewModel() { GUID = item.GUID.ToString(), Name = item.Name, Quantity = item.Quantity, Departure = item.Departure, Destination = item.Destination }); } }
private async Task UpdateProcessingList() {/* * DeliveryListResponse deliveryListResponse = await NetworkHelper.GetAsync(new DeliveryListRequest() * { * DelivererId = UserInfo.Id, * State = DeliveryState.Processing * });*/ // TODO 假数据 await Task.Delay(100); DeliveryListResponse deliveryListResponse = new DeliveryListResponse(); deliveryListResponse.Items = new List <Item>(); deliveryListResponse.Items.Add(new Item() { GUID = "qh1i2hisqh1is", Name = "水", Quantity = 100, Departure = "a小区", Destination = "0仓库", StartTime = DateTime.Now }); ////// foreach (Item item in deliveryListResponse.Items) { processingList.Add(new DeliveryListViewModel() { GUID = item.GUID, Name = item.Name, Quantity = item.Quantity, Departure = item.Departure, Destination = item.Destination, StartTime = item.StartTime }); } listCount.ProcessingCount = processingList.Count; }
private async Task UpdateWaitingList() { waitingList = new ObservableCollection <DeliveryListViewModel>(); userWaitingList.ItemsSource = waitingList; DeliveryListResponse deliveryListResponse = await NetworkHelper.GetAsync(new DeliveryListRequest() { DelivererId = UserInfo.Id, State = DeliveryState.Waiting }); foreach (Item item in deliveryListResponse.Items) { waitingList.Add(new DeliveryListViewModel() { GUID = item.GUID.ToString(), Name = item.Name, Quantity = item.Quantity, Departure = item.Departure, Destination = item.Destination, StartTime = item.StartTime }); } listCount.WaitingCount = waitingList.Count; }