private void StoreData() { var cashier = AccountInformation.GetInstance().CurrentAccount.Employee; var bill = new MaintenanceBill() { BikeID = bike.ID, Date = DateTime.Now, CashierID = cashier.ID, StoreID = cashier.StoreID, CustomerPayment = customer }; bill.ID = MaintenanceBillDAL.GetInstance().Insert(bill); foreach (var item in currentList) { item.BillID = bill.ID; var billDetailID = BillDetailDAL.GetInstance().Insert(item); //foreach (var billEmp in item.BillEmployees) //{ // billEmp.BillDetailID = billDetailID; // BillEmployeesDAL.GetInstance().Insert(billEmp); //} } MessageBox.Show("Create Bill Success"); this.Close(); }
public async Task TestAddressEnquiry() { VPAEnquiryResponse response = new VPAEnquiryResponse(); VPATranslateResponse vtr = new VPATranslateResponse(); VPAInformation vInfo = new VPAInformation(); PersonalInformation pInfo = new PersonalInformation(); AccountInformation aInfo = new AccountInformation(); MerchantInformation mInfo = new MerchantInformation(); List <AssociatedVpas> aVpas = new List <AssociatedVpas>(); VPAEnquiryRequest req = new VPAEnquiryRequest() { channelCode = 8, instructedInstitutionCode = "123", instructingInstitutionCode = "402", requestId = "i88hgtbh", targetVPA = "musaarca", updatedOn = DateTime.Now }; VPAEnquiryResponse respose = new VPAEnquiryResponse(); VPAEnquiryController controller = new VPAEnquiryController(getCacheSettings(), getAppSettings(), response, vtr, vInfo, pInfo, aInfo, mInfo, aVpas, req); respose = await controller.AddressEnquiry(req); Assert.NotNull(respose.httpStatusCode); Assert.Equal((int)HttpStatusCode.OK, respose.httpStatusCode); }
public static List <string> GetMarkets() { List <string> results = new List <string>(); if (ActionManager.CheckHaasConnection()) { try { HaasonlineClient haasonlineClient = new HaasonlineClient(ActionManager.mainConfig.IPAddress, ActionManager.mainConfig.Port, ActionManager.mainConfig.Secret); AccountInformation accountInformation = haasonlineClient.AccountDataApi.GetAccountDetails(mainConfig.AccountGUID).Result.Result; var markets = haasonlineClient.MarketDataApi.GetPriceMarkets(accountInformation.ConnectedPriceSource); foreach (var market in markets.Result.Result) { if (market.SecondaryCurrency.Equals(mainConfig.PrimaryCurrency)) { results.Add(market.PrimaryCurrency); } } } catch { return(results); } } return(results); }
public async Task TestVPAEnquiry() { VPAEnquiryResponse response = new VPAEnquiryResponse(); VPATranslateResponse vtr = new VPATranslateResponse(); VPAInformation vInfo = new VPAInformation(); PersonalInformation pInfo = new PersonalInformation(); AccountInformation aInfo = new AccountInformation(); MerchantInformation mInfo = new MerchantInformation(); List <AssociatedVpas> aVpas = new List <AssociatedVpas>(); VPAEnquiryRequest req = new VPAEnquiryRequest(); VPAEnquiryRequest vrequest = new VPAEnquiryRequest() { channelCode = 7, instructedInstitutionCode = "044", instructingInstitutionCode = "230", requestId = "hdfufsh3652", targetVPA = "fuzzytoocool", updatedOn = DateTime.Now }; VPATranslateResponse vpaTranslateResponse = new VPATranslateResponse(); VPAEnquiryController controller = new VPAEnquiryController(getCacheSettings(), getAppSettings(), response, vtr, vInfo, pInfo, aInfo, mInfo, aVpas, req); vpaTranslateResponse = await controller.testvpaEnquiry(vrequest); //Assert.Equal(v, vpaTranslateResponse); Assert.NotNull(vpaTranslateResponse.vpaId); Assert.Equal(vrequest.targetVPA, vpaTranslateResponse.vpaId); }
/// <summary> /// delete curretn account /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelete_Click(object sender, EventArgs e) { if (comboBoxResults.SelectedIndex < 0) { return; } AccountInformation account = getTextBoxInfo(); disableTextBox(); if (account == null) { MessageBox.Show("Account information is not currect."); return; } int row = _service.deleteData(account.GetType().Name, account.accountId.GetType().Name, account.accountId); //success to delete if (row > 0) { _accountList.Remove(account); comboBoxResults.Items.RemoveAt(comboBoxResults.SelectedIndex); comboBoxResults.SelectedIndex = 0; } //failed to delete else { MessageBox.Show("Failed to delete current account."); return; } }
/// <summary> /// update current account info. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { if (comboBoxResults.SelectedIndex < 0) { return; } AccountInformation account = getTextBoxInfo(); // disableTextBox(); if (account == null) { MessageBox.Show("Account information is not currect."); return; } int row = _service.updateData(account, account.accountId.GetType().Name, account.accountId); //failed to delete if (row < 1) { MessageBox.Show("Failed to update current account."); return; } }
public async Task <IActionResult> Edit(string id, [Bind("UserName,Password,RoleId")] AccountInformation accountInformation) { if (id != accountInformation.UserName) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(accountInformation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AccountInformationExists(accountInformation.UserName)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["RoleId"] = new SelectList(_context.Role, "RoleId", "PermissionType", accountInformation.RoleId); return(View(accountInformation)); }
public async Task <ActionResult> ForgotPassword([Bind("UserName,Password,RoleId")] AccountInformation accountInformation, string confirmPass) { var user = await _context.AccountInformation.FindAsync(accountInformation.UserName); accountInformation.RoleId = user.RoleId; if (accountInformation.Password.Equals(user.Password)) { ModelState.AddModelError("Password", "you can't use old password"); return(View()); } if (!accountInformation.Password.Equals(confirmPass)) { ModelState.AddModelError("Password", "Password mismatch"); return(View()); } if (ModelState.IsValid) { user.Password = accountInformation.Password; _context.Update(user); await _context.SaveChangesAsync(); TempData["Password"] = "******"; return(RedirectToAction("Index", "Home")); } // If we got this far, something failed, redisplay form return(View(accountInformation)); }
/// <summary> /// set account info to the textbox. /// </summary> /// <param name="listBoxIndex"></param> private void setTextBoxInfo(int listBoxIndex) { if (_accountList[listBoxIndex] == null) { return; } AccountInformation account = _accountList[listBoxIndex]; textBoxWebSite.Text = account.webSite; textBoxLoginAccount.Text = account.loginAccount; textBoxLoginPassword.Text = account.loginPassword; textBoxPayAccount.Text = account.payAccount; textBoxPayPassword.Text = account.payPassword; textBoxEmailAddr.Text = account.emailAddr; textBoxValidDate.Text = account.validDate; textBoxTelephone.Text = account.telephone; textBoxCreditSafeCode.Text = account.creditSafeCode; textBoxSafeQuestion1.Text = account.safeQuestion1; textBoxSafeQuestionA1.Text = account.safeQuestionAnswer1; textBoxSafeQuestion2.Text = account.safeQuestion2; textBoxSafeQuestionA2.Text = account.safeQuestionAnswer2; textBoxSafeQuestion3.Text = account.safeQuestion3; textBoxSafeQuestionA3.Text = account.safeQuestionAnswer3; textBoxEmergencyContact1.Text = account.emergencyContact1; textBoxEmergencyContactPhone1.Text = account.emergencyContactPhone1; textBoxEmergencyContact2.Text = account.emergencyContact2; textBoxEmergencyContactPhone2.Text = account.emergencyContactPhone2; textBoxAddress.Text = account.address; textBoxAccountType.Text = account.accountType; textBoxCompnayName.Text = account.companyName; textBoxCompanyCode.Text = account.companyCode; textBoxShopName.Text = account.shopName; textBoxShopCode.Text = account.shopCode; }
public async Task TestAccountEnquiry() { VPAEnquiryResponse response = new VPAEnquiryResponse(); VPATranslateResponse vtr = new VPATranslateResponse(); VPAInformation vInfo = new VPAInformation(); PersonalInformation pInfo = new PersonalInformation(); AccountInformation aInfo = new AccountInformation(); MerchantInformation mInfo = new MerchantInformation(); List <AssociatedVpas> aVpas = new List <AssociatedVpas>(); VPAEnquiryRequest req = new VPAEnquiryRequest(); AccountEnquiryRequest arequest = new AccountEnquiryRequest() { channelCode = 5, instructedInstitutionCode = "202", instructingInstitutionCode = "11", requestId = "jh3r4y75hui", targetAccountNumber = "2024878029" }; AccountInformation ainf = new AccountInformation(); VPAEnquiryController controller = new VPAEnquiryController(getCacheSettings(), getAppSettings(), response, vtr, vInfo, pInfo, aInfo, mInfo, aVpas, req); ainf = await controller.testAccountEnquiry(arequest); Assert.NotNull(ainf.accountNumber); Assert.Equal(arequest.targetAccountNumber, ainf.accountNumber); }
public async Task UpdateAsyncTest() { var tokens = AccountInformation.GetTokens(); var filter = await tokens.Filters.PostAsync(phrase => "test3", context => new List <string> { "home" }); await Task.Delay(1000); var updatedFilter = await tokens.Filters.UpdateAsync(id => filter.Id, phrase => "test4", context => new List <string> { "home" }); var filters = await tokens.Filters.GetAsync(); Assert.NotNull(filters); Assert.True(filters.Any()); Assert.Contains(filters, x => x.Id == filter.Id); Assert.Contains(filters, x => x.Phrase == "test4"); await Task.Delay(1000); await tokens.Filters.DeleteAsync(id => filter.Id); }
public async Task GetAsyncTest() { var tokens = AccountInformation.GetTokens(); var relationship = (await tokens.Accounts.RelationshipsAsync(id => new List <long> { 32641 })).First(); await Task.Delay(1000); if (!relationship.Blocking) { await tokens.Accounts.BlockAsync(id => 32641); } await Task.Delay(1000); var accounts = await tokens.Blocks.GetAsync(); Assert.NotNull(accounts); Assert.True(accounts.Count > 0); Assert.Contains(accounts, x => x.Id == 32641); await Task.Delay(1000); await tokens.Accounts.UnblockAsync(id => 32641); }
public async Task GetAsyncTest() { long statusId = 0; var tokens = AccountInformation.GetTokens(); using (var fs = new FileStream(@"./Data/image.png", FileMode.Open, FileAccess.Read)) { var attachment = await tokens.MediaAttachments.PostAsync(file => fs, focus => "0.0,0.0"); var scheduledStatus = await tokens.Statuses.PostAsync(status => "test toot future", visibility => "private", scheduled_at => "2022-12-24 12:00:00", media_ids => new List <long> { attachment.Id }); statusId = scheduledStatus.Id; } await Task.Delay(1000); var scheduledStatuses = await tokens.ScheduledStatuses.GetAsync(); Assert.NotNull(scheduledStatuses); Assert.True(scheduledStatuses.Count() > 0); await Task.Delay(1000); await tokens.ScheduledStatuses.DeleteAsync(id => statusId); }
public void DeleteUser(AccountInformation accountInformation) { AccountInformation account = SearchAccount(accountInformation); if (account != null) { _accountsOnline[account].Disconnect(false); Program.SecureWriting(() => { ConsoleColor colorTemp = Console.BackgroundColor; Console.BackgroundColor = ConsoleColor.DarkCyan; Console.Write("Пользователь"); Console.BackgroundColor = colorTemp; Console.Write(" "); Console.BackgroundColor = ConsoleColor.Gray; ConsoleColor tmpForeg = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Blue; Console.Write(accountInformation.FirstName); Console.BackgroundColor = colorTemp; Console.Write(" "); Console.BackgroundColor = ConsoleColor.Gray; Console.Write(accountInformation.LastName); Console.ForegroundColor = tmpForeg; Console.BackgroundColor = colorTemp; Console.Write(" "); Console.BackgroundColor = ConsoleColor.DarkCyan; Console.WriteLine("вышел из чата"); Console.BackgroundColor = colorTemp; }); _accountsOnline.Remove(account); } }
public async Task <bool> TryValidatingAccount(AccountInformation credentials) { AccountInformation properCredentials; try { properCredentials = await GetAccount(credentials.Username); credentials.Salt = properCredentials.Salt; } catch { return(false); } Hash(credentials); if (properCredentials.Password.Equals(credentials.Password)) { return(true); } else { return(false); } }
protected override void HandleRequest() { using (StreamWriter wtr = new StreamWriter(Context.Response.OutputStream)) { using (StreamReader rdr = new StreamReader($"account/struct/AccountInformationStruct.json")) { DbAccount acc; LoginStatus status = Database.Verify(Query["guid"], Query["password"], out acc); string JSONData = rdr.ReadToEnd(); if (status == LoginStatus.OK) { List <string> data = new List <string>(); AccountInformation user = new AccountInformation(); user.name = acc.Name; user.accountType = acc.AccountType; user.accountLifetime = acc.AccountLifetime; user.email = acc.UUID; user.guildId = Convert.ToInt32(acc.GuildId); user.guildName = user.guildId == -1 ? string.Empty : Database.GetGuild(acc.GuildId).Name; user.guildRank = user.guildId == -1 ? -1 : acc.GuildRank; user.isBanned = acc.Banned; user.isRegistered = acc.Verified; user.isAgeVerified = acc.IsAgeVerified == 1 ? true : false; user.isNameChosen = acc.NameChosen; user.isAccountMuted = acc.Muted; user.totalFame = acc.TotalFame; user.registration = acc.RegTime; user.vaultQuantity = acc.VaultCount; user.characterSlotQuantity = acc.MaxCharSlot; user.credits = acc.Credits; user.fame = acc.Fame; user.authenticationToken = acc.AuthToken; data.Add(JSONData.Replace("{NAME}", user.name)); data.Add(data[0].Replace("{FORMAT_ACCOUNT_TYPE}", user.formatAccountType())); data.Add(data[1].Replace("{EMAIL}", user.email)); data.Add(data[2].Replace("{FORMAT_GUILD}", user.formatGuild())); data.Add(data[3].Replace("{IS_BANNED}", $"{user.isBanned}")); data.Add(data[4].Replace("{IS_REGISTERED}", $"{user.isRegistered}")); data.Add(data[5].Replace("{IS_AGE_VERIFIED}", $"{user.isAgeVerified}")); data.Add(data[6].Replace("{IS_NAME_CHOSEN}", $"{user.isNameChosen}")); data.Add(data[7].Replace("{IS_MUTED}", $"{user.isAccountMuted}")); data.Add(data[8].Replace("{TOTAL_FAME}", $"{user.totalFame}")); data.Add(data[9].Replace("{REGISTRATION}", $"{user.registration}")); data.Add(data[10].Replace("{FORMAT_VAULT}", user.formatVault())); data.Add(data[11].Replace("{FORMAT_CHARACTER_SLOT}", user.formatCharacterSlot())); data.Add(data[12].Replace("{FORMAT_CREDITS}", user.formatCredits())); data.Add(data[13].Replace("{FORMAT_FAME}", user.formatFame())); data.Add(data[14].Replace("{AUTH_TOKEN}", user.authenticationToken)); wtr.Write(JsonConvert.DeserializeObject <List <AccountInformationMessages> >(data[data.Count - 1])[0].message); } else { wtr.Write(JsonConvert.DeserializeObject <List <AccountInformationMessages> >(JSONData)[0].error); } } } }
public void AddUser(AccountInformation accountInformation, Socket socket) { if (!_accountsOnline.ContainsKey(accountInformation)) { foreach (Socket sockeT in _accountsOnline.Values) { Functions.SerializeAndSend( new MessageFromServer("Пользователь " + accountInformation.FirstName + " " + accountInformation.LastName + " зашёл в чат"), sockeT); } _accountsOnline.Add(accountInformation, socket); Program.SecureWriting(() => { ConsoleColor colorTemp = Console.BackgroundColor; Console.BackgroundColor = ConsoleColor.Blue; Console.Write("Пользователь"); Console.BackgroundColor = colorTemp; Console.Write(" "); Console.BackgroundColor = ConsoleColor.Gray; ConsoleColor tmpForeg = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Blue; Console.Write(accountInformation.FirstName); Console.BackgroundColor = colorTemp; Console.Write(" "); Console.BackgroundColor = ConsoleColor.Gray; Console.Write(accountInformation.LastName); Console.ForegroundColor = tmpForeg; Console.BackgroundColor = colorTemp; Console.Write(" "); Console.BackgroundColor = ConsoleColor.Blue; Console.WriteLine("зашёл в чат"); Console.BackgroundColor = colorTemp; }); } }
public IAccountInformation SetPrivacy(IAccountInformation privacy) { var ai = new AccountInformation { Identity = textIdentity.Text, Account = privacy.AccountNumber, Server = checkDemo.Checked }; if (API is Connect api) { var name = api.SetAccountName(privacy.AccountNumber, privacy.AccountPassword); Invoke(new Action(async() => { ai.Name = name.Item2; ai.Nick = name.Item1; if (checkPrivacy.Checked && int.MaxValue > await new Secrecy().Encrypt(this.privacy, textIdentity.Text, textPassword.Text, textCertificate.Text, privacy.AccountNumber, privacy.AccountPassword, checkDemo.Checked)) { Console.WriteLine(ai.Nick); } })); } return(ai); }
public static bool GrabMarketData(string market, string maincoin) { HaasonlineClient haasonlineClient = new HaasonlineClient(ConfigManager.mainConfig.IPAddress, ConfigManager.mainConfig.Port, ConfigManager.mainConfig.Secret); AccountInformation accountInformation = haasonlineClient.AccountDataApi.GetAccountDetails(ConfigManager.mainConfig.AccountGUID).Result.Result; var keepPolling = true; var counter = 0; while (keepPolling) { var res = haasonlineClient.MarketDataApi.GetHistory(accountInformation.ConnectedPriceSource, market, maincoin, "", 1, ConfigManager.mainConfig.BackTestLength * 2).Result; if (res.ErrorCode == EnumErrorCode.Success && res.Result.Count >= ConfigManager.mainConfig.BackTestLength) { break; } counter++; if (counter > 30) { return(false); } Thread.Sleep(3000); } return(true); }
public void OAuthAuthorizationCodeFlowTest() { // Make an API call with the token ApiClient apiClient = new ApiClient(BaseUrl); DocuSign.eSign.Client.Configuration.Default.ApiClient = apiClient; // Initiate the browser session to the Authentication server // so the user can login. string accountServerAuthUrl = apiClient.GetAuthorizationUri(client_id, redirect_url, true, stateOptional); System.Diagnostics.Process.Start(accountServerAuthUrl); WaitForCallbackEvent = new ManualResetEvent(false); // Launch a self-hosted web server to accepte the redirect_url call // after the user finishes authentication. using (WebApp.Start <Startup>("http://localhost:3000")) { Trace.WriteLine("WebServer Running. Waiting for access_token..."); // This waits for the redirect_url to be received in the REST controller // (see classes below) and then sleeps a short time to allow the response // to be returned to the web browser before the server session ends. WaitForCallbackEvent.WaitOne(60000, false); Thread.Sleep(1000); } Assert.IsNotNull(AccessCode); string accessToken = apiClient.GetOAuthToken(client_id, client_secret, true, AccessCode); Assert.IsNotNull(accessToken); Trace.WriteLine("Access_token: " + accessToken); // we will retrieve this from the login API call string accountId = null; ///////////////////////////////////////////////////////////////// // STEP 1: LOGIN API ///////////////////////////////////////////////////////////////// // login call is available in the authentication api AuthenticationApi authApi = new AuthenticationApi(); LoginInformation loginInfo = authApi.Login(); // parse the first account ID that is returned (user might belong to multiple accounts) accountId = loginInfo.LoginAccounts[0].AccountId; // Update ApiClient with the new base url from login call apiClient = new ApiClient(loginInfo.LoginAccounts[0].BaseUrl); ///////////////////////////////////////////////////////////////// // STEP 2: CREATE ACCOUNTS API ///////////////////////////////////////////////////////////////// AccountsApi accountsApi = new AccountsApi(); AccountInformation accountInformation = accountsApi.GetAccountInformation(accountId); Trace.WriteLine(accountInformation.ToString()); }
public void Deposit(AccountStatusAwareOperations context, AccountInformation account, Amount amount) { logger.LogInfo("Request to deposit '{0}' into active account '{1}'.", amount, account); decorated.Deposit(context, account, amount); logger.LogInfo("Deposit of '{0}' made into active account '{1}'.", amount, account); }
public async Task GetAsyncTest() { var tokens = AccountInformation.GetTokens(); var instance = await tokens.Instances.GetAsync(); Assert.Equal(instance.Uri, tokens.Instance); }
public async Task GetAsyncTest() { var tokens = AccountInformation.GetTokens(); var notifications = await tokens.Notifications.GetAsync(); Assert.NotNull(notifications); }
public async Task ListsTest() { var tokens = AccountInformation.GetTokens(); var lists = await tokens.Accounts.ListsAsync(id => 157355); Assert.NotNull(lists); }
public async Task VerifyCredentialsAsyncTest() { var tokens = AccountInformation.GetTokens(); var app = await tokens.Apps.VerifyCredentialsAsync(); Assert.NotNull(app.Name); }
public void InitializeProperties() { WithdrawalSettings = new DailyWithdrawalSettings(); WithdrawalSettings.InitializeProperties(); AccountInfo = new AccountInformation(); WithdrawalSlipNo = LastWithdrawalSlipNo() + 1; }
public async Task GetAsyncTest() { var tokens = AccountInformation.GetTokens(); var accounts = await tokens.FollowSuggestions.GetAsync(); Assert.NotNull(accounts); }
public AuthorizationBot() { accountInformation = new AccountInformation(); rootObjectCollection = new List <RootObject>(); matchesNewRootObjectCollection = new List <MatchesNewRootObject>(); likesUserIdCollection = new List <string>(); messageRootObjectCollection = new List <MessageRootObject>(); }
public async Task CardAsyncTest() { var tokens = AccountInformation.GetTokens(); var card = await tokens.Statuses.CardAsync(id => 4450025); Assert.NotNull(card); }
public void GetAccountInformation_CorrectAccountId_ReturnAccountInformation() { AccountInformation accountInformation = _accountsApi.GetAccountInformation(_testConfig.AccountId); Assert.IsNotNull(accountInformation?.AccountIdGuid); Assert.IsNotNull(accountInformation?.AccountName); Assert.IsNotNull(accountInformation?.BillingProfile); }
/// <summary> /// Called when the client is logged on. /// </summary> /// <param name="accountInformation">Information about the account.</param> /// <param name="authenticationValue"></param> public void LoggedOn(AccountInformation accountInformation, string authenticationValue) { _sender.Authenticate(authenticationValue); if(!_joinedOnce) { _sender.RequestMatch(); _joinedOnce = true; } }
public static AccountInformation GetAcountInfo(XmlNode accountInforNode) { AccountInformation accountInfor = new AccountInformation(); XmlNode accountNode = accountInforNode.ChildNodes[0]; foreach (XmlAttribute attribute in accountNode) { string nodeName = attribute.Name; string nodeValue = attribute.Value; if (nodeName == "ID") { accountInfor.AccountId = new Guid(nodeValue); continue; } else if (nodeName == "Balance") { accountInfor.Balance = decimal.Parse(nodeValue); continue; } else if (nodeName == "Equity") { accountInfor.Equity = decimal.Parse(nodeValue); continue; } else if (nodeName == "Necessary") { accountInfor.Necessary = decimal.Parse(nodeValue); continue; } } XmlNode instrumentNode = accountNode.ChildNodes[0]; accountInfor.InstrumentId = new Guid(instrumentNode.Attributes["ID"].Value); accountInfor.BuyLotBalanceSum = decimal.Parse(instrumentNode.Attributes["BuyLotBalanceSum"].Value); accountInfor.SellLotBalanceSum = decimal.Parse(instrumentNode.Attributes["SellLotBalanceSum"].Value); return accountInfor; }
public LoadUserGlobalsCommand(AccountInformation account, string moduleId, SessionInformation userSession) : base(userSession) { _moduleId = moduleId; _account = account; }