public async Task <object> AccountInfo(string accountName) { var response = new AccountInfoResponse(); if (string.IsNullOrWhiteSpace(accountName)) { response.FailedReason = "username null"; return(response); } await using (var ctx = new UchuContext()) { var user = await ctx.Users.FirstOrDefaultAsync(u => u.Username == accountName); if (user == default) { response.FailedReason = "not found"; return(response); } response.Success = true; response.Username = user.Username; response.Hash = user.Password; response.Id = user.Id; response.Banned = user.Banned; response.BannedReason = user.BannedReason; response.Level = user.GameMasterLevel; } return(response); }
private void ShowAccount(AccountInfoResponse accountInfo) { var account = accountInfo.Account; Console.WriteLine(accountInfo.Account.Name); Console.WriteLine($"{account.Starts}★\t{account.Demons}👾\t{account.CreatorPoints}🛠"); Console.WriteLine(new string('=', 24)); Console.WriteLine(); }
public MyQ(HttpClient client) { Client = client; Client.DefaultRequestHeaders.Add("MyQApplicationId", AppId); AccountInfo = new AccountInfoResponse(); Devices = new Dictionary <string, Device>(); _securityToken = ""; }
public static async Task <AccountInfoResponse[]> WaitForAccounts(Api api, params AccountId[] accounts) { var results = new AccountInfoResponse[accounts.Length]; for (var i = 0; i < accounts.Length; ++i) { results[i] = await WaitForAccount(api, accounts[i]); } return(results); }
public static AccountInfo GetAccountInfo(string access_token) { string urlParameters = "v1/users/self/?access_token=" + access_token; HttpResponseMessage response = client.GetAsync(urlParameters).Result; AccountInfoResponse accountInfo = new AccountInfoResponse(); if (response.IsSuccessStatusCode) { accountInfo = response.Content.ReadAsAsync <AccountInfoResponse>().Result; } return(accountInfo.data); }
private async void GetAccountInfo() { loginButton.Enabled = false; do { var response = await _presenter.TryGetAccountInfo(Username); if (response.IsSuccess) { AccountInfoResponse = response.Result; loginButton.Enabled = true; break; } } while (true); }
protected void load() { string str = ""; string str1 = ""; AccountInfoRequest accountinforequest = new AccountInfoRequest(); accountinforequest.api_password = SessionKey.apipass; accountinforequest.api_username = SessionKey.apiuser; accountinforequest.merchant_id = SessionKey.merchantid; AccountInfoResponse accountinforespone = new AccountInfoResponse(); BKPaymentProService2 bk=new BKPaymentProService2(); accountinforespone=bk.GetAccountInfo(accountinforequest); if (accountinforespone.error_code == "0") { PaymentMethod[] paymnet_id = accountinforespone.account_info.payment_methods; foreach (var item in paymnet_id) { string url = item.logo_url; string id = item.id; string name = item.name; /*1 =>"Các loại thẻ ATM trong nước", 2 =>"Các loại thẻ Tín dụng quốc tế", 3 =>"Chuyển khoản bằng Internet Banking", 4 =>"Chuyển khoản bằng máy ATM", 5 =>"Chuyển khoản tiền mặt tại quầy giao dịch" * */ if (item.payment_method_type == "1")//so sanh xem nó là hình thức nào có 5 hình thức là atm, interbanking { str = str + " <div class='bank'><a title='"+name+"' href='Pay.aspx?payment_method_id=" + id + "' style='padding-left:5px; padding-bottom:5px;'><img class='img-v' src='" + url + "' /></a></div>"; Literal2.Text = str; //... anh lấy nó ra } else if (item.payment_method_type == "2") { str1 = str1 + " <div class='bank'><a title='"+name+"' href='Pay.aspx?payment_method_id=" + id + "' style='padding-left:5px; padding-bottom:5px;'><img class='img-v' src='" + url + "' /></a></div>"; Literal3.Text = str1; } } } else Literal2.Text = accountinforespone.error_message; }
/// <summary> /// Wait for the account to exist in a validated ledger, then return current information. /// </summary> public static async Task <AccountInfoResponse> WaitForAccount(Api api, AccountId account) { var terminationTimeout = DateTime.UtcNow + TimeSpan.FromMinutes(5.0); var infoRequest = new AccountInfoRequest() { Ledger = LedgerSpecification.Validated, Account = account, }; AccountInfoResponse infoResponse = null; while (infoResponse == null) { try { infoResponse = await api.AccountInfo(infoRequest); } catch (RippleRequestException exc) { if (DateTime.UtcNow > terminationTimeout) { throw new Exception(string.Format("Could not find account {0} within 5 minutes", account)); } if (exc.Error != "actNotFound") { throw; } } if (infoResponse == null) { System.Threading.Thread.Sleep(1000); } } infoRequest.Ledger = LedgerSpecification.Current; return(await api.AccountInfo(infoRequest)); }
public void OnMessage(AccountInfoResponse msg, SessionID sessionID) { MessageDisplay(msg, sessionID, MessageDisplayer.Receiver); }
private void loginBtn_Clicked(object sender, EventArgs e) { indicator.IsVisible = true; indicator.IsRunning = true; //Task.Run(() => { try{ if (!client.Connected) { client = Connection.Connect(hostname, defaultPort, ref writer, ref reader); sessionID = (long)reader.Read(); } var username = usernameEntry.Text.Trim().ToUsername(); var password = passwordEntry.Text.ToPassword(); SignInRequest req = new SignInRequest(username, password, sessionID); writer.Write(req); //req.Send(writer); Response resp = (Response)reader.Read(); if (resp.SessionID == sessionID) { //switch ((ResponseType)Enum.Parse(typeof(ResponseType), (string)reader.Read())) switch (resp.Type) { case ResponseType.AccountInfo: AccountInfoResponse AIResp = (AccountInfoResponse)resp; //.Read(reader, sessionID); var homePage = new NavigationPage(new HomePage(app, username, writer, reader, AIResp, sessionID)); //Device.BeginInvokeOnMainThread(() => { //indicator.IsVisible = false; //indicator.IsRunning = false; app.MainPage = homePage; //}); break; case ResponseType.Fail: FailResponse FResp = (FailResponse)resp; //.Read(reader, sessionID); DisplayAlert(SignInFailTitle, FResp.Reason, DefaultCancel); break; default: throw new InvalidResponseException(); } } else { Connection.Disconnect(ref client, ref reader, ref writer); } } catch (SocketException) { DisplayAlert(ConnectionErrorTitle, ConnectionErrorMessage, DefaultCancel); } catch (InvalidResponseException) { //Task.Run( () => DisplayAlert(ResponseErrorTitle, ResponseErrorMessage, DefaultCancel); //); } finally { indicator.IsVisible = false; indicator.IsRunning = false; } //}); }