Пример #1
0
        /// <summary>
        ///     Returns true if AccountOverviewViewModel instances are equal
        /// </summary>
        /// <param name="other">Instance of AccountOverviewViewModel to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(AccountOverviewViewModel other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AccountId == other.AccountId ||
                     AccountId != null &&
                     AccountId.Equals(other.AccountId)
                     ) &&
                 (
                     BankId == other.BankId ||
                     BankId != null &&
                     BankId.Equals(other.BankId)
                 ) &&
                 (
                     AccountNumber == other.AccountNumber ||
                     AccountNumber != null &&
                     AccountNumber.Equals(other.AccountNumber)
                 ));
        }
Пример #2
0
        /// <summary>
        ///     Returns true if CreateUserViewModel instances are equal
        /// </summary>
        /// <param name="other">Instance of CreateUserViewModel to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(CreateUserViewModel other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Username == other.Username ||
                     Username != null &&
                     Username.Equals(other.Username)
                     ) &&
                 (
                     BankId == other.BankId ||
                     BankId != null &&
                     BankId.Equals(other.BankId)
                 ) &&
                 (
                     AccountNumber == other.AccountNumber ||
                     AccountNumber != null &&
                     AccountNumber.Equals(other.AccountNumber)
                 ));
        }
        public async Task <IActionResult> Create([Bind(properties)] AccountView c)
        {
            c.ID = BankId.NewBankId();
            await validateId(c.ID, ModelState);

            if (!ModelState.IsValid)
            {
                return(View(c));
            }
            c.Balance = 500;
            c.Status  = Status.Active.ToString();
            //c.Type = Enum.GetName(typeof(CardType), int.Parse(c.Type));
            var loggedInUser = await userManager.GetUserAsync(HttpContext.User);

            c.AspNetUserId = loggedInUser.Id;
            var o = AccountFactory.CreateAccount(c.ID, c.Balance, c.Type, c.Status, c.AspNetUserId,
                                                 c.ValidFrom = DateTime.Now, c.ValidTo = DateTime.Now.AddYears(2));
            await repository.AddObject(o);

            await _bankHub.Clients.All.SendAsync("NewAccount", c.ID, c.Type, c.Balance, c.Status, c.ValidTo.Value.Date.ToShortDateString());

            await createWelcomeNotification(c.ID);
            await createWelcomeTransaction(c.ID);

            return(RedirectToAction("Index", "Home"));
        }
Пример #4
0
 public Hkidn(int number, int blz, string userId, string systemId = "0")
 {
     Header     = new SegmentHeader("HKIDN", 2, number);
     BankId     = new BankId(blz);
     CustomerId = new AlphanumericElement(userId);
     SystemId   = new AlphanumericElement(systemId);
     Status     = new NumericElement(1);
 }
Пример #5
0
        /// <summary>
        ///     Returns true if AccountDetailsViewModel instances are equal
        /// </summary>
        /// <param name="other">Instance of AccountDetailsViewModel to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(AccountDetailsViewModel other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AccountId == other.AccountId ||
                     AccountId != null &&
                     AccountId.Equals(other.AccountId)
                     ) &&
                 (
                     BankId == other.BankId ||
                     BankId != null &&
                     BankId.Equals(other.BankId)
                 ) &&
                 (
                     AccountNumber == other.AccountNumber ||
                     AccountNumber != null &&
                     AccountNumber.Equals(other.AccountNumber)
                 ) &&
                 (
                     SortCode == other.SortCode ||
                     SortCode != null &&
                     SortCode.Equals(other.SortCode)
                 ) &&
                 (
                     AccountName == other.AccountName ||
                     AccountName != null &&
                     AccountName.Equals(other.AccountName)
                 ) &&
                 (
                     CurrentBalance == other.CurrentBalance ||
                     CurrentBalance != null &&
                     CurrentBalance.Equals(other.CurrentBalance)
                 ) &&
                 (
                     OverdraftLimit == other.OverdraftLimit ||
                     OverdraftLimit != null &&
                     OverdraftLimit.Equals(other.OverdraftLimit)
                 ));
        }
Пример #6
0
 /// <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 (BankId != null)
         {
             hashCode = hashCode * 59 + BankId.GetHashCode();
         }
         if (AccountNumber != null)
         {
             hashCode = hashCode * 59 + AccountNumber.GetHashCode();
         }
         return(hashCode);
     }
 }
Пример #7
0
        private void ValidateEmpfaengerBankId()
        {
            if (Empfaenger.BankID != null && !BankId.IsStringBankId(Empfaenger.BankID.Art))
            {
                AddHinweisFromErrorCode(Enums.Fehlercode.F144);
            }

            if (!RoutingTableReader.Mappings.Any(m => string.Equals(m.BLZ, Empfaenger.BankID.Wert)))
            {
                AddHinweisFromErrorCode(Enums.Fehlercode.F131);
            }

            Regex regex = new Regex("[0-9]{8}");

            if (Empfaenger.BankID?.Wert != null && !regex.Match(Empfaenger.BankID.Wert).Success)
            {
                AddHinweisFromErrorCode(Enums.Fehlercode.F135);
            }
        }
        protected void Validbankidsequence(Object source, ValidatorEventArgs args)
        {
            if (BankId.Trim() != "")
            {
                if ((BankId.Length == 9) && (CSAAWeb.Validate.IsAllNumeric(BankId)))
                {
                    args.IsValid = !(BankId.Substring(8, 1) != RoutingNumberCheckDigit(BankId.Substring(0, 8)));
                }
                else
                {
                    args.IsValid = false;
                }

                if (!args.IsValid)
                {
                    vldBankidnumber.MarkInvalid();
                    vldBankidnumber.ErrorMessage = "";
                }
            }
        }
Пример #9
0
 /// <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 (AccountId != null)
         {
             hashCode = hashCode * 59 + AccountId.GetHashCode();
         }
         if (BankId != null)
         {
             hashCode = hashCode * 59 + BankId.GetHashCode();
         }
         if (AccountNumber != null)
         {
             hashCode = hashCode * 59 + AccountNumber.GetHashCode();
         }
         if (SortCode != null)
         {
             hashCode = hashCode * 59 + SortCode.GetHashCode();
         }
         if (AccountName != null)
         {
             hashCode = hashCode * 59 + AccountName.GetHashCode();
         }
         if (CurrentBalance != null)
         {
             hashCode = hashCode * 59 + CurrentBalance.GetHashCode();
         }
         if (OverdraftLimit != null)
         {
             hashCode = hashCode * 59 + OverdraftLimit.GetHashCode();
         }
         return(hashCode);
     }
 }
Пример #10
0
 private static string addAccount(ApplicationDbContext c, AccountData data)
 {
     data.ID = BankId.NewBankId();
     c.Accounts.Add(data);
     return(data.ID);
 }
Пример #11
0
        public string ToSql()
        {
            var sql = new StringWriter();

            sql.WriteLine("MERGE ExchangeRate AS Target");
            sql.WriteLine("USING (SELECT {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}) As Source (BankId, DayOfYear, Year, Date, Month, MonthName, DayName, UtcLastUpdateOn, BuyRate, SaleRate)", BankId.ToSql(), DayOfYear.ToSql(), Year.ToSql(), Date.ToSql(), Month.ToSql(), MonthName.ToSql(), DayName.ToSql(), UtcLastUpdateOn.ToSql(), BuyRate.ToSql(), SaleRate.ToSql());
            sql.WriteLine("ON Target.BankId = {0} And Target.DayOfYear = {1} And Target.Year = {2}", BankId.ToSql(), DayOfYear.ToSql(), Year.ToSql());
            sql.WriteLine("WHEN MATCHED THEN");
            sql.WriteLine(" UPDATE SET Month = {0}, MonthName = {1}, DayName = {2}, UtcLastUpdateOn = {3}, BuyRate = {4}, SaleRate = {5}", Month.ToSql(), MonthName.ToSql(), DayName.ToSql(), UtcLastUpdateOn.ToSql(), BuyRate.ToSql(), SaleRate.ToSql());
            sql.WriteLine("WHEN NOT MATCHED THEN");
            sql.WriteLine(" INSERT (BankId, DayOfYear, Year, Date, Month, MonthName, DayName, UtcLastUpdateOn, BuyRate, SaleRate)");
            sql.WriteLine(" VALUES ({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9});", BankId.ToSql(), DayOfYear.ToSql(), Year.ToSql(), Date.ToSql(), Month.ToSql(), MonthName.ToSql(), DayName.ToSql(), UtcLastUpdateOn.ToSql(), BuyRate.ToSql(), SaleRate.ToSql());
            return(sql.ToString());
        }
Пример #12
0
 [TestMethod] public void IsIdTypeOfStringTest()
 {
     Assert.IsTrue(BankId.NewBankId().GetType() == typeof(string));
 }
Пример #13
0
 [TestMethod] public void IsNotNullTest()
 {
     Assert.IsNotNull(BankId.NewBankId());
 }