public AccountHolder(IAccountHolder acctHolder) { Id = acctHolder.Id; UserName = acctHolder.UserName; Password = acctHolder.Password; FirstName = acctHolder.FirstName; MiddleNames = acctHolder.MiddleNames; LastName = acctHolder.LastName; BusinessName = acctHolder.BusinessName; DisplayName = acctHolder.DisplayName; AvailableCommands = acctHolder.AvailableCommands; injectedHolder = acctHolder; }
public Account(IAccountHolder owner, double penaltyPrice, double startingBalance, Currency currency) { if (startingBalance < 0d) throw new ArgumentOutOfRangeException( string.Format( "Error encountered while creating new account for {0}. Cannot have a negative starting balance.", owner.DisplayName)); Id = Guid.NewGuid(); LocalCurrency = currency; Balance = new Money(0d, LocalCurrency); Owner = new AccountHolder(owner); negativeBalancePenalty = new Money(penaltyPrice, LocalCurrency); TransactionHistory = new List<Transaction>(); Transaction createdAccount = new Transaction("Account Creation", new Money(startingBalance, LocalCurrency), TransactionTypes.Initialization); this.PerformTransaction(createdAccount); }
public static DataSet GetAccountHolders(int accountID) { IAccountHolder[] listAH = null; IDalSession session = NHSessionFactory.CreateSession(); IAccountTypeInternal account = (IAccountTypeInternal)AccountMapper.GetAccount(session, accountID); if (account != null) { //IRemisierCollection remisierColl = assetManager.Remisiers; // IRemisier[] remList = new IRemisier[remisierColl.Count]; // remisierColl.CopyTo(remList, 0); IAccountHolderCollection collAH = (IAccountHolderCollection)account.AccountHolders; listAH = new IAccountHolder[collAH.Count]; collAH.CopyTo(listAH, 0); } DataSet ds = DataSetBuilder.CreateDataSetFromBusinessObjectList(listAH, "Contact.ContactsNAWs.Current.Name, Contact.Key"); session.Close(); return ds; }
public static void Update(IDalSession session, IAccountHolder obj) { session.Update(obj); }
public static void Insert(IDalSession session, IAccountHolder obj) { session.Insert(obj); }
public static void Delete(IDalSession session, IAccountHolder obj) { session.Delete(obj); }
public void save(IAccountHolder account_holder) { session.save(account_holder); }
public static DataSet GetContactAccountHolders(int contactID) { IDalSession session = null; DataSet ds = null; session = NHSessionFactory.CreateSession(); IContact contact = ContactMapper.GetContact(session, contactID); if (contact != null) { IContactAccountHoldersCollection ahColl = contact.AccountHolders; IAccountHolder[] ahList = new IAccountHolder[ahColl.Count]; ahColl.CopyTo(ahList, 0); ds = DataSetBuilder.CreateDataSetFromBusinessObjectList( ahList, "GiroAccount.Key, GiroAccount.Number, GiroAccount.ShortName"); } session.Close(); return ds; }
public static DataSet GetFirstOfCollectionAccountHolder(int accountID) { DataSet ds = null; if (accountID != 0) { IDalSession session = NHSessionFactory.CreateSession(); IAccount account = AccountMapper.GetAccount(session, accountID); if (account.AccountType == AccountTypes.Customer) { ICustomerAccount acc = (ICustomerAccount)account; if (acc != null && acc.AccountHolders != null && acc.AccountHolders.Count > 0) { IAccountHolder[] listAH = new IAccountHolder[1]; listAH[0] = acc.AccountHolders[0]; ds = DataSetBuilder.CreateDataSetFromBusinessObjectList( listAH, "Contact.Key, Contact.CurrentNAW.ResidentialAddress.Street," + "Contact.CurrentNAW.ResidentialAddress.HouseNumber," + "Contact.CurrentNAW.ResidentialAddress.HouseNumberSuffix," + "Contact.CurrentNAW.ResidentialAddress.PostalCode," + "Contact.CurrentNAW.ResidentialAddress.City"); } } session.Close(); } return ds; }
private void NewAccount(Window window, bool? isAnonymous, IAccountHolder iAccountHolder) { NewAccountWindow naw = new NewAccountWindow((window2) => NewAccountHolder(window2)); naw.Owner = window; Action _Clear = () => naw.cbAccountHolder.Items.Clear(); Action _Add = () => { foreach (var ah in core.iAccountHolders.iPseudonymousAccountHolders) naw.cbAccountHolder.Items.Add(ah); }; EventHandler<IAccountHolder> accountHolderAdded = (sender2, e2) => _Clear.AndThen(_Add).ExecuteInUIThread(); core.iAccountHolders.iAccountHolderAdded += accountHolderAdded; _Add(); if (!isAnonymous.HasValue || isAnonymous.Value) naw.rbAnonymous.IsChecked = true; else { naw.rbPseudonymous.IsChecked = true; if (iAccountHolder != null) naw.cbAccountHolder.SelectedItem = iAccountHolder; } if (naw.ShowDialog() == true) { IAccountHolder ahTarget = null; if (naw.rbAnonymous.IsChecked == true) ahTarget = core.iAccountHolders.iAnonymousAccountHolder; else foreach (var ah in core.iAccountHolders.iPseudonymousAccountHolders) if (ah == naw.cbAccountHolder.SelectedItem) ahTarget = ah; if (ahTarget != null) ahTarget.iAddAccount(core.iAccountHoldersFactory.CreateAccount(naw.tbName.Text, naw.tbDescription.Text)); } core.iAccountHolders.iAccountHolderAdded -= accountHolderAdded; }