public void ProcessPhone(ListItemModel model) { RxApp.MainThreadScheduler.Schedule(_ => { IsGettingData = true; LstClients.Clear(); }); _client.ExecutionProxy .ExecuteRequest <String, String, ResponseMessageData <ClientInfoModel>, ResponseMessageData <ClientInfoModel> > (model.Value, TransferDto.SameType, SharedConstants.Server.CLIENT_HUB, SharedConstants.Server.SEARCH_CLIENTS_BY_PHONE_CLIENT_HUB_METHOD, TransferDto.SameType) .Subscribe(OnClientsListReady, OnClientsListError); }
private void OnClientsListReady(IStale <ResponseMessageData <ClientInfoModel> > obj) { if (obj.IsStale) { OnClientsListError(Resources.Network.ResNetwork.ERROR_NETWORK_DOWN); return; } if (obj.Data.IsSuccess == false) { OnClientsListError(obj.Data.Message); return; } RxApp.MainThreadScheduler.Schedule(_ => { IsGettingData = false; var lstRecurrence = new List <long>(obj.Data.LstData.Count()); LstClients.Clear(); var bIsFirst = true; foreach (var clientInfo in obj.Data.LstData) { var clientGrid = new ClientInfoGrid { ClientInfo = clientInfo, Status = SharedConstants.Client.RECORD_SAVED, IsSelected = bIsFirst }; lstRecurrence.Add(clientInfo.ClientId ?? EntityConstants.NULL_VALUE); OnClientChanged(clientGrid, bIsFirst); LstClients.Add(clientGrid); bIsFirst = false; } if (lstRecurrence.Count != 0) { _client.ExecutionProxy.ExecuteRequest <IList <long>, IList <long>, ResponseMessageData <RecurrenceResponseModel>, ResponseMessageData <RecurrenceResponseModel> > (lstRecurrence, TransferDto.SameType, SharedConstants.Server.CLIENT_HUB, SharedConstants.Server.CALCULATE_RECURRENCE_CLIENT_HUB_METHOD, TransferDto.SameType) .Subscribe(OnRecurrenceClientsOk, OnRecurrenceClientsError); } if (bIsFirst) { OnClientChanged(null, true); } }); }