示例#1
0
 public Manager CreateUser(AccountType accountType, string name, string userID, string password, string bankID, string address, string contact)
 {
     if (accountType.Equals("Account"))
     {
         string Name = name;
         var    Bank = this.Manager.Banks.Find(_ => (string.Equals(_.bankID, bankID)));
         this.Manager.Banks.Remove(Bank);
         AccountHolder Holder = new AccountHolder(Bank.bankID, userID, password, name, address, contact);
         Bank.accountHolders.Add(Holder);
         this.Manager.Banks.Add(Bank);
     }
     else if (accountType.Equals("Staff"))
     {
         string builder    = "";
         string EmployeeID = "";
         Random random     = new Random();
         char   ch;
         for (int i = 0; i < 10; i++)
         {
             ch       = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));
             builder += ch;
         }
         EmployeeID = builder;
         var Bank = this.Manager.Banks.Find(_ => (string.Equals(_.bankID, bankID)));
         this.Manager.Banks.Remove(Bank);
         BankStaff NewStaff = new BankStaff(EmployeeID, Bank.bankName, Bank.bankID, userID, password, name, address, contact);
         Bank.bankStaffs.Add(NewStaff);
         this.Manager.Banks.Add(Bank);
     }
     return(this.Manager);
 }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is BankAccount other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((AccountNumberSuffix == null && other.AccountNumberSuffix == null) || (AccountNumberSuffix?.Equals(other.AccountNumberSuffix) == true)) &&
                   ((Country == null && other.Country == null) || (Country?.Equals(other.Country) == true)) &&
                   ((Currency == null && other.Currency == null) || (Currency?.Equals(other.Currency) == true)) &&
                   ((AccountType == null && other.AccountType == null) || (AccountType?.Equals(other.AccountType) == true)) &&
                   ((HolderName == null && other.HolderName == null) || (HolderName?.Equals(other.HolderName) == true)) &&
                   ((PrimaryBankIdentificationNumber == null && other.PrimaryBankIdentificationNumber == null) || (PrimaryBankIdentificationNumber?.Equals(other.PrimaryBankIdentificationNumber) == true)) &&
                   ((SecondaryBankIdentificationNumber == null && other.SecondaryBankIdentificationNumber == null) || (SecondaryBankIdentificationNumber?.Equals(other.SecondaryBankIdentificationNumber) == true)) &&
                   ((DebitMandateReferenceId == null && other.DebitMandateReferenceId == null) || (DebitMandateReferenceId?.Equals(other.DebitMandateReferenceId) == true)) &&
                   ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   Creditable.Equals(other.Creditable) &&
                   Debitable.Equals(other.Debitable) &&
                   ((Fingerprint == null && other.Fingerprint == null) || (Fingerprint?.Equals(other.Fingerprint) == true)) &&
                   ((Version == null && other.Version == null) || (Version?.Equals(other.Version) == true)) &&
                   ((BankName == null && other.BankName == null) || (BankName?.Equals(other.BankName) == true)));
        }
示例#3
0
        public override void calculateInterest()
        {
            if (AccountType.Equals(BankAccountTypeEnum.Current))
            {
                Console.WriteLine("Interest is not available in Current account");
                return;
            }
            double interest = 0.7 * base.balance; //ICICI 7% rate given

            Console.WriteLine("The interest amount is: " + interest);
        }
示例#4
0
                public void Should_return_true()
                {
                    var alpha = new AccountType
                    {
                        Name = "foo",
                    };
                    var beta = new AccountType
                    {
                        Name = "FOO"
                    };

                    alpha.Equals(beta).ShouldBeTrue();
                }
示例#5
0
                public void Should_return_false()
                {
                    var alpha = new AccountType
                    {
                        Name = "foo",
                    };
                    var beta = new AccountType
                    {
                        Name = "bar"
                    };

                    alpha.Equals(beta).ShouldBeFalse();
                }
示例#6
0
        public Account createAccount(String accountNumber, String customerName, AccountType acctType)
        {
            Account account;

            if (acctType.Equals(AccountType.Savings))
            {
                account = new AccountSavings(accountNumber);
            }
            else
            {
                account = new AccountCheckings(accountNumber);
            }

            Customer customer = new Customer(customerName);

            account.setCustomer(customer);

            accountDAO.saveAccount(account);

            return(account);
        }
示例#7
0
 private void PopulateNewAccount(Customer Customer, AccountType AccountType, string AccountName, ObservableRangeCollection <ITransactionInterface> Transactions, Guid Identifier)
 {
     LastErrorMessage = "";
     this.Identifier  = Identifier;
     this.Name        = AccountName;
     this.AccountType = AccountType;
     this.Customer    = Customer;
     if (Transactions != null && Transactions.Count > 0)
     {
         this.m_oTransactions = (ObservableRangeCollection <ITransactionInterface>)Transactions;
     }
     else
     {
         this.m_oTransactions = new ObservableRangeCollection <ITransactionInterface>();
         if (AccountType.Equals(AccountType.Customer))
         {
             CreateZeroBalanceOnNewAccount();
         }
     }
     m_oTransactions.CollectionChanged -= Transactions_CollectionChanged;
     m_oTransactions.CollectionChanged += Transactions_CollectionChanged;
 }
示例#8
0
 public bool ToStudent()
 {
     AccountType = AccountType.STUDENT;
     return(AccountType.Equals(AccountType.STUDENT));
 }
示例#9
0
 public bool ToInstructor(string publicName)
 {
     AccountType       = AccountType.INSTRUCTOR;
     InstructorDetails = InstructorDetails.Create(DateTime.UtcNow, publicName);
     return(AccountType.Equals(AccountType.INSTRUCTOR));
 }