private void OnCallClient(object sender, ClientRequest request) { Task.Run(() => { lock (callLock) { Notify(request); } }); }
private void Notify(ClientRequest request) { try { logger.Debug("оповещение о новом запросе клиента [{0}]", request); ShowMessage(request); PlayVoice(request); CloseMessage(); } catch (Exception e) { logger.Error(e); } }
private async void ClearDisplayTextIfNeed(ClientRequest request) { if (!HubSettings.Enabled || !NeedClearText(request)) { return; } try { logger.Debug("clear text [device: {0}]", request.Operator.Workplace.DisplayDeviceId); using (var channel = DisplayChannelManager.CreateChannel()) { await channel.Service.ClearText(request.Operator.Workplace.DisplayDeviceId); } } catch (Exception e) { logger.Error(e); } }
private async void ShowDisplayText(ClientRequest request) { if (!HubSettings.Enabled) { return; } try { logger.Debug("show text [device: {0}; text: {1}]", request.Operator.Workplace.DisplayDeviceId, request.Number); using (var channel = DisplayChannelManager.CreateChannel()) { await channel.Service.ShowText(request.Operator.Workplace.DisplayDeviceId, request.Number.ToString()); } } catch (Exception e) { logger.Error(e); } }
private async void EditClientRequestForm_Load(object sender, EventArgs e) { Enabled = false; try { using (var channel = UserChannelManager.CreateChannel()) { operatorControl.Initialize(await taskPool.AddTask(channel.Service.GetUserLinks(UserRole.Operator))); } using (var channel = ChannelManager.CreateChannel()) { ClientRequest = await taskPool.AddTask(channel.Service.GetClientRequest(clientRequestId)); } Enabled = true; } catch (OperationCanceledException) { } catch (CommunicationObjectAbortedException) { } catch (ObjectDisposedException) { } catch (InvalidOperationException) { } catch (FaultException exception) { UIHelper.Warning(exception.Reason.ToString()); } catch (Exception exception) { UIHelper.Warning(exception.Message); } }
public void AdjustClientRequests(ClientRequest request) { lock (updateLock) { Window.Invoke(() => { var wrap = Requests.SingleOrDefault(r => r.Request.Equals(request)); var isImportantState = (request.State == ClientRequestState.Calling) || (request.State == ClientRequestState.Absence); if (!isImportantState && (wrap == null)) { return; } if (isImportantState) { if (wrap != null) { Requests.Remove(wrap); } Requests.Insert(0, new ClientRequestWrap() { Request = request, Added = DateTime.Now }); } else { wrap.Request = request; wrap.Added = DateTime.Now; } AdjustRequestsLength(); }); } SendRequestsToDisplays(); }
private void ClientRequestUpdated(object sender, ClientRequest e) { logger.Debug("ClientRequestUpdated..."); try { AdjustClientRequests(e); } catch (Exception ex) { logger.Error(ex); } }
private void PlayVoice(ClientRequest request) { logger.Debug("звуковое оповещение..."); using (var soundPlayer = new SoundPlayer()) { soundPlayer.PlayStream(Tones.Notify); soundPlayer.PlayStream(Words.Number); soundPlayer.PlayNumber(request.Number); var workplace = request.Operator.Workplace; soundPlayer.PlayStream(Workplaces.ResourceManager.GetStream(workplace.Type.ToString())); soundPlayer.PlayNumber(workplace.Number); if (workplace.Modificator != WorkplaceModificator.None) { soundPlayer.PlayStream(Workplaces.ResourceManager.GetStream(workplace.Modificator.ToString())); } } }
private void RenderClientRequestsGridViewRow(DataGridViewRow row, ClientRequest clientRequest) { row.Cells["numberColumn"].Value = clientRequest.Number; row.Cells["requestDateColumn"].Value = clientRequest.RequestDate.ToShortDateString(); row.Cells["requestTimeColumn"].Value = clientRequest.RequestTime.ToString("hh\\:mm\\:ss"); if (clientRequest.CallingStartTime != TimeSpan.Zero) { row.Cells["callingStartTimeColumn"].Value = clientRequest.CallingStartTime.ToString("hh\\:mm\\:ss"); } var waitingStartTime = clientRequest.WaitingStartTime; if (waitingStartTime != TimeSpan.Zero) { row.Cells["waitingStartTimeColumn"].Value = waitingStartTime.ToString("hh\\:mm\\:ss"); } var waitingTime = clientRequest.CallingFinishTime - waitingStartTime; if (waitingTime != TimeSpan.Zero) { row.Cells["waitingTimeColumn"].Value = waitingTime.ToString("hh\\:mm\\:ss"); } if (clientRequest.CallingFinishTime != TimeSpan.Zero) { row.Cells["сallingFinishTimeColumn"].Value = clientRequest.CallingFinishTime.ToString("hh\\:mm\\:ss"); } var callingTime = clientRequest.CallingFinishTime - clientRequest.CallingStartTime; if (callingTime != TimeSpan.Zero) { row.Cells["callingTimeColumn"].Value = callingTime.ToString("hh\\:mm\\:ss"); } if (clientRequest.RenderStartTime != TimeSpan.Zero) { row.Cells["renderStartTimeColumn"].Value = clientRequest.RenderStartTime.ToString("hh\\:mm\\:ss"); } if (clientRequest.RenderFinishTime != TimeSpan.Zero) { row.Cells["renderFinishTimeColumn"].Value = clientRequest.RenderFinishTime.ToString("hh\\:mm\\:ss"); } var renderTime = clientRequest.RenderFinishTime - clientRequest.RenderStartTime; if (renderTime != TimeSpan.Zero) { row.Cells["renderTimeColumn"].Value = renderTime.ToString("hh\\:mm\\:ss"); } if (clientRequest.Productivity > 0) { row.Cells["productivityColumn"].Value = clientRequest.Productivity; } row.Cells["subjectsColumn"].Value = clientRequest.Subjects.ToString(); row.Cells["clientColumn"].Value = clientRequest.Client; row.Cells["operatorColumn"].Value = clientRequest.Operator; row.Cells["serviceColumn"].Value = clientRequest.Service; row.Cells["stateColumn"].Value = Translater.Enum(clientRequest.State); row.Tag = clientRequest; row.DefaultCellStyle.BackColor = ColorTranslator.FromHtml(clientRequest.Color); }
public void CallClient(ClientRequest clientRequest) { OnCallClient(this, new QueuePlanEventArgs() { ClientRequest = clientRequest }); }
public bool IsRecent(ClientRequest target) { return Equals(target) && Version > target.Version; }
private bool NeedClearText(ClientRequest request) { return request.State == ClientRequestState.Rendered || request.State == ClientRequestState.Canceled; }
private void OnClientRequestUpdated(object sender, ClientRequest request) { ClearDisplayTextIfNeed(request); }
private void OnCallClient(object sender, ClientRequest request) { ShowDisplayText(request); }
private async void restoreMenuItem_Click(object sender, EventArgs e) { using (var channel = ChannelManager.CreateChannel()) { try { restoreMenuItem.Enabled = false; ClientRequest = await taskPool.AddTask(channel.Service.RestoreClientRequest(clientRequestId)); } catch (OperationCanceledException) { } catch (CommunicationObjectAbortedException) { } catch (ObjectDisposedException) { } catch (InvalidOperationException) { } catch (FaultException exception) { UIHelper.Warning(exception.Reason.ToString()); } catch (Exception exception) { UIHelper.Warning(exception.Message); } finally { restoreMenuItem.Enabled = true; } } }
private async void saveButton_Click(object sender, EventArgs e) { using (var channel = ChannelManager.CreateChannel()) { try { saveButton.Enabled = false; ClientRequest = await taskPool.AddTask(channel.Service.EditClientRequest(clientRequest)); if (Saved != null) { Saved(this, EventArgs.Empty); } } catch (OperationCanceledException) { } catch (CommunicationObjectAbortedException) { } catch (ObjectDisposedException) { } catch (InvalidOperationException) { } catch (FaultException exception) { UIHelper.Warning(exception.Reason.ToString()); } catch (Exception exception) { UIHelper.Warning(exception.Message); } finally { saveButton.Enabled = true; } } }
public void ShowMessage(ClientRequest request) { Number = request.Number; WorkplaceTitle = request.Operator.Workplace.ToString(); Active = true; }
public void ClientRequestUpdated(ClientRequest clientRequest) { OnClientRequestUpdated(this, new QueuePlanEventArgs() { ClientRequest = clientRequest }); }
private async void EditAdditionalServiceForm_Load(object sender, EventArgs e) { using (Channel<IServerTcpService> channel = ChannelManager.CreateChannel()) { try { Enabled = false; if (clientRequestId != Guid.Empty) { clientRequest = await taskPool.AddTask(channel.Service.GetClientRequest(clientRequestId)); } additionalServiceControl.Initialize(await taskPool.AddTask(channel.Service.GetAdditionalServiceLinks())); if (clientRequestAdditionalServiceId != Guid.Empty) { ClientRequestAdditionalService = await taskPool.AddTask(channel.Service.GetClientRequestAdditionalService(clientRequestAdditionalServiceId)); } else { ClientRequestAdditionalService = new ClientRequestAdditionalService() { ClientRequest = clientRequest, Quantity = 1 }; } } catch (OperationCanceledException) { } catch (CommunicationObjectAbortedException) { } catch (ObjectDisposedException) { } catch (InvalidOperationException) { } catch (FaultException exception) { UIHelper.Warning(exception.Reason.ToString()); } catch (Exception exception) { UIHelper.Warning(exception.Message); } finally { Enabled = true; } } }