public BankEnum GetEnumForCard() { try { var bankEnum = BankEnum.Unknwon; if (IsCorrect || !IsCheckCardValidation) { EnumBankCollection bankCollection = BankEnumUtilities.ListBankEnum(typeof(BankEnum)); foreach (var item in bankCollection) { if (item.CardFormat.Any(t => t == _cardNumber.Substring(0, 6))) { if (!Enum.TryParse(item.Name, out bankEnum)) { return(bankEnum); } return(bankEnum); } } } return(bankEnum); } catch (Exception ex) { _errorMessage = ex; return(BankEnum.None); } }
public BankEnum GetEnumForSheba() { try { var bankEnum = BankEnum.Unknwon; if (IsCorrect) { EnumBankCollection bankCollection = BankEnumUtilities.ListBankEnum(typeof(BankEnum)); foreach (var item in bankCollection) { if (item.ShebaFormat.Any(t => t == _shebaNumber.Substring(4, 3))) { if (!Enum.TryParse(item.Name, out bankEnum)) { return(bankEnum); } return(bankEnum); } } } return(bankEnum); } catch (Exception ex) { _errorMessage = ex; return(BankEnum.None); } }