当前位置: 首页>>代码示例>>C#>>正文


C# Bank类代码示例

本文整理汇总了C#中Bank的典型用法代码示例。如果您正苦于以下问题:C# Bank类的具体用法?C# Bank怎么用?C# Bank使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Bank类属于命名空间,在下文中一共展示了Bank类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReduceMoneyDifferentCurrency

 public void ReduceMoneyDifferentCurrency()
 {
     Bank bank = new Bank();
     bank.AddRate("CHF", "USD", 2);
     Money result = bank.Reduce(Money.Franc(2), "USD");
     Assert.Equal(Money.Dollar(1), result);
 }
开发者ID:caspencer,项目名称:TddByExampleWalkThrough,代码行数:7,代码来源:UnitTests.cs

示例2: CloseAccount

        private static void CloseAccount(Bank<Account> bank)
        {
            Console.WriteLine("Введите id счета, который надо закрыть:");
            int id = Convert.ToInt32(Console.ReadLine());

            bank.Close(id);
        }
开发者ID:VadymBratskyi,项目名称:MyRepository,代码行数:7,代码来源:Program.cs

示例3: ReduceSum

 public void ReduceSum()
 {
     IExpression sum = new Sum(Money.Dollar(3), Money.Dollar(4));
     Bank bank = new Bank();
     Money result = bank.Reduce(sum, "USD");
     Assert.Equal(Money.Dollar(7), result);
 }
开发者ID:caspencer,项目名称:TddByExampleWalkThrough,代码行数:7,代码来源:UnitTests.cs

示例4: Main

        // Write a program to model the bank system by classes and interfaces.
        // Identify the classes, interfaces, base classes and abstract actions
        // and implement the calculation of the interest functionality through overridden methods.
        private static void Main()
        {
            Client client1 = new ClientIndividual("Neo");
            Client client2 = new ClientCompany("Office 1");
            Client client3 = new ClientIndividual("Nakov");

            Account acc1 = new DepositAccount(client1, 5, "BG13TLRK01");
            Account acc2 = new LoanAccount(client2, 4.5m, "BG13TLRK02");
            Account acc3 = new MortgageAccount(client3, 8.8m, "BG13TLRK03");

            acc1.DepositMoney(1000);
            ((DepositAccount)acc1).WithdrawMoney(500);
            acc2.DepositMoney(10000);

            Bank bank = new Bank("New Bank");

            bank.AddAccount(acc1);
            bank.AddAccount(acc2);
            bank.AddAccount(acc3);

            Console.WriteLine(bank.Accounts);

            Console.WriteLine();
            Console.WriteLine("IBAN: {0} ({1}), Interest: {2:F2}", acc1.IBAN, acc1.Owner.Name, acc1.CalculateInterest(5));
            Console.WriteLine("IBAN: {0} ({1}), Interest: {2:F2}", acc2.IBAN, acc2.Owner.Name, acc2.CalculateInterest(6));
            Console.WriteLine("IBAN: {0} ({1}), Interest: {2:F2}", acc3.IBAN, acc3.Owner.Name, acc3.CalculateInterest(18));

            Console.WriteLine("\nRemoving account 1");
            bank.RemoveAccount(acc1);
            Console.WriteLine(bank.Accounts);
        }
开发者ID:MarKamenov,项目名称:TelerikAcademy,代码行数:34,代码来源:Program.cs

示例5: TestBankAccountIndexerInvalidRange

 public void TestBankAccountIndexerInvalidRange()
 {
     var bank = new Bank();
     var acc = new Account();
     bank.AddAccount(acc);
     var accFromBank = bank[1];
 }
开发者ID:EBojilova,项目名称:CSharpHQC,代码行数:7,代码来源:TestBank.cs

示例6: Main

    static void Main()
    {
        Bank bank = new Bank();

        DepositAccount depAccC = new DepositAccount(new Company(), 300M, 0.4M);
        DepositAccount depAccI = new DepositAccount(new Individual(), 1000M, 0.4M);

        LoanAccount loanAccC = new LoanAccount(new Company(), 1000M, 0.4M);
        LoanAccount loanAccI = new LoanAccount(new Individual(), 1000M, 0.4M);

        MortgageAccount mortAccC = new MortgageAccount(new Company(), 1000M, 0.4M);
        MortgageAccount mortAccI = new MortgageAccount(new Individual(), 1000M, 0.4M);

        bank.AddAccount(depAccC);
        bank.AddAccount(depAccI);
        bank.AddAccount(loanAccC);
        bank.AddAccount(loanAccI);
        bank.AddAccount(mortAccC);
        bank.AddAccount(mortAccI);

        foreach (var acc in bank.Accounts)
        {
            Console.WriteLine(acc.CalculateInterestAmount(12));
        }
    }
开发者ID:andon-andonov,项目名称:TelerikAcademy,代码行数:25,代码来源:TestApp.cs

示例7: BankOutletsCreated

 public BankOutletsCreated(int provinceID, int cityID, Bank bank, string bankName)
 {
     this.ProvinceID = provinceID;
     this.CityID = cityID;
     this.Bank = bank;
     this.BankName = bankName;
 }
开发者ID:timfun,项目名称:DotPay,代码行数:7,代码来源:BankOutletsEvents.cs

示例8: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        //start of if
        // if no session variable exists for HBos
        if (Session["Hbos"] == null)
        {
            hBos = new Bank();
        }
        else
        {

            hBos = (Bank)Session["Hbos"];
        }

        //initialising number of attempts session variable
        numberoffailedattempts = Convert.ToInt32(Session["numberoffailedattempts"]);

        cardsRetained = hBos.getcards();
        timesused = hBos.gettimesused();
        finalfailedattempts = hBos.getfailedlogins();

        //start of if statement
        //checks if manager has logged in
        //if not, disable customer button
        if (Session["HBos"] == null)
        {
            rblChoose.Items[1].Enabled = false;

        }
        else
        {
          rblChoose.Items[1].Enabled = true;

        }
    }
开发者ID:turnupthesun123,项目名称:ATMv1,代码行数:35,代码来源:Index.aspx.cs

示例9: TransferRecord

 /// <summary>
 /// 实例化一个新的转账记录
 /// </summary>
 /// <param name="comeFrom">来源银行</param>
 /// <param name="serialNumber">流水号</param>
 /// <param name="sum">金额</param>
 public TransferRecord(Bank comeFrom, string serialNumber, double sum)
 {
     this.ComeFrom = comeFrom;
     this.SerialNumber = serialNumber;
     this.Sum = sum;
     this.Status = TransferStatus.用户已经支付;
 }
开发者ID:returnanapple,项目名称:zwg-china-iworld,代码行数:13,代码来源:TransferRecord.cs

示例10: Main

 static void Main(string[] args)
 {
     Bank b1 = new Bank(1000000);
     Console.WriteLine("Текущий бонусный процент: " + Bank.GetBonus());
     Console.WriteLine("Ваш депозит на {0:C}, в кассе забрать: {1:C}", 
         10000, b1.GetPercents(10000));
 }
开发者ID:xs2ranjeet,项目名称:13ns9-1spr,代码行数:7,代码来源:Program.cs

示例11: Main

    static void Main(string[] args)
    {
        Bank myBank = new Bank();
        myBank.AddAccount(new DepositAccount(Customer.Company, 200m, 1.5m));
        myBank.AddAccount(new LoanAccount(Customer.Individual, -20, 2m));
        myBank.AddAccount(new MortgageAccount(Customer.Individual, -100m, 3m));

        Account acc = new DepositAccount(Customer.Individual, 200m, 4m);
        myBank.AddAccount(acc);

        foreach (var account in myBank.Accounts)
        {
            Console.WriteLine("{0}(Money = {1})'s interest => {2}", account.GetType(), account.Balance, account.CalculateInterest(14));
        }

        myBank.RemoveAccount(acc);

        if (acc is DepositAccount)
        {
            DepositAccount changeAcc = acc as DepositAccount;
            changeAcc.Deposit(1000);
            changeAcc.WithDraw(100);
            myBank.AddAccount(changeAcc);
        }

        Console.WriteLine();
        foreach (var account in myBank.Accounts)
        {
            Console.WriteLine("{0}(Money = {1})'s interest => {2}", account.GetType(), account.Balance, account.CalculateInterest(14));
        }
    }
开发者ID:kalinnikol,项目名称:TelerikAcademy-1,代码行数:31,代码来源:Program.cs

示例12: Main

    static void Main()
    {
        var bank = new Bank("International Asset Bank");

        bank.AddAccount(
            new DepositAccount(CustomerType.Individual, 2330, 45).WithDraw(250.23m), // Test WithDraw()
            new LoanAccount(CustomerType.Company, 250, 25).Deposit(250.23m), // Test Deposit()
            new LoanAccount(CustomerType.Individual, 444, 44), // Remove
            new MortgageAccount(CustomerType.Company, 2300, 15));

        bank.RemoveAccount(new LoanAccount(CustomerType.Individual, 444, 44));

        Console.WriteLine(bank);

        /* ------------ */

        Console.WriteLine(new DepositAccount(CustomerType.Individual, 2330, 45).CalculateInterestAmount(20));

        Console.WriteLine(new LoanAccount(CustomerType.Company, 250, 25).Deposit(250.23m).CalculateInterestAmount(15));

        Console.WriteLine(new MortgageAccount(CustomerType.Company, 2300, 15).CalculateInterestAmount(45) + "\n\n");

        /* ------------ */

        Console.WriteLine(new DepositAccount(CustomerType.Individual, 2330, 45));
    }
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:26,代码来源:Program.cs

示例13: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        //start of if
        // if no session variable exists for HBos
        if (Session["HBos"] == null)
        {
            hBos = new Bank();
        }
        else
        {

            hBos = (Bank)Session["HBos"];
        }


                

        //using getters to set label values to that in bank class
        lblExRate.Text = Convert.ToString(hBos.getexchange());
        lblAtmUsed.Text = Convert.ToString(hBos.gettimesused());
        lblFailedLogins.Text = Convert.ToString(hBos.getfailedlogins());
        lblBalanceAvailable.Text = Convert.ToString(hBos.gettotalbalance());
        lblCards.Text = Convert.ToString(hBos.getcards());
        lblId.Text = Convert.ToString(hBos.getatmid());
        lblTotalWithdrawls.Text = Convert.ToString(hBos.getwithdrawls());

        Session.Add("HBos", hBos);
    }
开发者ID:turnupthesun123,项目名称:ATMv1,代码行数:28,代码来源:Maintenance.aspx.cs

示例14: BankAccount

 public static Bank BankAccount()
 {
     // Making instance of the Bank, with random values
     Bank account = new Bank("Pesho", "Ivanov", "Petrov", 200.22m, "TBI BANK", "BG80 BNBG 9661 1020 3456 78",
                              347443242294183, 344715318332002, 340121672891069);
     return account;
 }
开发者ID:unbelt,项目名称:SoftUni,代码行数:7,代码来源:BankAccountDataAdvanced.cs

示例15: delete

 // Delete Bank <bank> from database
 public static bool delete(Bank bank)
 {
     using (DataClasses1DataContext database = new DataClasses1DataContext(Globals.connectionString))
     {
         var query = from a in database.Banks
                     where (a.BankID == bank.BankID)
                     select a;
         // It seems to me that a single account renders the foreach unnecessary. However, I can't
         // find another way to get the variable 'a' from 'query'.
         foreach (var a in query)
         {
             database.Banks.DeleteOnSubmit(a);
             try
             {
                 database.SubmitChanges();
                 return true;
             }
             catch (Exception e)
             {
                 return false;
             }
         }
         return false;
     }
 }
开发者ID:captaintino,项目名称:Bounced-Check-Manager,代码行数:26,代码来源:BankDAO.cs


注:本文中的Bank类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。