public string CheckBank(AccountNumber accountNumber) { string tempAccountNumber = ""; tempAccountNumber = accountNumber.AcountNumber.Substring(5, 8); var fundBank = BamkList.ListAllBank.Find(bank => bank.BranchBankId.Equals(tempAccountNumber)); return "Nazwa banku: " + fundBank.BankName + " oddział w " + fundBank.BranchBankName; }
private void Assert_AccountNumberChecksum(IEnumerable<int> accountNumber, int expectedChecksum) { var numberObj = new AccountNumber(accountNumber.Select(x => new Digit(x))); var checksum = ChecksumCalculator.CalculateChecksum(numberObj); checksum.Should().Be(expectedChecksum, "because expected checksum is equal to {0}", expectedChecksum); }
public AccountStatusChanged(AccountNumber accountNumber, AccountStatus status) { Mandate.ParameterNotNull(accountNumber, "accountNumber"); Mandate.ParameterNotDefaut(status, "status"); Status = status; AccountNumber = accountNumber; }
public AccountAssingedToClient(ClientId clientId, AccountNumber accountNumber) { Mandate.ParameterNotNullOrEmpty(accountNumber, "accountNumber"); Mandate.ParameterNotNullOrEmpty(clientId, "clientId"); ClientId = clientId; AccountNumber = accountNumber; }
public AccountBilled(AccountNumber accountNumber, Recency recency) { Mandate.ParameterNotNullOrEmpty(accountNumber, "accountNumber"); Mandate.ParameterNotDefaut(recency, "recency"); Recency = recency; AccountNumber = accountNumber; }
private void Assert_AccountNumberAsDigitsIsValid(int[] numberDigits, bool expectedIsValid) { var accountNumber = new AccountNumber(numberDigits.Select(x => new Digit(x))); var checksum = ChecksumCalculator.CalculateChecksum(accountNumber); var isChecksumValid = ChecksumValidator.IsChecksumValid(checksum); Assert.That(isChecksumValid, Is.EqualTo(expectedIsValid)); }
public RegisterSuccessfullPayment(AccountNumber accountNumber, BillingResult billingResult) { Mandate.ParameterNotNullOrEmpty(accountNumber, "accountNumber"); Mandate.ParameterNotDefaut(billingResult, "billingResult"); AccountNumber = accountNumber; BillingResult = billingResult; }
public AccountOpened(ClientId clientId, AccountNumber accountNumber) { Mandate.ParameterNotNull(clientId, "clientId"); Mandate.ParameterNotNull(accountNumber, "accountNumber"); ClientId = clientId; AccountNumber = accountNumber; }
bool be_a_valid_account(AccountNumber accountNumber) { var repository = Kernel.Get<IReadModelRepositoryFor<AccountOverview>>(); var accountExists = repository.Query.Any(a => a.AccountNumber == accountNumber); var ac = repository.Query.Where(a => a.AccountNumber == accountNumber); return accountExists; }
public void TestAPossibleNumber(AccountNumber account, int index) { _globalTest.Test(account, index, "6"); if (!account.errorPossible) { _globalTest.Test(account, index, "9"); } }
public AccountBilled(AccountNumber accountNumber, ClientId clientId, Recency recency) { Mandate.ParameterNotNullOrEmpty(accountNumber, "accountNumber"); Mandate.ParameterNotNullOrEmpty(clientId, "clientId"); Recency = recency; ClientId = clientId; AccountNumber = accountNumber; }
public void Build(string[] args) { if (args.Length != 1) { throw new Exception(String.Format("Error. Usage is: {0}", Usage)); } AccountNumber = new AccountNumber(args[0]); }
void IHandleClientStateTransitions.When(ClientRegistered @event) { AccountNumber = AccountNumber.Empty; Identity = @event.ClientId; identityNumber = @event.IdentityNumber; clientName = @event.ClientName; primaryContactNumber = @event.PrimaryContactNumber; dateOfBirth = @event.IdentityNumber.GetDateOfBirth(); }
public string this[string columnName] { get { if (columnName == "AccountNumber" && !string.IsNullOrEmpty(AccountNumber)) { var accountNumberLength = AccountNumber.ToString().Length; if (accountNumberLength > 10 || accountNumberLength < 5) { return("Account number length should be between 5 to 10. "); } } else if (columnName == "AccountNumber1" && !string.IsNullOrEmpty(AccountNumber1)) { var accountNumberLength = AccountNumber1.ToString().Length; if (AccountNumber1 != AccountNumber) { return("Account numbers do not match."); } else if (accountNumberLength > 10 || accountNumberLength < 5) { return("Account number length should be between 5 to 10. "); } } else if (columnName == "Amount") { if (Amount <= 0) { return("Amount should be more than zero."); } } else if (columnName == "Email") { if (string.IsNullOrEmpty(Email)) { return(string.Empty); } return(!emailRegex.IsMatch(Email) ? "Email ID not in correct format." : null); } else if (columnName == "Password") { if (string.IsNullOrEmpty(Password)) { return(string.Empty); } if (Password != "password") { return("Password is incorrect"); } } return(string.Empty); } }
} //Key public override int GetHashCode() { unchecked { int result = AccountNumber.GetHashCode(); result = (result * 397) ^ MasterCode.GetHashCode(); result = (result * 397) ^ Exchange.GetHashCode(); return(result); } }
public void CheckIfThereIsAPossibleError(string accountNumber, bool expected) { AccountNumber account = new AccountNumber(); account.accountNumber = accountNumber; account.errorPossible = false; account = Bo.CheckPossibleErrors(account); Assert.Equal(expected, account.errorPossible); }
public void Build(string[] args) { if (args.Length != 2) { throw new Exception(String.Format("Error. Usage is: {0}", Usage)); } AccountNumber = new AccountNumber(args[0]); BillingResult = BillingResult.PaymentMade(Decimal.Parse(args[1]), DateTime.Today); }
// GET: Student/Create public ActionResult Create() { Student s = db.Students.FirstOrDefault(p => p.Id == db.Students.Max(x => x.Id)); var newstudentNumber = AccountNumber.NextStudentNumber(s.StudentNumber); var student = new Student { StudentNumber = newstudentNumber, Password = newstudentNumber }; return(View(student)); }
//恒朋投注系统向本地系统发送的“奖期通知” // 1)用奖期查询,来代替。改变本地系统奖期状态,可能需要轮讯 //恒朋投注系统向本地系统发送的“返奖通知” //暂时不考虑 /// <summary> /// 发送响应信息到恒朋电话投注系统 /// </summary> /// <param name="accountNo">代理商账号</param> /// <param name="transType">交易类型 </param> /// <param name="messageID">消息ID</param> /// <param name="resStatus">返回恒朋系统的响应状态</param> public void ResponseNotice(AccountNumber accountNo, TransactionType transType, string messageID, ResponseStatus resStatus) { DateTime now = DateTime.Now; string body = "<body><response code=\"" + resStatus.StatusCode + "\" message=\"" + resStatus.Description + "\"/></body>"; string timestamp = now.ToString("yyyyMMdd") + now.ToString("HHmmss"); string message = "<?xml version=\"1.0\" encoding=\"GBK\"?>"; message = (((((((message + "<message version=\"1.0\" id=\"" + messageID + "\">") + "<header>") + "<messengerID>" + accountNo.UserName + "</messengerID>") + "<timestamp>" + timestamp + "</timestamp>") + "<transactionType>" + transType.TypeCode + "</transactionType>") + "<digest>" + PostManager.MD5(messageID + timestamp + accountNo.UserPassword + body, "gb2312") + "</digest>") + "</header>") + body + "</message>"; PostManager.Post(GatewayUrl, "transType=" + transType.TypeCode + "&transMessage=" + message, 90); }
public AccountStatusChanged(AccountNumber accountNumber, ClientId clientId, AccountStatus status) { Mandate.ParameterNotNull(accountNumber, "accountNumber"); Mandate.ParameterNotNull(clientId, "clientId"); Mandate.ParameterNotDefaut(status, "status"); Status = status; AccountNumber = accountNumber; ClientId = clientId; }
// GET: Admin/Create public ActionResult Create() { Admin a = db.Admins.FirstOrDefault(p => p.Id == db.Admins.Max(x => x.Id)); var newAdminNumber = AccountNumber.NextStudentNumber(a.AdminNumber); var admin = new Admin { AdminNumber = newAdminNumber, Password = newAdminNumber }; return(View(admin)); }
//====================================================================== private void clearform_Click_1(object sender, EventArgs e) //====================================================================== { // clar all data froim fields notes.Text = ""; AccountNumber.Text = ""; AccountBalance.Text = "";; OpenDate.Text = ""; Interest.Text = ""; custno.Text = ""; AccountNumber.Focus(); }
// GET: Lecturer/Create public ActionResult Create() { Lecturer l = db.Lecturers.FirstOrDefault(p => p.Id == db.Lecturers.Max(x => x.Id)); var newLecturerNumber = AccountNumber.NextLecturerNumber(l.LecturerNumber); var admin = new Lecturer { LecturerNumber = newLecturerNumber, Password = newLecturerNumber }; return(View(admin)); }
public Task renaming_an_account_when_no_account_defined_throws(AccountName accountName, AccountNumber accountNumber) => new Scenario() .GivenNone() .When(new RenameAccount { NewAccountName = accountName.ToString(), AccountNumber = accountNumber.ToInt32() }) .Throws(new ChartOfAccountsNotFoundException()) .Assert(_handler, _facts);
public override int GetHashCode() { unchecked { int hashCode = (AccountNumber != null ? AccountNumber.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (BranchCode != null ? BranchCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ BankAccountType.GetHashCode(); return(hashCode); } }
internal override void WriteXml(XmlTextWriter xmlWriter) { xmlWriter.WriteStartElement("billing_info"); // Start: billing_info //if a recurly js token is supplied we don't want to send billing info here if (string.IsNullOrEmpty(TokenId)) { xmlWriter.WriteStringIfValid("first_name", FirstName); xmlWriter.WriteStringIfValid("last_name", LastName); xmlWriter.WriteStringIfValid("name_on_account", NameOnAccount); xmlWriter.WriteStringIfValid("address1", Address1); xmlWriter.WriteStringIfValid("address2", Address2); xmlWriter.WriteStringIfValid("city", City); xmlWriter.WriteStringIfValid("state", State); xmlWriter.WriteStringIfValid("zip", PostalCode); xmlWriter.WriteStringIfValid("country", Country); xmlWriter.WriteStringIfValid("phone", PhoneNumber); xmlWriter.WriteStringIfValid("vat_number", VatNumber); xmlWriter.WriteStringIfValid("currency", Currency); if (!IpAddress.IsNullOrEmpty()) { xmlWriter.WriteElementString("ip_address", IpAddress); } else { Debug.WriteLine("Recurly Client Library: Recording IP Address is strongly recommended."); } if (!CreditCardNumber.IsNullOrEmpty()) { xmlWriter.WriteElementString("number", CreditCardNumber); xmlWriter.WriteElementString("month", ExpirationMonth.AsString()); xmlWriter.WriteElementString("year", ExpirationYear.AsString()); xmlWriter.WriteStringIfValid("verification_value", VerificationValue); } if (!AccountNumber.IsNullOrEmpty()) { xmlWriter.WriteElementString("routing_number", RoutingNumber); xmlWriter.WriteElementString("account_number", AccountNumber); xmlWriter.WriteElementString("account_type", AccountType.ToString().EnumNameToTransportCase()); } if (!PaypalBillingAgreementId.IsNullOrEmpty()) { xmlWriter.WriteElementString("paypal_billing_agreement_id", PaypalBillingAgreementId); } } xmlWriter.WriteStringIfValid("token_id", TokenId); xmlWriter.WriteEndElement(); // End: billing_info }
/// <summary> /// 投注 /// 在每个请求最多500票的限制内,尽可能携带更多的票,禁止一个投注请求仅携带一票 /// transType=103 /// </summary> /// <param name="accountNo">代理商账号</param> /// <param name="transType">交易类型,如:103</param> /// <param name="tickets">要进行投注的彩票集合</param> /// <returns></returns> public string LotteryRequest(AccountNumber accountNo, TransactionType transType, List <Ticket> tickets) { if (transType.TypeCode.Trim() != "103") { throw new Exception("投注请求对应的交易类型错误。"); } if (tickets.Count > 1 && tickets.Count <= 500) { try { string body = "<body><lotteryRequest>"; foreach (Ticket ticket in tickets) { Issue issue = ticket.IssueInfo; UserProfile userProfile = ticket.UserProfile; string anteCodes = ticket.AnteCodes; string ticketid = ticket.TicketId; string ticketN = body + "<ticket id=\"" + ticketid + "\""; string playType = ticketN + " playType=\"" + ticket.PlayTypeInfo.ID + "\" money=\"" + ticket.Money.Replace(",", "") + "\" amount=\"" + ticket.Amount + "\">"; string issueN = playType + "<issue gameName=\"" + issue.PlayMethodInfo.GameName + "\" number=\"" + issue.Number + "\"/>"; body = issueN + "<userProfile userName=\"" + userProfile.UserName + "\" cardType=\"" + ((int)userProfile.CardTypeInfo) + "\" mail=\"" + userProfile.Mail + "\" cardNumber=\"" + userProfile.CardNumber + "\" mobile=\"" + userProfile.Mobile + "\" realName=\"" + userProfile.RealName + "\"/>"; foreach (string anteCode in anteCodes.Split(new char[] { '\n' })) { if (!(anteCode.Trim() == "")) { body = body + "<anteCode>" + anteCode + "</anteCode>"; } } body = body + "</ticket>"; } body = body + "</lotteryRequest></body>"; string messageId = accountNo.UserName + DateTime.Now.ToString("yyyyMMdd") + PostManager.EightSerialNumber; string timestamp = DateTime.Now.ToString("yyyyMMdd") + DateTime.Now.ToString("HHmmss"); string message = "<?xml version=\"1.0\" encoding=\"GBK\"?>"; message = (((((((message + "<message version=\"1.0\" id=\"" + messageId + "\">") + "<header>") + "<messengerID>" + accountNo.UserName + "</messengerID>") + "<timestamp>" + timestamp + "</timestamp>") + "<transactionType>" + transType.TypeCode + "</transactionType>") + "<digest>" + PostManager.MD5(messageId + timestamp + accountNo.UserPassword + body, "gb2312") + "</digest>") + "</header>") + body + "</message>"; Console.WriteLine("投注传递的消息为:"); Console.WriteLine("transType=" + transType.TypeCode + "&transMessage=" + message); string receiveString = ""; receiveString = PostManager.Post(GatewayUrl, "transType=" + transType.TypeCode + "&transMessage=" + message, 120); return(receiveString); } catch (Exception ex) { throw ex; } } else { throw new Exception("每个投注请求最多500票的限制内,尽可能携带更多的票,禁止一个投注请求仅携带一票。"); } }
public void TwoAccountNumbers_WithSameValue_AreEqual() { var lhs = new AccountNumber(0, 19, "0100"); var rhs = new AccountNumber(0, 19, "0100"); Assert.Equal(lhs.GetHashCode(), rhs.GetHashCode()); Assert.True(lhs.Equals((object)rhs)); Assert.True(lhs.Equals(rhs)); Assert.True(lhs == rhs); Assert.False(lhs != rhs); }
public void Transfer(AccountNumber from, AccountNumber to, decimal amount) { Apply(new Credited(Id) { AccountNumber = from, Amount = amount }); Apply(new Debited(Id) { AccountNumber = to, Amount = amount }); }
protected PosRequest(DateTime timestamp, MessageId messageId, AccountNumber accountNumber) { if (timestamp == default) { throw new ArgumentException(nameof(timestamp)); } Timestamp = timestamp; MessageId = messageId ?? throw new ArgumentNullException(nameof(messageId)); AccountNumber = accountNumber ?? throw new ArgumentNullException(nameof(accountNumber)); }
public Task reactivating_an_active_account(AccountName accountName, AccountNumber accountNumber) => new Scenario() .Given(ChartOfAccounts.Identifier, new AccountDefined { AccountName = accountName.ToString(), AccountNumber = accountNumber.ToInt32() }) .When(new ReactivateAccount { AccountNumber = accountNumber.ToInt32() }) .ThenNone() .Assert(_handler, _facts);
public ActionResult Edit([Bind(Include = "AccountNumberId,BankId,Account")] AccountNumber accountNumber) { if (ModelState.IsValid) { db.Entry(accountNumber).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BankId = new SelectList(db.Banks, "BankId", "BankName", accountNumber.BankId); return(View(accountNumber)); }
public Account(string accountNumber) { this.AccountNumber = accountNumber; Fragments = AccountNumber.Split('-'); //Fragment1 = fragments[0]; //Fragment2 = fragments[1]; //Fragment3 = fragments[2]; //Fragment4 = fragments[3]; }
public void Parse_ReturnsCorrectValue_When_RawTextIsValid() { var rawText = new string[] { " _ _ _ _ _ _ _ ", " | _| _||_||_ |_ ||_||_|", " ||_ _| | _||_| ||_| _|", "" }; var acctNum = new AccountNumber(rawText); Assert.Equal("123456789", acctNum.Value); }
public ActionResult Create([Bind(Include = "AccountNumberId,BankId,Account")] AccountNumber accountNumber) { if (ModelState.IsValid) { db.BankAccounts.Add(accountNumber); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BankId = new SelectList(db.Banks, "BankId", "BankName", accountNumber.BankId); return(View(accountNumber)); }
public void TestAccountNumberHashing(List <byte[]> accountNumbersCollections) { HashSet <AccountNumber> set = new HashSet <AccountNumber>(); foreach (var accountNumbers in accountNumbersCollections) { AccountNumber accountNumber = new AccountNumber(accountNumbers); set.Add(accountNumber); } Assert.AreEqual(2, set.Count); }
public Task defining_an_account(AccountName accountName, AccountNumber accountNumber) => new Scenario() .GivenNone() .When(new DefineAccount { AccountName = accountName.ToString(), AccountNumber = accountNumber.ToInt32() }) .Then("chartOfAccounts", new AccountDefined { AccountName = accountName.ToString(), AccountNumber = accountNumber.ToInt32() }) .Assert(_handler, _facts);
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member 'bankAccount.GetUID()' public string GetUID() #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member 'bankAccount.GetUID()' { if (AccountNumber != null) { return(AccountNumber.ToString(true, bankAccountNumberFormat.doubleSeparation)); } else { return(""); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (IsValid != null) { hashCode = hashCode * 59 + IsValid.GetHashCode(); } if (IsAccount != null) { hashCode = hashCode * 59 + IsAccount.GetHashCode(); } if (IsBlacklisted != null) { hashCode = hashCode * 59 + IsBlacklisted.GetHashCode(); } if (Avatar != null) { hashCode = hashCode * 59 + Avatar.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (AccountNumber != null) { hashCode = hashCode * 59 + AccountNumber.GetHashCode(); } if (CorrectAddress != null) { hashCode = hashCode * 59 + CorrectAddress.GetHashCode(); } if (MemoExpected != null) { hashCode = hashCode * 59 + MemoExpected.GetHashCode(); } if (MemoPlaceholderText != null) { hashCode = hashCode * 59 + MemoPlaceholderText.GetHashCode(); } if (SimilarToExistingService != null) { hashCode = hashCode * 59 + SimilarToExistingService.GetHashCode(); } if (Balances != null) { hashCode = hashCode * 59 + Balances.GetHashCode(); } return(hashCode); } }
public Task defining_the_same_account_throws(AccountName accountName, AccountNumber accountNumber) => new Scenario() .Given(ChartOfAccounts.Identifier, new AccountDefined { AccountName = accountName.ToString(), AccountNumber = accountNumber.ToInt32() }) .When(new DefineAccount { AccountName = accountName.ToString(), AccountNumber = accountNumber.ToInt32() }) .Throws(new AccountExistsException(accountNumber)) .Assert(_handler, _facts);
public Task reactivating_an_account_when_it_was_not_defined_throws(AccountName accountName, AccountNumber accountNumber, AccountNumber secondAccountNumber) => new Scenario() .Given(ChartOfAccounts.Identifier, new AccountDefined { AccountName = accountName.ToString(), AccountNumber = accountNumber.ToInt32() }) .When(new ReactivateAccount { AccountNumber = secondAccountNumber.ToInt32() }) .Throws(new AccountNotFoundException(secondAccountNumber)) .Assert(_handler, _facts);
public override bool Equals(object obj) { if (null == obj) { return(false); } if (obj.GetType() != GetType()) { return(false); } return(AccountNumber.Equals(((Account)obj).AccountNumber)); }
public async Task <IActionResult> Create([Bind("AccountNumberId,BankId,Account")] AccountNumber accountNumber) { if (ModelState.IsValid) { _context.Add(accountNumber); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BankId"] = new SelectList(_context.Banks, "BankId", "BankName", accountNumber.BankId); return(PartialView(accountNumber)); }
public Task defining_the_same_account_throws(AccountName accountName, AccountNumber accountNumber) => new Scenario() .Given("chartOfAccounts", new AccountDefined { AccountName = accountName.ToString(), AccountNumber = accountNumber.ToInt32() }) .When(new DefineAccount { AccountName = accountName.ToString(), AccountNumber = accountNumber.ToInt32() }) .Throws(new InvalidOperationException()) .Assert(_handler, _facts);
public string CheckBank(AccountNumber accountNumber) { string BankName; var fundBank = BamkList.ListAllBank.Find(bank => bank.BranchBankId.Equals(accountNumber.AcountNumber.Substring(2, 8))); if (fundBank == null) { BankName = "Nie ma takiego banku"; } else { BankName = string.Format("Nazwa banku: {0} oddział w {1}", fundBank.BankName, fundBank.BranchBankName); } return BankName; }
public void TestMethod1() { AccountNumber number = new AccountNumber("86102024981111222233334444"); if (number.AcountNumber.Length == 26) { BankAccountNumber bankAccount = new BankAccountNumber(); string test= bankAccount.CheckBank(number); } else if (number.AcountNumber.Length == 28) { TheInternationalBankAccountNumber bankAccount = new TheInternationalBankAccountNumber(); string test = bankAccount.CheckBank(number); } else { string test = "Błędny numer konta bankowego"; } }
public DebitTransferFailed(Amount amount, AccountNumber account) : base(amount, account) { }
public CancelAccount(AccountNumber accountNumber) { Mandate.ParameterNotNullOrEmpty(accountNumber, "accountNumber"); AccountNumber = accountNumber; }
public ClientPassedAway(ClientId clientId, AccountNumber accountNumber) { ClientId = clientId; AccountNumber = accountNumber; }
private AccountModel FetchModel(AccountNumber accountNumber) { return repository.GetQueryable<AccountModel>().First(account => account.AccountNumber == accountNumber.Id); }
public void ArgumentOutOfRangeExceptionTest() { acnSut = new AccountNumber("123456-123456568"); }
public void ArgumentErrorExceptionTest() { acnSut = new AccountNumber(""); }
public CreditTransfer(Amount amount, AccountNumber account) : base(amount, account) { }
public DebitMutation(Amount amount, AccountNumber account) : base(amount, account) { }
public AccountStatusChanged(AccountNumber accountNumber, AccountStatus status) { Status = status; AccountNumber = accountNumber; }
public AccountBilled(AccountNumber accountNumber, Recency recency) { Recency = recency; AccountNumber = accountNumber; }
void IHandleClientStateTransitions.When(AccountAssingedToClient @event) { AccountNumber = @event.AccountNumber; }
protected Ledger(Amount amount, AccountNumber account) { Amount = amount; Account = account; }
private string Act_OutputFor(Digit[] digits) { var accountNumber = new AccountNumber(digits); return OutputPrinter.PrintNumberRepresentation(accountNumber); }