Ejemplo n.º 1
0
        public async Task UpdateIncomingItem(IncomingItem model)
        {
            try
            {
                if (hubConnection.State == HubConnectionState.Disconnected)
                {
                    await Connect();
                }

                if (hubConnection.State == HubConnectionState.Connecting)
                {
                    await Task.Delay(3000);
                }

                if (hubConnection.State == HubConnectionState.Reconnecting)
                {
                    await Task.Delay(3000);
                }

                if (hubConnection.State == HubConnectionState.Connected)
                {
                    await hubConnection.InvokeAsync("UpdateIncomingItem", model);
                }
                else
                {
                    throw new SystemException($"Data Tidak Terkirim !, {hubConnection.State}");
                }
            }
            catch (Exception ex)
            {
                throw new SystemException(ex.Message);
            }
        }
Ejemplo n.º 2
0
        public Task UpdateIncomingItem(IncomingItem model)
        {
            var item = _incomingService.Datas.Where(x => x.Product.Id == model.Product.Id).FirstOrDefault();

            if (item != null && item.ActualValue != model.ActualValue)
            {
                item.ActualValue = model.ActualValue;
                return(Clients.Others.SendAsync("RecieveIncomingItem", model));
            }
            return(Task.CompletedTask);
        }
Ejemplo n.º 3
0
 private async Task Item_UpdateEvent(IncomingItem arg)
 {
     await Signalr.UpdateIncomingItem(arg);
 }