private void SubmitExecute(object obj) { if (!IsValid()) { return; } if (wrapTeam == null) { wrapTeam = new WrapTeam(); wrapTeam.Team.TeacherID = App.CurrentUser.ID; wrapTeam.Team.MatchID = SelectedMatch.ID; } wrapTeam.Team.Name = TeamName; wrapTeam.Team.Introduce = Introduce; wrapTeam.Team.TeamLeader = TeamLeader; wrapTeam.Team.TeamMembers = TeamMembers; var client = Utils.ServicesFactory.CreateMatchService(); client.AddOrUpdateTeamCompleted += (s, e) => { wrapTeam.Team.ID = e.Result; CloseRequest.Raise(); }; client.AddOrUpdateTeamAsync(wrapTeam.Team); }
private void SubmitExecute(object obj) { if (!IsValid()) { return; } user user = null; if (Parameter is user) { user = Parameter as user; } else { user = new user() { Name = UserName, Password = Password }; } if (UserType == "管理员") { user.UserType = Role.Administrator.ToString(); } else if (UserType == "教师") { user.UserType = Role.Teacher.ToString(); } user.Tel = Tel; user.Info = Info; var client = Utils.ServicesFactory.CreateMatchService(); client.AddOrUpdateUserCompleted += (s, e) => CloseRequest.Raise(); client.AddOrUpdateUserAsync(user); }
/// <summary> /// Close an order transaction on the OPay cashier service. /// The order gets validated both by the SDK, and the remote OPay service. /// A successful return value indicates that the message has been successfully sent and completed. /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <BaseResponse <CloseData> > Close(CloseRequest request) { request.Validate(); var jsonRequest = JsonConvert.SerializeObject(request); var signature = SignData(jsonRequest); _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", signature); var response = await _httpClient.SendAsync(new HttpRequestMessage { RequestUri = new Uri(ClosePath, UriKind.Relative), Method = HttpMethod.Post, Content = new StringContent(jsonRequest, Encoding.UTF8, JsonMediaType) }); var jsonResponse = await response.Content.ReadAsStringAsync(); if (!response.IsSuccessStatusCode) { throw new OpayCashierHttpException(response.StatusCode, jsonResponse); } return(JsonConvert.DeserializeObject <BaseResponse <CloseData> >(jsonResponse)); }
public void Close() { Msg reply = null; lock (mu) { cleanupOnClose(null); if (nc == null || nc.IsClosed()) { nc = null; return; } CloseRequest req = new CloseRequest { ClientID = clientID }; try { if (closeRequests != null) { reply = nc.Request(closeRequests, ProtocolSerializer.marshal(req)); } } catch (StanBadSubscriptionException) { // it's possible we never actually connected. return; } if (reply != null) { CloseResponse resp = new CloseResponse(); try { ProtocolSerializer.unmarshal(reply.Data, resp); } catch (Exception e) { throw new StanCloseRequestException(e); } if (!string.IsNullOrEmpty(resp.Error)) { throw new StanCloseRequestException(resp.Error); } } if (ncOwned) { nc.Close(); } nc = null; } }
public void close() { var req = new CloseRequest() { oldtrxid = "112024090001369129" }; var clinet = new AllinPayClient(); var rsp = clinet.close(req); }
/// <summary> /// Handle the network's packets. /// </summary> /// <param name="packet">The packet to handle.</param> private void HandleDefaultPackets(Packet packet) { if (packet.GetType().Equals(typeof(PingRequest))) { Send(new PingResponse()); return; } else if (packet.GetType().Equals(typeof(PingResponse))) { long elapsedTime = currentPingStopWatch.ElapsedMilliseconds; currentPingStopWatch.Reset(); nextPingStopWatch.Restart(); Ping = elapsedTime / 2; RTT = elapsedTime; return; } else if (packet.GetType().Equals(typeof(CloseRequest))) { CloseRequest closeRequest = (CloseRequest)packet; readStreamThread.Abort(); writeStreamThread.Abort(); connectionClosed?.Invoke(closeRequest.CloseReason, this); invokePacketThread.Abort(); CloseSocket(); return; } else if (packet.GetType().Equals(typeof(EstablishUdpRequest))) { EstablishUdpRequest establishUdpRequest = (EstablishUdpRequest)packet; IPEndPoint udpEndPoint = new IPEndPoint(IPAddress.Any, GetFreePort()); Send(new EstablishUdpResponse(udpEndPoint.Port)); UdpConnection udpConnection = new UdpConnection(new UdpClient(udpEndPoint), new IPEndPoint(IPRemoteEndPoint.Address, establishUdpRequest.UdpPort), true); pendingUDPConnections.Enqueue(udpConnection); connectionEstablished?.Invoke((TcpConnection)this, udpConnection); return; } else if (packet.GetType().Equals(typeof(EstablishUdpResponseACK))) { UdpConnection udpConnection = null; while (!pendingUDPConnections.TryDequeue(out udpConnection)) { Thread.Sleep(CPU_SAVE); } udpConnection.WriteLock = false; return; } if (!packetHandler.ContainsKey(packet.GetType())) { CloseHandler(CloseReason.UnknownPacket); return; } packetHandler[packet.GetType()].Invoke(packet, this); }
public async Task <OkObjectResult> Close(string OutTradeNo) { var request = new CloseRequest(); request.AddParameters(new CloseModel() { OutTradeNo = OutTradeNo }); return(Ok(await _client.ExecuteAsync(request))); }
public async Task <BaseResponse <CloseData> > Close() { var closeRequest = new CloseRequest { OrderNo = "200408141665571675", Reference = "test_637219088240003560" }; return(await _cashierService.Close(closeRequest)); }
/// <summary> /// Closes a trade order /// </summary> /// <param name="accountId">The id of the account</param> /// <param name="instrument">The currency pair that is requested to be traded</param> /// <returns>Nothing</returns> public async Task <TradeCloseResponse> CloseOrder(string accountId, string instrument) { var apiUrl = $"{_baseUrl}{_apiVersion}/accounts/{accountId}/positions/{instrument}/close"; var closeRequest = new CloseRequest("ALL"); var uri = new Uri(apiUrl); var response = await SendRequestAsync <TradeCloseResponse>(uri, HttpMethod.Put, null, closeRequest); return(response); }
/// <summary> /// Closes the game. /// </summary> /// <param name="request">The request.</param> /// <exception cref="System.InvalidOperationException">You did not join any game.</exception> public void CloseGame(CloseRequest request) { MazeGame game = gameManager.GetGame(request.Client); if (game == null) { throw new InvalidOperationException("You did not join any game."); } game.RemovePlayer(request.Client); }
private void SubmitExecute(object obj) { if (!IsValid()) { return; } IsBusy = true; if (wrapMatch == null) { wrapMatch = new WrapMatch(); //wrapMatch.Match.Status = MatchStatus.Running.ToString(); wrapMatch.Match.PublisherID = App.CurrentUser.ID; } wrapMatch.Match.Name = MatchName; wrapMatch.Match.Level = level; wrapMatch.Match.Sponsor = Sponsor; wrapMatch.Match.Address = Address; wrapMatch.Match.Description = Description; wrapMatch.Match.StartTime = StartTime; wrapMatch.Match.EndTime = EndTime; wrapMatch.Match.StartSign = StartSign; wrapMatch.Match.EndSign = EndSign; var client = Utils.ServicesFactory.CreateMatchService(); client.AddOrUpdateMatchCompleted += (s, e) => { wrapMatch.Match.ID = e.Result; client.DeleteAttachesByMIDCompleted += (ss, ee) => { var attaches = new ObservableCollection <attach>(); Attachs.ToList().ForEach(l => attaches.Add(new attach() { Type = "Match", TypeID = wrapMatch.Match.ID, FileName = l.Name, Path = string.Format("ClientBin/Attach/Matches/{0}/{1}", wrapMatch.Match.ID, l.Name) })); client.AddAttachesAsync(attaches); load = 0; uploadAttachs = Attachs.Where(l => l.State != Common.Controls.UploadDataState.Uploaded).ToList(); if (uploadAttachs.Count > 0) { StartUpload(); } else { CloseRequest.Raise(); } }; client.DeleteAttachesByMIDAsync(wrapMatch.Match.ID); }; client.AddOrUpdateMatchAsync(wrapMatch.Match); }
protected override bool ProcessBeforeCloseGame(CloseRequest request) { var property = this.Properties.GetProperty("key"); if (property != null && (((string)property.Value) == "BeforeCloseContinueException" || ((string)property.Value) == "CloseFatal")) { throw new Exception(string.Format("Expected Test Exception: {0}", property.Value)); } return(base.ProcessBeforeCloseGame(request)); }
public void CloseFile(NtHandle handle) { CloseRequest request = new CloseRequest { FID = ((Smb1Handle)handle).FID }; TrySendMessage(request); SMB1Message reply = m_client.WaitForMessage(CommandName.SMB_COM_CLOSE); reply.IsSuccessElseThrow(); }
private void Client_WriteStreamClosed(object sender, WriteStreamClosedEventArgs e) { if (++load < uploadAttachs.Count) { StartUpload(); } else { IsBusy = false; CloseRequest.Raise(); } }
public ActionResult Close(string out_trade_no) { var request = new CloseRequest(); request.AddGatewayData(new CloseModel() { OutTradeNo = out_trade_no }); var response = _gateway.Execute(request); return(Json(response)); }
public void TestClose() { var request = new CloseRequest(); request.AddGatewayData(new CloseModel() { OutTradeNo = _outTradeNo }); var response = _alipayGateway.Execute(request); Assert.Equal("40004", response.Code); }
public NTStatus CloseFile(object handle) { CloseRequest request = new CloseRequest(); request.FID = (ushort)handle; TrySendMessage(request); SMB1Message reply = m_client.WaitForMessage(CommandName.SMB_COM_CLOSE); if (reply != null) { return(reply.Header.Status); } return(NTStatus.STATUS_INVALID_SMB); }
public void Close() { Handler?.Dispose(); Dispose(); if (IsPlayList()) { CloseRequest?.Invoke(this, EventArgs.Empty); } else { //VideoViewから削除 VideoViewに無かったらスルーされる App.ViewModelRoot.MainContent.RemoveVideoView(this); } }
internal static SMBCommand GetCloseResponse(SMBHeader header, CloseRequest request, StateObject state) { string openedFilePath = state.GetOpenedFilePath(request.FID); if (openedFilePath == null) { header.Status = NTStatus.STATUS_SMB_BAD_FID; return(new ErrorResponse(CommandName.SMB_COM_CLOSE)); } state.RemoveOpenedFile(request.FID); CloseResponse response = new CloseResponse(); return(response); }
public SettingsModel() { SaveCommand = new RelayCommand(_ => { FiddlerApplication.Prefs.SetBoolPref(PreferenceNames.CHECK_FOR_UPDATED_PREF, CheckForUpdates); //saving - and changing - the settings should count as asking. FiddlerApplication.Prefs.SetBoolPref(PreferenceNames.ASK_CHECK_FOR_UPDATES_PREF, true); CloseRequest?.Invoke(); }); CancelCommand = new RelayCommand(_ => { CloseRequest?.Invoke(); }); CheckForUpdates = FiddlerApplication.Prefs.GetBoolPref(PreferenceNames.CHECK_FOR_UPDATED_PREF, false); }
public void CloseFile(NtHandle handle) { CloseRequest request = new CloseRequest { FileId = (FileID)handle }; SendCommand(request); SMB2Command?response = WaitForCommand(request.MessageID); if (response.Header.Status != NTStatus.STATUS_FILE_CLOSED) { response?.IsSuccessElseThrow(); } }
public NTStatus CloseFile(object handle) { CloseRequest request = new CloseRequest(); request.FileId = (FileID)handle; ulong messageId = TrySendCommand(request); SMB2Command response = m_client.WaitForCommand(SMB2CommandName.Close, messageId); if (response != null) { return(response.Header.Status); } return(NTStatus.STATUS_INVALID_SMB); }
public CloseResponse close(CloseRequest req) { CloseResponse rsp = null; try { var strResp = this.InternalRequest(req, "close"); rsp = JsonConvert.DeserializeObject <CloseResponse>(strResp); } catch (JsonSerializationException e) { throw new Exception(e.Message); } return(rsp); }
public CloseResponse Close(PayRequest payRequest) { _gateway = _gateways.GetByStoreId <WechatpayGateway>(payRequest.GetStoreId()); var queryModel = Newtonsoft.Json.JsonConvert.DeserializeAnonymousType(payRequest.BizContent, new { out_trade_no = "" }); var request = new CloseRequest(); request.AddGatewayData(new CloseModel() { OutTradeNo = queryModel.out_trade_no }); var response = _gateway.Execute(request); return(response); }
private void unlockClick(string Password) { WrongPassBlockVisibility = Visibility.Hidden; if (Password != _core.UserService.User.Password) { WrongPassBlockVisibility = Visibility.Visible; OnPropertyChanged(nameof(WrongPassBlockVisibility)); //if (Password.Length != 4) //{ //} return; } OnPropertyChanged(nameof(WrongPassBlockVisibility)); CloseRequest?.Invoke(this, null); }
public void CloseFile(uint treeId, Guid fileId) { ulong mid = (ulong)Interlocked.Increment(ref MessageId); SMB2Header sMB2Header = new SMB2Header(ESMB2Command.CLOSE, SMB2HeaderFlags.None, mid, treeId, SessionId); SMB2Body sMB2Body = new CloseRequest(fileId); SMB2Message sMB2Message = new SMB2Message(sMB2Header, sMB2Body); SMBTransport.SendDatas(sMB2Message.DumpBinary()); var sm = GetMessage(mid); if (sm.SMB2Header.Status != 0) { throw new Exception("CloseFile Status error:" + sm.SMB2Header.Status); } }
public async Task <NTStatus> CloseFileAsync(object handle, CancellationToken cancellationToken) { CloseRequest request = new CloseRequest(); request.FileId = (FileID)handle; await TrySendCommandAsync(request, cancellationToken); SMB2Command response = m_client.WaitForCommand(SMB2CommandName.Close); if (response != null) { return(response.Header.Status); } return(NTStatus.STATUS_INVALID_SMB); }
public async Task TestClose() { var closeRequest = new CloseRequest { OrderNo = "200408141665571675", Reference = "test_637219088240003560" }; var closeResponse = await _cashierService.Close(closeRequest); Assert.Equal("00000", closeResponse.Code); Assert.Equal("SUCCESSFUL", closeResponse.Message); Assert.NotNull(closeResponse.Data); Assert.NotEmpty(closeResponse.Data.OrderNo); Assert.NotEmpty(closeResponse.Data.Reference); Assert.Equal("CLOSED", closeResponse.Data.Status); }
/// <summary> /// Executes the command. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The arguments.</param> /// <returns></returns> public override CommandResult Execute(IClient sender, string[] args) { // TODO: decide when to keep connection, when to close it. if (args.Length != 1) return new CommandResult(false, Command.Close, "Usage: close <name>", true); CloseRequest request = new CloseRequest(sender, args[0]); try { _model.CloseGame(request); } catch (Exception e) { return new CommandResult(false, Command.Close, e.Message, true); } return new CommandResult(true, Command.Close, "Successfully closed the game.", false); }
public bool CloseIncident(CloseRequest request) { try { var param = _db.FirstOrDefault <DolIncident>("where IncidentId=@0", request.IncidentId); param.Resolvedby = request.ResolvedBy; param.Resolvedon = request.ResolvedOn; param.Ispartreplaced = request.IsParReplaced; param.Pegrade = ""; //Generate Performance grade based on SLA param.Iscallresolved = request.IsCallResolved; param.Closedremark = request.ClosedRemark; _db.Update(param); return(true); } catch (Exception ex) { log.Fatal("ClassName:IncidentManagement MethodName: CloseIncident", ex); return(false); } }
public ActionResult Request(string loginid) { var request = new CloseRequest() { LoginId = loginid, RequestedBy = User.Identity.Name }; _repositoryFactory.CloseRequestRepository.EnsurePersistent(request); Message = "Close request has been submitted"; return RedirectToAction("Index", "Home"); }
public override bool BeforeRemoveFromCache() { this.RemoveRoomPath = RemoveState.BeforeRemoveFromCacheCalled; // we call the plugin and give it a chance to change the TTL - not sure it is a good idea ... but anyway. // we return fals to supress getting evicted from the cache. // and we enqueue the plugin call because we are holding a cache lock !! this.ExecutionFiber.Enqueue( () => { this.RemoveRoomPath = RemoveState.BeforeRemoveFromCacheActionCalled; var request = new CloseRequest { EmptyRoomTTL = this.EmptyRoomLiveTime }; RequestHandler handler = () => { try { return this.ProcessBeforeCloseGame(request); } catch (Exception e) { // here we can not rethrow because we are in fiber action this.Plugin.ReportError(Photon.Hive.Plugin.ErrorCodes.UnhandledException, e); this.TriggerPluginOnClose(); Log.Error(e); } return false; }; var info = new BeforeCloseGameCallInfo(this.PendingPluginContinue, this.callEnv) { Request = request, Handler = handler, SendParams = new SendParameters(), FailedOnCreate = this.failureOnCreate, }; try { this.Plugin.BeforeCloseGame(info); } catch (Exception e) { this.Plugin.ReportError(Photon.Hive.Plugin.ErrorCodes.UnhandledException, e); } }); return false; }
protected virtual bool ProcessBeforeCloseGame(CloseRequest request) { // we currently allow the plugin to set the TTL - it could be changed // through pluginhost properties ... we could remove that feature. // plugin.OnClose() is responsible for saving this.EmptyRoomLiveTime = request.EmptyRoomTTL; this.RemoveRoomPath = RemoveState.ProcessBeforeCloseGameCalled; if (this.EmptyRoomLiveTime <= 0) { this.RemoveRoomPath = RemoveState.ProcessBeforeCloseGameCalledEmptyRoomLiveTimeLECalled; this.TriggerPluginOnClose(); return true; } this.ExecutionFiber.Enqueue(() => this.ScheduleTriggerPluginOnClose(this.EmptyRoomLiveTime)); return true; }
protected override bool ProcessBeforeCloseGame(CloseRequest request) { var property = this.Properties.GetProperty("key"); if (property != null && (((string)property.Value) == "BeforeCloseContinueException" || ((string)property.Value) == "CloseFatal")) { throw new Exception(string.Format("Expected Test Exception: {0}", property.Value)); } return base.ProcessBeforeCloseGame(request); }