public static int GetAddressID(int addressType, int id) { int addressID = 0; AccountAddress accountAddress = new AccountAddress(); MyDBConnection myConn = new MyDBConnection(); SqlConnection conn = new SqlConnection(); SqlDataReader dr; SqlCommand cmd = null; string sql = "Select addressid from AquaOne.dbo.AccountAddress where AccountID = @AccountID and AddressType = @AddressType"; // Open the connection conn = myConn.OpenDB(); cmd = new SqlCommand(sql, conn); cmd.Parameters.Add("@AccountID", SqlDbType.Int).Value = id; cmd.Parameters.Add("@AddressType", SqlDbType.Int).Value = addressType; dr = cmd.ExecuteReader(); if (dr.Read()) { addressID = dr.GetInt32(0); // accountAddress = FillDataRecord(dr); } cmd.Dispose(); //close the connection myConn.CloseDB(conn); return(addressID); }
private void LimpiarCampos() { Record = new AccountAddress(); //View.Nombre.Text = View.Direccion.Text = View.Direccion2.Text = View.Direccion3.Text = ""; //View.Ciudad.Text = View.Estado.Text = View.CodigoPostal.Text = View.Pais.Text = ""; //View.PersonaContacto.Text = View.Telefono.Text = View.Telefono2.Text = View.Telefono3.Text = ""; }
public static int AddAccountAddress(AccountAddress newAccountAddress) { int result; MyDBConnection dbconn = new MyDBConnection(); SqlConnection conn = new SqlConnection(); try { conn = dbconn.OpenDB(); SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "dbo.AddAccountAddress"; cmd.Parameters.Add("@AccountID", SqlDbType.Int).Value = newAccountAddress.AccountID; cmd.Parameters.Add("@AddressID", SqlDbType.Int).Value = newAccountAddress.AddressID; cmd.Parameters.Add("@AddressType", SqlDbType.Int).Value = newAccountAddress.AddressType; cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value = newAccountAddress.CreatedDate; cmd.Parameters.Add("@ModifiedDate", SqlDbType.DateTime).Value = newAccountAddress.ModifiedDate; cmd.Parameters.Add("@CreatedBy", SqlDbType.VarChar).Value = newAccountAddress.CreatedBy; cmd.Parameters.Add("@ModifiedBy", SqlDbType.VarChar).Value = newAccountAddress.ModifiedBy; result = cmd.ExecuteNonQuery(); } finally { dbconn.CloseDB(conn); } return(result); }
public static void Main() { StructTag tag = new StructTag( AccountAddress.valueOf(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }), new Identifier("XDX"), new Identifier("XDX"), new ValueArray <TypeTag>(new List <TypeTag>().ToArray()) ); TypeTag token = new TypeTag.Struct(tag); AccountAddress payee = AccountAddress.valueOf( new byte[] { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22 }); ulong amount = 1234567; Script script = Helpers.encode_peer_to_peer_with_metadata_script( token, payee, amount, new ValueArray <byte>(new List <byte>().ToArray()), new ValueArray <byte>(new List <byte>().ToArray()) ); ScriptCall.PeerToPeerWithMetadata call = (ScriptCall.PeerToPeerWithMetadata)Helpers.DecodeScript(script); Debug.Assert(call.amount.Equals(amount), string.Format("call.amount is {0}. Expecting {1}", call.amount, amount)); Debug.Assert(call.payee.Equals(payee), string.Format("call.payee is {0}. Expecting {1}", call.payee, payee)); byte[] output = script.BcsSerialize(); foreach (byte o in output) { Console.Write(((int)o & 0xFF) + " "); } Console.WriteLine(); }
/// <summary> /// Метод пытается изменить юридический адрес у клиента /// </summary> /// <param name="addressViewModel"></param> /// <param name="errors"></param> /// <returns></returns> public bool TryChangeLegalAddress(AccountAddressViewModel addressViewModel, out Dictionary <string, string> errors) { errors = new Dictionary <string, string>(); if (!TryGetItemById(addressViewModel.AccountId, out Account account)) { if (!errors.ContainsKey("RecordNotFound")) { errors.Add("RecordNotFound", resManager.GetString("RecordNotFound")); } return(false); } errors = validator.ChangeLegalAddressCheck(addressViewModel, account); if (errors.Any()) { return(false); } AccountAddress oldLegalAddress = account.GetAddresses(context).FirstOrDefault(addr => addr.AddressType == AddressType.Legal); oldLegalAddress.AddressType = (AddressType)Enum.Parse(typeof(AddressType), addressViewModel.CurrentAddressNewType); AccountAddress newLegalAddress = context.AccountAddresses.FirstOrDefault(i => i.Id == Guid.Parse(addressViewModel.NewLegalAddressId)); newLegalAddress.AddressType = AddressType.Legal; context.AccountAddresses.UpdateRange(oldLegalAddress, newLegalAddress); context.SaveChanges(); return(true); }
/// <inheritdoc /> public Task SaveStartRoundAsync(GameRoundId gameRoundId, EthereumNetwork network, AccountAddress createdByAccount, ContractAddress gameManagerContract, ContractAddress gameContract, Seed seedCommit, Seed seedReveal, TimeSpan roundDuration, TimeSpan bettingCloseDuration, TimeSpan roundTimeoutDuration, BlockNumber blockNumberCreated, TransactionHash transactionHash) { return(this._database.ExecuteAsync(storedProcedure: @"Games.GameRound_Insert", new { GameRoundId = gameRoundId, GameManagerContract = gameManagerContract, GameContract = gameContract, CreatedByAccount = createdByAccount, Network = network.Name, BlockNumberCreated = blockNumberCreated, SeedCommit = seedCommit, SeedReveal = seedReveal, BettingCloseDuration = bettingCloseDuration.TotalSeconds, RoundDuration = roundDuration.TotalSeconds, RoundTimeoutDuration = roundTimeoutDuration.TotalSeconds, TransactionHash = transactionHash })); }
public static int AddAccountAddress(AccountAddress newAccountAddress) { int result; result = AccountAddressDB.AddAccountAddress(newAccountAddress); return(result); }
/// <summary> /// Constructor. /// </summary> /// <param name="gameRoundId">The game round id</param> /// <param name="createdByAccount">The account that created the game.</param> /// <param name="network">The network.</param> /// <param name="gameManagerContract">The game manager contract.</param> /// <param name="gameContract">The game network contract</param> /// <param name="seedCommit">The commit seed</param> /// <param name="seedReveal">The reveal seed</param> /// <param name="status">Status of game round</param> /// <param name="roundDuration">Round duration in seconds.</param> /// <param name="bettingCloseDuration">Duration of how long the betting close period is in seconds.</param> /// <param name="roundTimeoutDuration">Round timeout duration in seconds.</param> /// <param name="dateCreated">The date/time the round was created (transaction submitted)</param> /// <param name="dateUpdated">The date/time the round last updated</param> /// <param name="dateStarted">The date/time the round was activated (mined)</param> /// <param name="dateClosed">The date/time the round was closed.</param> /// <param name="blockNumberCreated">The block number the round was activated.</param> public GameRound(GameRoundId gameRoundId, AccountAddress createdByAccount, EthereumNetwork network, ContractAddress gameManagerContract, ContractAddress gameContract, Seed seedCommit, Seed seedReveal, GameRoundStatus status, TimeSpan roundDuration, TimeSpan bettingCloseDuration, TimeSpan roundTimeoutDuration, DateTime dateCreated, DateTime dateUpdated, DateTime?dateStarted, DateTime?dateClosed, BlockNumber blockNumberCreated) { this.GameRoundId = gameRoundId ?? throw new ArgumentNullException(nameof(gameRoundId)); this.CreatedByAccount = createdByAccount ?? throw new ArgumentNullException(nameof(createdByAccount)); this.Network = network ?? throw new ArgumentNullException(nameof(network)); this.GameManagerContract = gameManagerContract ?? throw new ArgumentNullException(nameof(gameManagerContract)); this.GameContract = gameContract ?? throw new ArgumentNullException(nameof(gameContract)); this.SeedCommit = seedCommit ?? throw new ArgumentNullException(nameof(seedCommit)); this.SeedReveal = seedReveal ?? throw new ArgumentNullException(nameof(seedReveal)); this.Status = status; this.RoundDuration = roundDuration; this.BettingCloseDuration = bettingCloseDuration; this.RoundTimeoutDuration = roundTimeoutDuration; this.DateCreated = dateCreated; this.DateUpdated = dateUpdated; this.DateStarted = dateStarted; this.DateClosed = dateClosed; this.BlockNumberCreated = blockNumberCreated; }
public static string GetDescriptionByID(int locationID) { string description = ""; AccountAddress accountAddress = new AccountAddress(); MyDBConnection myConn = new MyDBConnection(); SqlConnection conn = new SqlConnection(); SqlDataReader dr; SqlCommand cmd = null; string sql = "Select description from AquaOne.dbo.Ref_WaterSourceLocation where LocationID = @LocationID"; // Open the connection conn = myConn.OpenDB(); cmd = new SqlCommand(sql, conn); cmd.Parameters.Add("@LocationID", SqlDbType.Int).Value = locationID; dr = cmd.ExecuteReader(); if (dr.Read()) { description = dr.GetString(0); } cmd.Dispose(); //close the connection myConn.CloseDB(conn); return(description); }
private async void LoginButton_OnClick(object sender, RoutedEventArgs e) { if (AccountAddress.Text != "" && AccountPassword.Password != "") { AccountAddress.IsEnabled = false; AccountPassword.IsEnabled = false; LoginButton.IsEnabled = false; string username = AccountAddress.Text; string password = AccountPassword.Password; if (await DropAccount.Login(username, password)) { DialogResult = true; } else { AccountAddress.Clear(); AccountPassword.Clear(); } AccountAddress.IsEnabled = true; AccountPassword.IsEnabled = true; LoginButton.IsEnabled = true; } else { MessageBox.Show("Заполните все поля!", "Внимание", MessageBoxButton.OK, MessageBoxImage.Warning); } }
public AccountAddress SaveAccountAddress(AccountAddress a) { if (a.ID != 0) { return(new AccountAddressRepository().SaveOrUpdate(a)); } return(new AccountAddressRepository().Save(a)); }
/// <summary> /// Constructor. /// </summary> /// <param name="to">The address the funds were sent to.</param> /// <param name="amount">The amount that was sent.</param> public WithdrawalOutput([EventOutputParameter(ethereumDataType: "address", order: 1, indexed: false)] AccountAddress to, [EventOutputParameter(ethereumDataType: "uint256", order: 2, indexed: false)] DataTypes.Primitives.Token amount) { this.To = to ?? throw new ArgumentNullException(nameof(to)); this.Amount = amount ?? throw new ArgumentNullException(nameof(amount)); }
public void CRUD_Test() { var repositoryContext = new RepositoryContext(); Account testAccount = TestEntities.GetTestAccount( 1, Guid.Parse("F341B4FB-4CC3-4FDB-B7CF-8DCD45365341"), "AccAddr"); try { // delete test account TestDataCleaner.DeleteTestAccount(repositoryContext, testAccount.AccountId); // create account repositoryContext.AccountRepository.Upsert(testAccount); // create AccountAddress expectedAccountAddress = TestEntities.GetTestAccountAddress(1, testAccount.AccountId); repositoryContext.AccountAddressRepository.Upsert(expectedAccountAddress); // read AccountAddress actualAccountAddress = repositoryContext.AccountAddressRepository.Get(expectedAccountAddress.AccountId); Assert.NotNull(actualAccountAddress); Assert.True(EntityComparer.AreAccountAddressEqual(expectedAccountAddress, actualAccountAddress)); // update AccountAddress expectedAccountAddressNew = TestEntities.GetTestAccountAddress( 2, expectedAccountAddress.AccountId); repositoryContext.AccountAddressRepository.Upsert(expectedAccountAddressNew); Assert.AreEqual(expectedAccountAddress.AccountId, expectedAccountAddressNew.AccountId); AccountAddress actualAccountAddressNew = repositoryContext.AccountAddressRepository.Get(expectedAccountAddressNew.AccountId); Assert.NotNull(actualAccountAddressNew); Assert.True( EntityComparer.AreAccountAddressEqual(expectedAccountAddressNew, actualAccountAddressNew)); // delete repositoryContext.AccountRepository.Delete(expectedAccountAddress.AccountId); // read by id actualAccountAddress = repositoryContext.AccountAddressRepository.Get(expectedAccountAddress.AccountId); Assert.Null(actualAccountAddress); } finally { // delete test account TestDataCleaner.DeleteTestAccount(repositoryContext, testAccount.AccountId); repositoryContext.Dispose(); } }
private IList <AccountAddress> GetCustomerAddress(Account account, string personId) { AccountAddress tmpData; IList <AccountAddress> list = new List <AccountAddress>(); Status lineStatus = WType.GetStatus(new Status { StatusID = EntityStatus.Active }); try { Command.Connection = new SqlConnection(CurCompany.ErpConnection.CnnString); Query = GetErpQuery("CUSTOMER_ADDRESS").Replace("__ACCOUNT", personId); ds = ReturnDataSet(Query, "", "t015_mm_contactos", Command.Connection); if (ds == null || ds.Tables.Count == 0) { return(null); } foreach (DataRow dr in ds.Tables[0].Rows) { tmpData = new AccountAddress(); tmpData.Account = account; tmpData.Name = dr["f201_descripcion_sucursal"].ToString(); tmpData.ErpCode = dr["f201_id_sucursal"].ToString(); tmpData.AddressLine1 = dr["f015_direccion1"].ToString(); tmpData.AddressLine2 = dr["f015_direccion2"].ToString(); tmpData.AddressLine3 = dr["f015_direccion3"].ToString(); tmpData.City = dr["city"].ToString(); tmpData.State = dr["dpto"].ToString(); tmpData.ZipCode = dr["f015_cod_postal"].ToString(); tmpData.Country = dr["pais"].ToString(); tmpData.Phone1 = dr["f015_telefono"].ToString(); //tmpData.Phone2 = dr["PHNUMBR2"].ToString(); //tmpData.Phone3 = dr["FAXNUMBR"].ToString(); tmpData.Email = dr["f015_email"].ToString(); tmpData.Status = lineStatus; tmpData.IsMain = false; tmpData.ContactPerson = account.ContactPerson; tmpData.CreationDate = DateTime.Now; tmpData.CreatedBy = WmsSetupValues.SystemUser; tmpData.IsFromErp = true; list.Add(tmpData); } return(list); } catch (Exception ex) { ExceptionMngr.WriteEvent("GetCustomerAddress", ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpConnection); //throw; return(null); } }
internal void LoadAddresses(Account account) { Account = account; Record = new AccountAddress(); RecordList = service.GetAccountAddress(new AccountAddress { Account = new Account { AccountID = account.AccountID } }); }
private static AccountAddress FillDataRecord(IDataRecord dr) { AccountAddress accountAddress = new AccountAddress(); accountAddress.AddressID = dr.GetInt32(dr.GetOrdinal("AddressID")); accountAddress.AccountID = dr.GetInt32(dr.GetOrdinal("AccountID")); accountAddress.AddressType = dr.GetInt32(dr.GetOrdinal("AddressType")); return(accountAddress); }
public void TestCrud() { Account acct = new Account(); AccountAddress addr = new AccountAddress(); Country c = new Country(); State s = new State(); try { c.Name = GetNewString(); Session.Save(c); s.Name = GetNewString(); s.Country = c; Session.Save(s); acct.Created = acct.LastLogin = acct.Modified = DateTime.UtcNow; acct.Name = "Test User"; acct.Password = "******"; acct.Birthday = new DateTime(1976, 9, 7); acct.Enabled = false; Session.Save(acct); addr.Account = acct; addr.Apt = "6G"; addr.City = "New York"; addr.Created = addr.Modified = DateTime.UtcNow; addr.Country = c; addr.State = s; addr.Street = "89 Bleecker St."; addr.Zip = "10012-1234"; if (acct.AccountAddresses == null) { acct.AccountAddresses = new List <AccountAddress>(); } acct.AccountAddresses.Add(addr); Session.Save(addr); Session.Flush(); Assert.IsTrue(addr.Id > 0); Assert.IsTrue(acct.Id > 0); } finally { Session.Delete(acct); Session.Delete(s); Session.Delete(c); Session.Flush(); } }
public IList <AccountAddress> Select(AccountAddress data) { IList <AccountAddress> datos = new List <AccountAddress>(); datos = GetHsql(data).List <AccountAddress>(); if (!Factory.IsTransactional) { Factory.Commit(); } return(datos); }
public async Task <string> ApplyWithdrawal(string currency, decimal amount, AccountAddress address) { var dict = address.ToDict(); dict.Add("currency", currency); dict.Add("amount", amount.ToString()); var jobj = await MakeRequest(HttpMethod.Post, "/api/v1/withdrawals", reqParams : dict); return(jobj["withdrawalId"].ToObject <string>()); }
/// <summary> /// Constructor. /// </summary> /// <param name="from">Sender of the funds.</param> /// <param name="to">Recipient of the distribution.</param> /// <param name="amount">The amount that was sent.</param> public DistributionOutput([EventOutputParameter(ethereumDataType: @"address", order: 1, indexed: false)] AccountAddress from, [EventOutputParameter(ethereumDataType: @"address", order: 2, indexed: false)] AccountAddress to, [EventOutputParameter(ethereumDataType: @"uint256", order: 3, indexed: false)] DataTypes.Primitives.Token amount) { this.From = from ?? throw new ArgumentNullException(nameof(from)); this.To = to ?? throw new ArgumentNullException(nameof(to)); this.Amount = amount ?? throw new ArgumentNullException(nameof(amount)); }
public Task SendMessageAsync(string message) { AccountAddress accountAddress = this.JwtUser() .AccountAddress; if (!this._rateLimiter.ShouldLimit(this.Context)) { return(this.Clients.All.NewMessage(accountAddress: accountAddress, message: message)); } return(Task.CompletedTask); }
public void TestCrud() { Account acct = new Account(); AccountAddress addr = new AccountAddress(); Country c = new Country(); State s = new State(); try { c.Name = GetNewString(); Session.Save(c); s.Name = GetNewString(); s.Country = c; Session.Save(s); acct.Created = acct.LastLogin = acct.Modified = DateTime.UtcNow; acct.Name = "Test User"; acct.Password = "******"; acct.Birthday = new DateTime(1976, 9, 7); acct.Enabled = false; Session.Save(acct); addr.Account = acct; addr.Apt = "6G"; addr.City = "New York"; addr.Created = addr.Modified = DateTime.UtcNow; addr.Country = c; addr.State = s; addr.Street = "89 Bleecker St."; addr.Zip = "10012-1234"; if (acct.AccountAddresses == null) acct.AccountAddresses = new List<AccountAddress>(); acct.AccountAddresses.Add(addr); Session.Save(addr); Session.Flush(); Assert.IsTrue(addr.Id > 0); Assert.IsTrue(acct.Id > 0); } finally { Session.Delete(acct); Session.Delete(s); Session.Delete(c); Session.Flush(); } }
public static string GetFullAddress(this AccountAddress address, User currentUser) { return(new StringBuilder() .Append(address.Country).Append(", ") .Append(GetLocationPrefix(REGION_KEY, currentUser?.DefaultLanguage)).Append(" ") .Append(address.Region).Append(", ") .Append(GetLocationPrefix(CITY_KEY, currentUser?.DefaultLanguage)).Append(" ") .Append(address.City).Append(", ") .Append(GetLocationPrefix(STREET_KEY, currentUser?.DefaultLanguage)).Append(" ") .Append(address.Street).Append(", ") .Append(GetLocationPrefix(HOUSE_KEY, currentUser?.DefaultLanguage)).Append(" ") .Append(address.House) .ToString()); }
/// <inheritdoc /> public async Task <int> UpsertAsync(AccountAddress accountAddress) { if (GetAsync(accountAddress.AccountId) == null) { UserContext.AccountAddress .Add(accountAddress); } else { UserContext.AccountAddress .Update(accountAddress); } return(await UserContext.SaveChangesAsync()); }
/// <summary> /// Compare account addresses. /// </summary> /// <param name="accountAddress1">AccountAddress1</param> /// <param name="accountAddress2">AccountAddress2</param> /// <returns>Bool.</returns> public static bool AreAccountAddressEqual( AccountAddress accountAddress1, AccountAddress accountAddress2) { return(accountAddress1.AccountId == accountAddress2.AccountId && accountAddress1.AddressType == accountAddress2.AddressType && accountAddress1.AddressLine1 == accountAddress2.AddressLine1 && accountAddress1.AddressLine2 == accountAddress2.AddressLine2 && accountAddress1.AddressLine3 == accountAddress2.AddressLine3 && accountAddress1.City == accountAddress2.City && accountAddress1.County == accountAddress2.County && accountAddress1.StateProvince == accountAddress2.StateProvince && accountAddress1.PostalCode == accountAddress2.PostalCode && accountAddress1.CountryTwoLetterCode == accountAddress2.CountryTwoLetterCode); }
/// <inheritdoc /> public int Upsert(AccountAddress accountAddress) { if (Get(accountAddress.AccountId) == null) { UserContext.AccountAddress .Add(accountAddress); } else { UserContext.AccountAddress .Update(accountAddress); } return(UserContext.SaveChanges()); }
public override Dictionary <string, string> DeleteCheck(Guid id) { AccountAddress accountAddress = context.AccountAddresses.FirstOrDefault(i => i.Id == id); if (accountAddress == null) { errors.Add("AccountAddressNotFound", resManager.GetString("AccountAddressNotFound")); return(errors); } if (accountAddress.AddressType == AddressType.Legal) { errors.Add("PrimaryAddressIsReadonly", resManager.GetString("PrimaryAddressIsReadonly")); } return(errors); }
private IList <AccountAddress> GetCustomerAddress(Account account, DataRow[] dLines) { AccountAddress tmpData; IList <AccountAddress> list = new List <AccountAddress>(); Status lineStatus = WType.GetStatus(new Status { StatusID = EntityStatus.Active }); try { foreach (DataRow dr in dLines) { tmpData = new AccountAddress(); tmpData.Account = account; tmpData.Name = dr["ADRSCODE"].ToString(); //dr["CNTCPRSN"].ToString(); tmpData.ErpCode = dr["ADRSCODE"].ToString(); tmpData.AddressLine1 = dr["ADDRESS1"].ToString(); tmpData.AddressLine2 = dr["ADDRESS2"].ToString(); tmpData.AddressLine3 = dr["ADDRESS3"].ToString(); tmpData.City = dr["CITY"].ToString(); tmpData.State = dr["STATE"].ToString(); tmpData.ZipCode = dr["ZIP"].ToString(); tmpData.Country = dr["COUNTRY"].ToString(); tmpData.Phone1 = dr["PHONE1"].ToString(); tmpData.Phone2 = dr["PHONE2"].ToString(); tmpData.Phone3 = dr["FAX"].ToString(); try { tmpData.Email = dr["Internet_Address"].ToString(); } catch { } tmpData.Status = lineStatus; tmpData.IsMain = false; tmpData.ContactPerson = dr["CNTCPRSN"].ToString(); tmpData.CreationDate = DateTime.Now; tmpData.CreatedBy = WmsSetupValues.SystemUser; tmpData.IsFromErp = true; list.Add(tmpData); } return(list); } catch (Exception ex) { ExceptionMngr.WriteEvent("GetCustomerAddress", ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.ErpConnection); //throw; return(null); } }
/// <summary> /// This method returns the account address information for the given account. /// </summary> /// <param name="accountNumber13"></param> /// <returns></returns> public AccountAddress InquireServiceAddress( [RequiredItem()][StringLength(13, 13)] [CustomerAccountNumber()] string accountNumber13) { BillingLogEntry logEntry = new BillingLogEntry( eBillingActivityType.AccountAddress, accountNumber13.PadLeft(16, '0')); using (Log log = CreateLog(logEntry)) { try { // validate the parameters. MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(), accountNumber13); validator.Validate(); // convert the accountNumber. CustomerAccountNumber accountNumber = (CustomerAccountNumber)TypeDescriptor.GetConverter( typeof(CustomerAccountNumber)).ConvertFrom(accountNumber13); // setup site information. PopulateSiteInfo(accountNumber); logEntry.SiteId = SiteId; // setup the return AccountAddress accountAddress = new AccountAddress(); AccountAdapter adapter = new AccountAdapter(accountNumber, _userName, _siteId, _siteCode); adapter.Fill(accountAddress); return(accountAddress); } catch (ValidationException ve) { logEntry.SetError(new ExceptionFormatter(ve).Format()); throw; } catch (BusinessLogicLayerException blle) { logEntry.SetError(new ExceptionFormatter(blle).Format()); throw; } catch (Exception e) { logEntry.SetError(new ExceptionFormatter(e).Format()); throw new UnexpectedSystemException(e); } } }
public async Task <ActionResult> Register(RegisterViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var developer = new Developer { CostPerHour = "25" }; var address = new AccountAddress { Street = model.Street, City = model.City, PhoneNumber = model.PhoneNumber, Country = model.Country, IsMainAdress = model.IsMainAddress }; var user = new Account { FirstName = model.FirstName, LastName = model.LastName, UserName = model.Email, Email = model.Email, IsActive = true, IsEnabled = true, RegisterDate = DateTime.Now, Developer = developer, AccountAdress = address }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); return(RedirectToAction("Index", "Home")); } AddErrors(result); return(View(model)); }
public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state) { state.TryGet("public_key", out string publicKey); state.TryGet("secret", out IList <byte> secret); state.TryGet("local_password", out IList <byte> localPassword); state.TryGet("address", out string address); state.TryGet("amount", out long amount); state.TryGet("comment", out string comment); IList <byte> message; if (string.IsNullOrEmpty(comment)) { message = new byte[0]; } else { message = Encoding.UTF8.GetBytes(comment.Substring(0, Math.Min(128, comment.Length))); } var sender = TonService.Execute(new WalletGetAccountAddress(new WalletInitialAccountState(publicKey))) as AccountAddress; var recipient = new AccountAddress(address); var privateKey = new InputKeyRegular(new Key(publicKey, secret), localPassword); var response = await TonService.SendAsync(new GenericSendGrams(privateKey, sender, recipient, amount, 0, true, message)); if (response is SendGramsResult result) { var parameters = new Dictionary <string, object> { { "amount", amount } }; NavigationService.Navigate(typeof(WalletInfoPage), WalletInfoState.Sent, parameters); } else if (response is Error error) { await TLMessageDialog.ShowAsync(error.Message, error.Code.ToString(), Strings.Resources.OK); } }
public AccountAddress SaveAccountAddress(AccountAddress data) { try { SetService(); return SerClient.SaveAccountAddress(data); } finally { SerClient.Close(); if (SerClient.State == CommunicationState.Faulted) SerClient.Abort(); } }
public void DeleteAccountAddress(AccountAddress data) { try { SetService(); SerClient.DeleteAccountAddress(data); } finally { SerClient.Close(); if (SerClient.State == CommunicationState.Faulted) SerClient.Abort(); } }