當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。