public bool LogIn(string username, string password)
        {
            AccountHolder accountHolder = accountDataService.GetAccountHolderById(username);

            return(accountHolder != null && accountHolder.Password == password);
        }
        public bool IsDuplicateAccountHolder(string id)
        {
            AccountHolder accountHolder = accountDataService.GetAccountHolderById(id);

            return(accountHolder == null);
        }
예제 #3
0
 public SavingsAccount(string iban, decimal balance, AccountHolder accountHolder) : base(iban, balance, accountHolder, null)
 {
 }
예제 #4
0
 public AccountHolder UpdateAccountHolder(AccountHolder accountHolder)
 {
     return(_accountHolderRepository.UpdateAccountHolder(accountHolder));
 }
예제 #5
0
        public static void AddAccountHolder(int newContactID, int accountNrID)
        {
            IDalSession session = NHSessionFactory.CreateSession();
            IContact newContact = ContactMapper.GetContact(session, newContactID);
            ICustomerAccount acc = (ICustomerAccount)AccountMapper.GetAccount(session, accountNrID);
            IAccountHolder ah = new AccountHolder(acc, newContact);

            if (!acc.AccountHolders.Contains(ah))
            {
                acc.AccountHolders.Add(ah);
                if (acc.AccountHolders.Count == 1) acc.AccountHolders.SetPrimaryAccountHolder(newContact);
                AccountHolderMapper.Insert(session, ah);
            }
            session.Close();
        }
예제 #6
0
        public DepositAccount(AccountHolder customer, decimal balance, decimal interestRate)
            : base(customer, balance, interestRate)
        {

        }
예제 #7
0
 // This is launched when Cancel button on tabPage4 is pressed
 private void btnStep3extClear_Click(object sender, EventArgs e)
 {
     accountExternal = null;
     holderExternal  = null;
     ctrExtAccountH.Wipe();
 }
예제 #8
0
        //CLICK SUBMIT  - create a new holder and / or account
        private void btnManAccPFullDetSubmit_Click(object sender, EventArgs e)
        {
            bool success = false;


            //Create  a NEW holder AND and NEW account

            if (rbtnAccManPNewAccNewMem.Checked)
            {
                //new holder
                AccountHolder ah = CreateNewAccHolderObject();

                //new account
                Account acc = CreateNewAccountObjectNoHolderID();


                //send both objects to  DB
                if (ah != null && acc != null)
                {
                    BLLAccountMgmt bllAM = new BLLAccountMgmt();

                    success = bllAM.AddNewHolderBLL(ah); //holder

                    int accHolderID = int.Parse(txtManAccPFullDetAccHolder.Text);
                    success = bllAM.AddNewAccountBLL(acc, accHolderID); //account
                }
            }



            //Create a new account and add to EXISTING  holder
            if (rbtnAccManPNewAccExistingMem.Checked)
            {
                Account acc = CreateNewAccountObjectNoHolderID();

                if (acc != null)
                {
                    BLLAccountMgmt bllAM = new BLLAccountMgmt();

                    int accHolderID = int.Parse(txtManAccPFullDetAccHolder.Text);
                    success = bllAM.AddNewAccountBLL(acc, accHolderID);
                }
            }



            if (ValidateChildren(ValidationConstraints.Enabled))
            {
                // final result actions
                if (success == true)
                {
                    MessageBox.Show("All details have been saved");
                    //show accounts dgv
                    BackToHomeGridView();
                }

                else if (success == false)

                {
                    MessageBox.Show("Details not saved. Try again.");
                }
            }
        }
예제 #9
0
 public override BankAccount CreateAccount(IAccountNumberGenerator generator, AccountHolder holder) =>
 new GoldAccount(generator, holder);
예제 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SilverAccount"/> class.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="accountHolder">The account holder.</param>
 public SilverAccount(string id, AccountHolder accountHolder) : base(id, accountHolder)
 {
 }
 public override BankAccount Create(AccountHolder holder, IAccountNumberGenerator idGenerator,
                                    IMoneyAccuracyCalculator moneyRounder = null)
 {
     return(new SilverAccount(holder, idGenerator, moneyRounder));
 }
 public void LogoutAccountholder()
 {
     loggedInAccountHolder          = null;
     AccountService.loggedInAccount = null;
 }
예제 #13
0
 public bool ValidateAccountHolderLogin(AccountHolder holder, string userID, string password)
 {
     return(holder.UserID == userID && holder.Password == password);
 }
 public void AddNewAccount(AccountHolder accountHolder, Account account)
 {
     accountDataService.AddAccount(accountHolder, account);
 }
예제 #15
0
        //************* CREATE NEW HOLDER AND ACCOUNT **************

        //new acc holder
        public bool AddNewHolderDAL(AccountHolder ah)
        {
            bool success = false;

            try
            {
                using (SqlConnection conn = new SqlConnection(connString))
                {
                    SqlCommand cmd = new SqlCommand("spAddAccountHolder", conn);
                    cmd.CommandType = CommandType.StoredProcedure;

                    SqlParameter ahFNamePar = new SqlParameter("@AHFirstName", SqlDbType.NVarChar, 256);
                    ahFNamePar.Value = ah.FirstName;

                    SqlParameter ahLNamePar = new SqlParameter("@AHSurname", SqlDbType.NVarChar, 256);
                    ahLNamePar.Value = ah.Surname;

                    SqlParameter ahEmailPar = new SqlParameter("@AHEmail", SqlDbType.NVarChar, 256);
                    ahEmailPar.Value = ah.Email;

                    SqlParameter ahPhonePar = new SqlParameter("@AHPhone", SqlDbType.NVarChar, 256);
                    ahPhonePar.Value = ah.Phone;

                    SqlParameter ahAdd1Par = new SqlParameter("@AHAddress1", SqlDbType.NVarChar, 256);
                    ahAdd1Par.Value = ah.Address1;

                    SqlParameter ahAdd2Par = new SqlParameter("@AHAddress2", SqlDbType.NVarChar, 256);
                    ahAdd2Par.Value = ah.Address2;

                    SqlParameter ahCityPar = new SqlParameter("@AHCity", SqlDbType.NVarChar, 256);
                    ahCityPar.Value = ah.City;

                    SqlParameter ahCountyPar = new SqlParameter("@AHCounty", SqlDbType.NVarChar, 256);
                    ahCountyPar.Value = ah.County;

                    SqlParameter ahIDPar = new SqlParameter("@AccountHolderID", SqlDbType.Int, 4);
                    ahIDPar.Direction = ParameterDirection.Output;

                    cmd.Parameters.Add(ahFNamePar);
                    cmd.Parameters.Add(ahLNamePar);
                    cmd.Parameters.Add(ahEmailPar);
                    cmd.Parameters.Add(ahPhonePar);
                    cmd.Parameters.Add(ahAdd1Par);
                    cmd.Parameters.Add(ahAdd2Par);
                    cmd.Parameters.Add(ahCityPar);
                    cmd.Parameters.Add(ahCountyPar);
                    cmd.Parameters.Add(ahIDPar);

                    conn.Open();
                    int numRows = cmd.ExecuteNonQuery();
                    conn.Close();

                    if (numRows > 0)
                    {
                        ah.ID   = Convert.ToInt16(ahIDPar.Value);
                        success = true;
                    }
                }
            }
            catch (SqlException ex)
            {
                throw;
            }
            return(success);
        }
 public void UpdateAccountHolder(AccountHolder accountHolder)
 {
     accountDataService.UpdateAccount(accountHolder);
 }
 /// <summary>
 /// Parametrized constructor.
 /// </summary>
 /// <param name="id">Account given id.</param>
 /// <param name="person">Account holder.</param>
 /// <param name="status">Account status.</param>
 /// <param name="type">Account type.</param>
 /// <param name="sum">Account first balance.</param>
 /// <param name="bonus">Account first given bonuses.</param>
 public BaseAccount(int id, AccountHolder person, AccountStatus status, AccountType type, int sum, int bonus) : base(id, person, status, type, sum, bonus)
 {
 }
예제 #18
0
        public MortageAccount(AccountHolder customer, decimal balance, decimal interestRate)
            : base(customer, balance, interestRate)
        {

        }
예제 #19
0
        private static void Main()
        {
            try
            {
                //TCP client
                _client = new TcpClient();

                //TCP stream
                _client.Connect(Host, Port);
                _stream = _client.GetStream();

                #region Client login/register

                string output;
                Console.WriteLine("Welcome to the banking system");
                Console.WriteLine("Want to register? (y/n)");
                if (Console.ReadKey().Key == ConsoleKey.Y)
                {
                    Console.WriteLine("\r");
                    Console.Write("Write name : ");
                    var name = Console.ReadLine();
                    Console.Write("Write surname : ");
                    var lastName = Console.ReadLine();
                    Console.Write("Write password : "******"Password is too week needed minimum 6 chars");
                        Console.Write("Write password : "******"register" + ' ' + JsonConvert.SerializeObject(person);
                }
                else
                {
                    Console.WriteLine("\r");
                    Console.Write("Write name : ");
                    var name = Console.ReadLine();
                    Console.Write("Write password : "******"enter" + ' ' + name + ' ' + password;
                }

                #endregion

                var data = Encoding.Unicode.GetBytes(output);
                _stream.Write(data, 0, data.Length);

                var receiveThread = new Task(ReceiveMessage, TaskCreationOptions.LongRunning);

                receiveThread.Start();
                SendMessage();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                Disconnect();
            }
        }
예제 #20
0
 public Costumer(string name, AccountHolder type)
 {
     this.Name = name;
     this.Type = type;
 }
 public void Throw_ArgumentNullException_On_Null_Balance(
     AccountId id,
     AccountHolder holder)
 {
     Assert.Throws <ArgumentNullException>(() => { new Account(id, holder, null); });
 }
예제 #22
0
 protected Account(AccountHolder customer, decimal balance, decimal interestRate)
 {
     this.Customer = customer;
     this.Balance = balance;
     this.InterestRate = interestRate;
 }
예제 #23
0
 // wipe out details and update display
 public void Wipe()
 {
     accHolder = null;
     account   = null;
     this.UpdateDisplay();
 }