public async Task GivenValidRequestWhenAccountPostAsyncThenReturnCorrectValue() { var validRequest = new CreateAccountRequest { Id = _fixture.Create <long>(), Name = _fixture.Create <string>(), CreatedByUserId = _userId }; var account = _fixture.Create <Account>(); var accountWrapper = new AccountWrapper(account); _mapper .Map <CreateAccountRequest, Account>(validRequest) .Returns(account); _userService .CreateAccountAsync(_userId, account) .Returns(accountWrapper); var actual = await _userController.PostAsync(_userId, validRequest); (actual.Result as StatusCodeResult)? .StatusCode.Should() .Be((int)HttpStatusCode.OK); }
public static void GetValue(Stream stream, List <AccountCurrencies> temp) { var w = new AccountWrapper(); if (stream != null) { var re = new StreamReader(stream); var json = re.ReadToEnd(); w = (AccountWrapper) new JavaScriptSerializer().Deserialize(json, typeof(AccountWrapper)); } if (w == null || !w.Success) { return; } if (w.AccountCurrencies == null || w.AccountCurrencies.Length <= 0) { MessageBox.Show(w.Message); } else { MessageBox.Show(w.AccountCurrencies); //var allResults = new ObservableCollection<AccountCurrencies>(w.AccountCurrencies); //var temp2 = new ObservableCollection<AccountCurrencies>(); //foreach (var getAccountResult in allResults) //{ // temp2.Add(getAccountResult); //} //temp.AddRange(temp2); } }
public static Effect ToEffect(this AtomicEffectModel effectModel, AccountWrapper accountWrapper) { var effect = XdrConverter.Deserialize <Effect>(effectModel.RawEffect); effect.AccountWrapper = accountWrapper; return(effect); }
public bool PushAccount(AccountWrapper account) { var acct_in_queue = recently_viewed_accounts.Where(a => a.AccountCode == account.AccountCode).FirstOrDefault(); if (acct_in_queue == null) { var accounts = ""; recently_viewed_accounts.Enqueue(account); //var recent_account_nums = Properties.Settings.Default.RecentViewedAccounts.Split(',').ToList(); //recent_account_nums.Add(account.AccountCode); if (recently_viewed_accounts.Count > 10) { recently_viewed_accounts.Dequeue(); } var rec_acct_rev = recently_viewed_accounts.Reverse(); foreach (var acct in rec_acct_rev) { accounts += acct.AccountCode + ","; } Properties.Settings.Default.RecentViewedAccounts = accounts; Properties.Settings.Default.Save(); event_aggregator.GetEvent <RecentAccountServiceEvent>().Publish(recently_viewed_accounts.Count); return(true); } return(false); }
public AccountWrapper CreateAccount(int id, RawPubKey pubkey, RequestRateLimits rateLimits) { if (pubkey == null) { throw new ArgumentNullException(nameof(pubkey)); } if (accountIds.ContainsKey(pubkey)) { throw new InvalidOperationException($"Account with public key {pubkey} already exists"); } var acc = new AccountWrapper(new Account { Id = id, Pubkey = pubkey, Balances = new List <Balance>() }, rateLimits ); accountIds.Add(pubkey, id); accounts.Add(id, acc); return(acc); }
private BusinessItem Map(AccountWrapper account) { return(new BusinessItem { ItemCode = account.AccountCode, ItemName = account.AccountName, BusinessObject = account }); }
public AccountStorage(IEnumerable <AccountWrapper> accounts) { if (accounts == null) { accounts = new AccountWrapper[] { } } ; this.accounts = new Dictionary <int, AccountWrapper>(accounts.ToDictionary(m => m.Account.Id)); this.accountIds = new Dictionary <RawPubKey, int>(accounts.ToDictionary(m => m.Account.Pubkey, v => v.Account.Id)); }
public bool ReplaceAccount(string old_code, AccountWrapper account) { if (open_accounts.ContainsKey(old_code)) { open_accounts.Remove(old_code); open_accounts.Add(account.AccountCode, account); event_aggregator.GetEvent <OpenAccountServiceEvent>().Publish(open_accounts.Count); return(true); } return(false); }
public bool CloseAccount(AccountWrapper account) { if (open_accounts.ContainsValue(account)) { var key = open_accounts.FirstOrDefault(x => x.Value == account).Key; open_accounts.Remove(key); event_aggregator.GetEvent <OpenAccountServiceEvent>().Publish(open_accounts.Count); return(true); } return(false); }
private void InitNewAccount() { Account = new AccountWrapper(account_entity_service.InitNewAccount(CurrentCompanyKey)); //Client.Entities.Account _account = new Client.Entities.Account() { CompanyKey = CurrentCompanyKey }; //// Think about refactoring this out into it own method //Account = new AccountWrapper(_account); BindAddresses(); //GetAttributeList(); working_account_service.OpenAccount(Account); }
public bool OpenAccount(AccountWrapper account) { if (!open_accounts.ContainsValue(account)) { string new_key = GenAccountKey(); account.AccountCode = new_key; open_accounts.Add(new_key, account); event_aggregator.GetEvent <OpenAccountServiceEvent>().Publish(open_accounts.Count); return(true); } return(false); }
public ActionResult Edit(AccountWrapper model) { if (ModelState.IsValid) { string user = User.Identity.Name.ToString(); proxy.updateUserInfo(model.user.UserName, model.user.Companyname, model.user.BusinessCode, model.user.Phone, model.user.Mobile, model.user.CMND, model.user.Name, model.user.Age, model.user.Address, model.user.SelectedProvinceValue, model.user.SelectedDistrictValue, model.user.SelectedDetailProvincesValue, model.login.Email, model.login.roleID); return(RedirectToAction("Index")); } ViewData["Roles"] = new SelectList(proxy.getAllRoles(), "RoleId", "RoleName"); return(View(model)); }
private void InitNewAccount() { Account = new AccountWrapper(account_entity_service.InitNewAccount(CurrentCompanyKey)); //Client.Entities.Account _account = new Client.Entities.Account() { CompanyKey = CurrentCompanyKey }; //// Think about refactoring this out into it own method //Account = new AccountWrapper(_account); DefaultShippingAddress = Account.Addresses.Where(type => type.AddressType == QIQOAddressType.Shipping).FirstOrDefault(); DefaultBillingAddress = Account.Addresses.Where(type => type.AddressType == QIQOAddressType.Billing).FirstOrDefault(); DefaultMailingAddress = Account.Addresses.Where(type => type.AddressType == QIQOAddressType.Mailing).FirstOrDefault(); //GetAttributeList(); }
private void MapAccount(Client.Entities.Account _account) { if (_account != null) { _account_code_holder = _account.AccountCode; Account = new AccountWrapper(_account); AddressWrapper ship_addy = Account.Addresses.Where(type => type.AddressType == QIQOAddressType.Shipping).FirstOrDefault(); if (ship_addy != null) { DefaultShippingAddress = ship_addy; // new AddressWrapper(ship_addy); } else { DefaultShippingAddress = new AddressWrapper(new Address() { AddressType = QIQOAddressType.Shipping }); } AddressWrapper bill_addy = Account.Addresses.Where(type => type.AddressType == QIQOAddressType.Billing).FirstOrDefault(); if (bill_addy != null) { DefaultBillingAddress = bill_addy; // new AddressWrapper(bill_addy); } else { DefaultBillingAddress = new AddressWrapper(new Address() { AddressType = QIQOAddressType.Billing }); } AddressWrapper mail_addy = Account.Addresses.Where(type => type.AddressType == QIQOAddressType.Mailing).FirstOrDefault(); if (mail_addy != null) { DefaultMailingAddress = mail_addy; // new AddressWrapper(mail_addy); } else { DefaultMailingAddress = new AddressWrapper(new Address() { AddressType = QIQOAddressType.Mailing }); } } }
// // GET: /Roles/Edit/5 public ActionResult Edit(string id) { TTTV__Roles r = new TTTV__Roles(); UserLoginModel login = access.getUserLoginById(id); UserModel user = access.getUserById(id); ViewData["Roles"] = new SelectList(proxy.getAllRoles(), "RoleId", "RoleName", login.roleID); AccountWrapper wrap = new AccountWrapper() { user = user, login = login }; return(View(wrap)); }
internal static Account ToDomain(this AccountWrapper value) { return(value?.Client.ToDomain()); }
internal static Account ToDomain(this AccountWrapper value) { return(s_accountMapper.ApiToDomain(value)); }
static void Main(string[] args) { #region FUNCTION TEST CALL //clear existing data of directory DataMaintenance.Intf_clearData(); //-------------------------------------------------------------------------- int VEcusID, FScusID = 0; // Customer functions VEcusID = CustomerWrapper.Intf_createCustomer("Mike", "Thomas", "5020", "Salzburg", "Breitenfelderstrasse", 47, "13.11.1992"); CustomerWrapper.Intf_updateCustomer(VEcusID, "Mike", "Anders", "5020", "AnotherPlace", "AnotherStreet", 1111, "11.11.1111"); CustomerWrapper.Intf_deleteCustomer(VEcusID); VEcusID = CustomerWrapper.Intf_createCustomer("Betty", "Katzian", "5020", "Salzburg", "Breitenfelderstrasse", 47, "13.11.1992"); //-------------------------------------------------------------------------- // Account functions int VEaccID, FSaccID = 0; VEaccID = AccountWrapper.Intf_createAccount(0, 1000, "TestNameAcc"); //Account edit try { //interface throws notimplex bc 2nd party dll does not include this functionality AccountWrapper.Intf_editAccount(FSaccID, 1); } catch (Exception ex) { Debug.Print(ex.Message); } //Account deletion try { //interface throws notimplex bc 2nd party dll does not include this functionality AccountWrapper.Intf_deleteAccount(FSaccID); } catch (Exception ex) { Debug.Print(ex.Message); } ////create transactions for the accounts int VEaccID2, FSaccID2, VEaccID3, FSaccID3 = 0; VEaccID2 = AccountWrapper.Intf_createAccount(0, 1000, "TestNameAcc"); FSaccID2 = AccountWrapper.Intf_createAccount(0, 1000, "TestNameAcc"); VEaccID3 = AccountWrapper.Intf_createAccount(0, 1000, "TestNameAcc"); FSaccID3 = AccountWrapper.Intf_createAccount(0, 1000, "TestNameAcc"); //Attach/Dettach customer to account AccountWrapper.Intf_attachAccount(FSaccID2, FScusID); AccountWrapper.Intf_dettachAccount(FSaccID2, FScusID); AccountWrapper.Intf_attachAccount(FSaccID2, FScusID); //Creating transactions TransactionWrapper.Intf_transfer(FScusID, FSaccID2, FSaccID3, 100, 0); TransactionWrapper.Intf_deposit(FSaccID2, 500); TransactionWrapper.Intf_withdraw(FSaccID2, 500); //create a bankstatement AccountWrapper.Intf_createBankStatement(FSaccID2); TransactionWrapper.Intf_transfer(FScusID, FSaccID2, FSaccID3, 100, 0); //create a bankstatement AccountWrapper.Intf_createBankStatement(FSaccID2); #endregion DataMaintenance.Intf_clearData(); Console.WriteLine("\nThread schläft für 5 Sekunden, bitte warten!"); Thread.Sleep(5000); Console.Clear(); bool running = true; Console.WriteLine("Willkommen zum einfachen BankClient.\nIm Folgenden werden die eingebauten Kommandos und mit welcher Zahl sie aufgerufen werden können erklärt."); hilfe(); while (running) { Console.WriteLine("Bitte Zahl eingeben: "); running = eingabeAusfuehren(Console.ReadLine()); } }
public void Setup() { EnvironmentHelper.SetTestEnvironmentVariable(); var settings = new AlphaSettings { HorizonUrl = "https://horizon-testnet.stellar.org", NetworkPassphrase = "Test SDF Network ; September 2015", CWD = "AppData" }; var stellarProvider = new MockStellarDataProvider(settings.NetworkPassphrase, settings.HorizonUrl); context = new AlphaContext(settings, new MockStorage(), stellarProvider); context.Init().Wait(); var requestsLimit = new RequestRateLimits(); account1 = new AccountWrapper(new Models.Account { Id = 1, Pubkey = new RawPubKey() { Data = KeyPair.Random().PublicKey }, Balances = new List <Balance>() }, requestsLimit); account1.Account.CreateBalance(0); account1.Account.GetBalance(0).UpdateBalance(10000000000); account1.Account.CreateBalance(1); account1.Account.GetBalance(1).UpdateBalance(10000000000); account2 = new AccountWrapper(new Models.Account { Id = 2, Pubkey = new RawPubKey() { Data = KeyPair.Random().PublicKey }, Balances = new List <Balance>() }, requestsLimit); account2.Account.CreateBalance(0); account2.Account.GetBalance(0).UpdateBalance(10000000000); account2.Account.CreateBalance(1); account2.Account.GetBalance(1).UpdateBalance(10000000000); context.Setup(new Snapshot { Accounts = new List <AccountWrapper> { account1, account2 }, Apex = 0, TxCursor = 1, Orders = new List <Order>(), Settings = new ConstellationSettings { Vault = KeyPair.Random().PublicKey, Assets = new List <AssetSettings> { new AssetSettings { Id = 1, Code = "X", Issuer = new RawPubKey() } }, RequestRateLimits = new RequestRateLimits { HourLimit = 1000, MinuteLimit = 100 } }, }).Wait(); }
public static void AddNonceUpdate(this EffectProcessorsContainer effectProcessors, AccountWrapper account, long newNonce, long currentNonce) { effectProcessors.Add(new NonceUpdateEffectProcessor( new NonceUpdateEffect { Nonce = newNonce, PrevNonce = currentNonce, Account = account.Id, AccountWrapper = account, Apex = effectProcessors.Apex } )); }
static bool eingabeAusfuehren(string s) { string a = ""; int id = 0; switch (s) { case "0": //Hilfe ausgeben hilfe(); return(true); case "1": //Neuen Kunden erstellen try { Console.WriteLine("Um einen neuen Kunden anzulegen, bitte folgende Daten mit Beistrich und Leerzeichen (, ) getrennt eingeben."); Console.WriteLine("Vorname, Nachname, Ort, PLZ, Strasse, Hausnummer, Geburtstag\nEingabe: "); a = Console.ReadLine(); //Bei string.split wird auch immer das Trennzeichen in das array kopiert. id = CustomerWrapper.Intf_createCustomer(a.Split(',', ' ')[0], //Vorname a.Split(',', ' ')[2], //Nachname a.Split(',', ' ')[4], //Ort a.Split(',', ' ')[6], //PLZ a.Split(',', ' ')[8], //Strasse Int32.Parse(a.Split(',', ' ')[10]), //Hausnummer a.Split(',', ' ')[12]); //Geburtsdatum if (id >= 0) { Console.WriteLine("Deine Benutzer ID = " + id + ", diese bitte merken."); } else { Console.WriteLine("Falsche Eingaben, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "2": //Kunden bearbeiten try { Console.WriteLine("Um einen Kunden zu bearbeiten, bitte folgende Daten mit Beistrich und Leerzeichen (, ) getrennt eingeben."); Console.WriteLine("Kundennummer, Vorname, Nachname, Ort, PLZ, Strasse, Hausnummer, Geburtstag\nEingabe: "); a = Console.ReadLine(); //Bei string.split wird auch immer das Trennzeichen in das array kopiert. id = CustomerWrapper.Intf_updateCustomer(Int32.Parse(a.Split(',', ' ')[0]), //Kundennummer a.Split(',', ' ')[2], //Vorname a.Split(',', ' ')[4], //Nachname a.Split(',', ' ')[6], //Ort a.Split(',', ' ')[8], //PLZ a.Split(',', ' ')[10], //Strasse Int32.Parse(a.Split(',', ' ')[12]), //Hausnummer a.Split(',', ' ')[14]); //Geburtsdatum if (id >= 0) { Console.WriteLine("Erfolgreich geändert."); } else { Console.WriteLine("Falsche Eingaben, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "3": //Kunden löschen try { Console.WriteLine("Um einen Kunden zu löschen, bitte die Kundennummer eingeben: "); a = Console.ReadLine(); id = CustomerWrapper.Intf_deleteCustomer(Int32.Parse(a)); if (id >= 0) { Console.WriteLine("Erfolgreich gelöscht."); } else { Console.WriteLine("Falsche Eingaben, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "4": //Konto erstellen try { Console.WriteLine("Um ein neues Konto zu erstellen, bitte folgende Daten mit Beistrich und Leerzeichen (, ) getrennt eingeben."); Console.WriteLine("Kontotyp(0 = Spar, 1 = Kredit), Anfangsstand, Name des Kontos.\nEingabe: "); a = Console.ReadLine(); id = AccountWrapper.Intf_createAccount(Int32.Parse(a.Split(',', ' ')[0]), Double.Parse(a.Split(',', ' ')[2]), a.Split(',', ' ')[4]); if (id >= 0) { Console.WriteLine("Erfolgreich erstellt. Kontonummer = " + id + ", bitte merken."); } else { Console.WriteLine("Falsche Eingaben, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "5": //Konto bearbeiten try { Console.WriteLine("Um ein Konto zu bearbeiten, bitte folgende Daten mit Beistrich und Leerzeichen (, ) getrennt eingeben."); Console.WriteLine("Kontonummer, Kontotyp(0 = Spar, 1 = Kredit)\nEingabe: "); a = Console.ReadLine(); id = AccountWrapper.Intf_editAccount(Int32.Parse(a.Split(',', ' ')[0]), Int32.Parse(a.Split(',', ' ')[2])); if (id >= 0) { Console.WriteLine("Erfolgreich bearbeitet."); } else { Console.WriteLine("Falsche Eingaben, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "6": //Konto löschen try { Console.WriteLine("Um ein Konto zu löschen, bitte die Kontonummer eingeben: "); a = Console.ReadLine(); id = AccountWrapper.Intf_deleteAccount(Int32.Parse(a)); if (id >= 0) { Console.WriteLine("Erfolgreich gelöscht."); } else { Console.WriteLine("Falsche Eingaben, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "7": //Kontoauszug erstellen try { Console.WriteLine("Um einen Kontoauszug zu erstellen, bitte die Kontonummer eingeben: "); a = Console.ReadLine(); id = AccountWrapper.Intf_createBankStatement(Int32.Parse(a)); if (id >= 0) { Console.WriteLine("Erfolgreich erstellt."); } else { Console.WriteLine("Falsche Eingaben, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "8": //Neue Ueberweisung try { //Die Überweisung braucht auch einen zum Konto zugewiesenen Kunden. Console.WriteLine("Um eine neue Ueberweisung durchzuführen, bitte folgende Daten mit Beistrich und Leerzeichen (, ) getrennt eingeben."); Console.WriteLine("Kundenummer (der die Ueberweisung startet), Von Kontonummer, zu Kontonummer, Betrag, in Waehrung(EUR = 0, USD = 1, GBP = 2, INR = 3, JPY = 4)\nEingabe: "); a = Console.ReadLine(); AccountWrapper.Intf_attachAccount(Int32.Parse(a.Split(',', ' ')[2]), Int32.Parse(a.Split(',', ' ')[0])); id = TransactionWrapper.Intf_transfer(Int32.Parse(a.Split(',', ' ')[0]), Int32.Parse(a.Split(',', ' ')[2]), Int32.Parse(a.Split(',', ' ')[4]), float.Parse(a.Split(',', ' ')[6]), Int32.Parse(a.Split(',', ' ')[8])); if (id >= 0) { Console.WriteLine("Erfolgreich ueberwiesen."); } else { Console.WriteLine("Falsche Eingaben bei der Ueberweisung, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "9": //Einzahlen try { Console.WriteLine("Um etwas auf einem Konto einzuzahlen, bitte folgende Daten mit Beistrich und Leerzeichen (, ) getrennt eingeben."); Console.WriteLine("Kontonummer, Betrag\nEingabe: "); a = Console.ReadLine(); id = TransactionWrapper.Intf_deposit(Int32.Parse(a.Split(',', ' ')[0]), float.Parse(a.Split(',', ' ')[2])); if (id >= 0) { Console.WriteLine("Erfolgreich eingezahlt."); } else { Console.WriteLine("Falsche Eingaben, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "10": //Abheben try { Console.WriteLine("Um etwas von einem Konto abzuheben, bitte folgende Daten mit Beistrich und Leerzeichen (, ) getrennt eingeben."); Console.WriteLine("Kontonummer, Betrag\nEingabe: "); a = Console.ReadLine(); id = TransactionWrapper.Intf_withdraw(Int32.Parse(a.Split(',', ' ')[0]), float.Parse(a.Split(',', ' ')[2])); if (id >= 0) { Console.WriteLine("Erfolgreich abgehoben."); } else { Console.WriteLine("Falsche Eingaben, bitte wiederholen."); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "11": //Wartungsaufgaben try { Console.WriteLine("Räumt nun alle Daten auf. Alles wird gelöscht. Bitte mit \"ja\" bestätigen."); a = Console.ReadLine(); if (a.Equals("ja")) { DataMaintenance.Intf_clearData(); } } catch (Exception e) { Console.WriteLine("Error: " + e.Message); } return(true); case "exit": return(false); default: hilfe(); return(true); } }
public static void AddBalanceUpdate(this EffectProcessorsContainer effectProcessors, AccountWrapper account, int asset, long amount) { effectProcessors.Add(new BalanceUpdateEffectProcesor( new BalanceUpdateEffect { Account = account.Id, AccountWrapper = account, Amount = amount, Asset = asset, Apex = effectProcessors.Apex } )); }
public IEnumerable <Order> GetAllAccountOrders(AccountWrapper account) { return(map.Values.Where(o => o.AccountWrapper == account)); }
public void Setup() { EnvironmentHelper.SetTestEnvironmentVariable(); var settings = new AlphaSettings { HorizonUrl = "https://horizon-testnet.stellar.org", NetworkPassphrase = "Test SDF Network ; September 2015", CWD = "AppData" }; Global.Setup(settings, new MockStorage()).Wait(); var account1 = new Models.Account() { Id = 1, Pubkey = new RawPubKey() { Data = KeyPair.Random().PublicKey }, Balances = new List <Balance>() }; account1.CreateBalance(0); account1.GetBalance(0).UpdateBalance(10000000000); account1.CreateBalance(1); account1.GetBalance(1).UpdateBalance(10000000000); var account2 = new Models.Account() { Id = 2, Pubkey = new RawPubKey() { Data = KeyPair.Random().PublicKey }, Balances = new List <Balance>() }; account2.CreateBalance(0); account2.GetBalance(0).UpdateBalance(10000000000); account2.CreateBalance(1); account2.GetBalance(1).UpdateBalance(10000000000); Global.Setup(new Snapshot { Accounts = new List <Models.Account> { account1, account2 }, Apex = 0, TxCursor = 1, Orders = new List <Order>(), Settings = new ConstellationSettings { Vault = KeyPair.Random().PublicKey, Assets = new List <AssetSettings> { new AssetSettings { Id = 1, Code = "X", Issuer = new RawPubKey() } }, RequestRateLimits = new RequestRateLimits { HourLimit = 1000, MinuteLimit = 100 } }, }).Wait(); this.account1 = Global.AccountStorage.GetAccount(account1.Id); this.account2 = Global.AccountStorage.GetAccount(account2.Id); }
public Account ApiToDomain(AccountWrapper value) { return(ApiToDomain(value?.Client)); }