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


C# Account类代码示例

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


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

示例1: Main

    // Main method begins execution of the app
    public static void Main( string[] args )
    {
        // constructors
        Account account1 = new Account(50.00M); //create Account object
        Account account2 = new Account(-7.53M);

        Console.WriteLine("Account1 balance: {0:C}\n", account1.Balance);
        Console.WriteLine("Account2 balance: {0:C}\n", account2.Balance);

        decimal depositAmount;

        Console.WriteLine("Enter deposit ammount for account1: ");
        depositAmount = Convert.ToDecimal(Console.ReadLine());
        Console.WriteLine("adding {0:C} to account1 balance\n", depositAmount);
        account1.Credit(depositAmount);

        Console.WriteLine("account1 balance: {0:C}\n", account1.Balance);
        Console.WriteLine("account2 balance: {0:C}", account2.Balance);

        Console.WriteLine("Enter deposit ammount for account2: ");
        depositAmount = Convert.ToDecimal(Console.ReadLine());
        Console.WriteLine("adding {0:C} to account2 balance\n", depositAmount);
        account2.Credit(depositAmount);

        Console.WriteLine("account1 balance: {0:C}\n", account1.Balance);
        Console.WriteLine("account2 balance: {0:C}", account2.Balance);
    }
开发者ID:madelinelise,项目名称:BankAccount,代码行数:28,代码来源:AccountTest.cs

示例2: CreateAccount

 /// <summary>
 /// 
 /// </summary>
 /// <param name="account"></param>
 /// <returns></returns>
 public bool CreateAccount(Account account)
 {
     int x = 0;
     var collection = MongoDb.Instance.GetCollection<Account>();
     var result = collection.Insert(account);
     return result.Ok;
 }
开发者ID:Yuchenhui,项目名称:Ych_Web,代码行数:12,代码来源:AccountService.cs

示例3: Add

        public string Add(Account account)
        {
            account.Id = Regex.Replace(account.Name, @"\W+", string.Empty).ToLower();
            _accounts.Add(account);

            return account.Id;
        }
开发者ID:andy-uq,项目名称:HomeTrack,代码行数:7,代码来源:InMemoryRepository.cs

示例4: GetAccountByID

        public Account GetAccountByID(string sAccountID)
        {
            Account acct = new Account();
            acct.Id = new IdType { idDomain = idDomainEnum.QB, Value = sAccountID };

            return getDataService().FindById<Account>(acct) as Account;
        }
开发者ID:stevesloka,项目名称:bvcms,代码行数:7,代码来源:QBDHelper.cs

示例5: RenameAccountDialogViewModel

 public RenameAccountDialogViewModel(ShellViewModel shell, Account account, string currentName)
     : base(shell)
 {
     _account = account;
     _rename = new DelegateCommand(RenameAction);
     CurrentAccountName = currentName;
 }
开发者ID:btcsuite,项目名称:Paymetheus,代码行数:7,代码来源:RenameAccountDialogViewModel.cs

示例6: Init

 private void Init(Account modifiedAccount)
 {
     account = modifiedAccount;
     alert = new Alert();
     alert.AccountID = account.AccountID;
     alert.CreateDate = DateTime.Now;
 }
开发者ID:lengocluyen,项目名称:pescode,代码行数:7,代码来源:AlertService.cs

示例7: MakeTransfer

        public void MakeTransfer(Account creditAccount, Account debitAccount, decimal amount)
        {
            if (creditAccount == null)
            {
                throw new AccountServiceException("creditAccount null");
            }

            if (debitAccount == null)
            {
                throw new AccountServiceException("debitAccount null");
            }

            if (debitAccount.Balance < amount && debitAccount.AutorizeOverdraft == false)
            {
                throw new AccountServiceException("not enough money");
            }

            Operation creditOperation = new Operation() { Amount = amount, Direction = Direction.Credit};
            Operation debitOperation = new Operation() { Amount = amount, Direction = Direction.Debit };

            creditAccount.Operations.Add(creditOperation);
            debitAccount.Operations.Add(debitOperation);

            creditAccount.Balance += amount;
            debitAccount.Balance -= amount;

            _operationRepository.CreateOperation(creditOperation);
            _operationRepository.CreateOperation(debitOperation);

            _accountRepository.UpdateAccount(creditAccount);
            _accountRepository.UpdateAccount(debitAccount);
        }
开发者ID:hoonzis,项目名称:PexMolesAndFakes,代码行数:32,代码来源:AccountService.cs

示例8: GoldState

 public GoldState(Account account)
     : base(account)
 {
     this.Interest = 0.05;
     this.LowerLimit = 1000.0;
     this.UpperLimit = double.MaxValue;
 }
开发者ID:Alex223124,项目名称:High-Quality-Code,代码行数:7,代码来源:GoldState.cs

示例9: ShareItemAsync

		public override Task ShareItemAsync (Item item, Account account, CancellationToken cancellationToken)
		{
			Request req;

			if (item.Images.Count > 0) {
				req = CreateRequest ("POST", new Uri ("https://graph.facebook.com/me/photos"), account);
				item.Images.First ().AddToRequest (req, "source");

				var message = new StringBuilder ();
				message.Append (item.Text);
				foreach (var l in item.Links) {
					message.AppendLine ();
					message.Append (l.AbsoluteUri);
				}
				req.AddMultipartData ("message", message.ToString ());
			}
			else {
				req = CreateRequest ("POST", new Uri ("https://graph.facebook.com/me/feed"), account);
				req.Parameters["message"] = item.Text;
				if (item.Links.Count > 0) {
					req.Parameters["link"] = item.Links.First ().AbsoluteUri;
				}
			}

			return req.GetResponseAsync (cancellationToken).ContinueWith (reqTask => {
				var content = reqTask.Result.GetResponseText ();
				if (!content.Contains ("\"id\"")) {
					throw new SocialException ("Facebook returned an unrecognized response.");
				}
			});
		}
开发者ID:RJInfotech,项目名称:Xamarin.Social,代码行数:31,代码来源:FacebookService.cs

示例10: TestTransferFundsToNullAccount

	public void TestTransferFundsToNullAccount()
	{
		Account source = new Account();
		source.Deposit(200.00F);
		Account dest = null;
		source.TransferFunds(dest, 100.00F);
	}
开发者ID:Alex223124,项目名称:High-Quality-Code,代码行数:7,代码来源:TestAccount.cs

示例11: TestDeposit

	public void TestDeposit()
	{
		Account acc = new Account();
		acc.Deposit(200.00F);
		float balance = acc.Balance;
		Assert.AreEqual(balance, 200F);
	}
开发者ID:Alex223124,项目名称:High-Quality-Code,代码行数:7,代码来源:TestAccount.cs

示例12: TestWithdrawNegative

	public void TestWithdrawNegative()
	{
		Account acc = new Account();
		acc.Withdraw(-3.14F);
		float balance = acc.Balance;
		Assert.AreEqual(balance, 1000F);
	}
开发者ID:Alex223124,项目名称:High-Quality-Code,代码行数:7,代码来源:TestAccount.cs

示例13: TestWithdraw

	public void TestWithdraw()
	{
		Account acc = new Account();
		acc.Withdraw(138.56F);
		float balance = acc.Balance;
		Assert.AreEqual(balance, -138.56F);
	}
开发者ID:Alex223124,项目名称:High-Quality-Code,代码行数:7,代码来源:TestAccount.cs

示例14: TestDepositNegative

	public void TestDepositNegative()
	{
		Account acc = new Account();
		acc.Deposit(-150.30F);
		float balance = acc.Balance;
		Assert.AreEqual(balance, -150.30F);
	}
开发者ID:Alex223124,项目名称:High-Quality-Code,代码行数:7,代码来源:TestAccount.cs

示例15: NestedObjectTypeTest

        public void NestedObjectTypeTest()
        {
            ClearConfig();
            var account = new Account();
            var settings = XmlSettings<Account>.Bind(account, CONFIG_FILE);
            var person = new Person();
            person.Age = 3;
            person.Name = "Sam";
            person.Happy = false;
            person.Birthdate = DateTime.Today;

            account.Person = person;
            account.Balance = 999;

            settings.Write();

            account = new Account();
            settings = XmlSettings<Account>.Bind(account, CONFIG_FILE);

            person = account.Person;
            Assert.AreEqual(account.Balance, 999);
            Assert.AreEqual(person.Age, 3);
            Assert.AreEqual(person.Name, "Sam");
            Assert.AreEqual(person.Happy, false);
            Assert.AreEqual(person.Birthdate, DateTime.Today);
        }
开发者ID:rickbassham,项目名称:videobrowser,代码行数:26,代码来源:TestXmlSettings.cs


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