public ActionResult RFQList() { List <RunningRequestViewModel> _req = new List <RunningRequestViewModel>(); var principal = (ClaimsIdentity)User.Identity; string UserId = principal.FindFirst(ClaimTypes.Actor).Value; decimal _UserId = Convert.ToDecimal(UserId); string UserRole = principal.FindFirst(ClaimTypes.Role).Value; RunningRequest _getRequest = new RunningRequest(_UserId, null, 3); if (UserRole == "Administrator") { _req = _getRequest.GetRFQRequsetAdmin(); } else { _req = _getRequest.GetRFQRequset();; } ViewBag.RequestName = "Request for Quotation"; ViewBag.RequestShortName = "RFQ"; return(View("RunningRequest", _req)); }
/// <summary> /// Adds a procedure which can be called from another scene host. /// </summary> /// <param name="route"></param> /// <param name="handler"></param> /// <param name="ordered"></param> public void AddInternalProcedure(string route, Func <RequestContext <IScenePeer>, Task> handler, bool ordered) { this._scene.AddInternalRoute(route, async p => { var buffer = new byte[2]; p.Stream.Read(buffer, 0, 2); var id = BitConverter.ToUInt16(buffer, 0); var peerCancellationToken = GetCancellationTokenForScene(p.Connection); var cts = CancellationTokenSource.CreateLinkedTokenSource(peerCancellationToken); var ctx = new RequestContext <IScenePeer>(p.Connection, _scene, id, ordered, new SubStream(p.Stream, false), cts); var identifier = Tuple.Create(p.Connection.SceneId, p.Connection.ShardId, id); var rq = new RunningRequest <IScenePeer> { ctx = ctx, cts = cts }; if (_runningInternalRequests.TryAdd(identifier, rq)) { try { Exception e = null; bool errorOccured = false; try { await handler.InvokeWrapping(ctx); } catch (Exception ex) { errorOccured = true; e = ex; } if (!errorOccured) { ctx.SendCompleted(); } else { var errorSent = false; var ex = e as ClientException; if (ex != null) { ctx.SendError(string.Join("|", ex.Message)); errorSent = true; } else { string errorMessage = string.Format("An error occured while executing procedure '{0}'.", route); if (!errorSent) { var errorId = Guid.NewGuid().ToString("N"); ctx.SendError($"An exception occurred on the server. Error {errorId}."); errorMessage = $"Error {errorId}. " + errorMessage; } _scene.DependencyResolver.Resolve <ILogger>().Log(LogLevel.Error, "rpc.host.server", errorMessage, e); } } } finally { _runningInternalRequests.TryRemove(identifier, out rq); ctx.Dispose(); } } else { ctx.Dispose(); } }, o => o); }