Beispiel #1
0
 /// <summary>
 /// IBAN object with type information
 /// </summary>
 /// <param name="iban">IBAN</param>
 /// <param name="ibanType">Type of IBAN (normal or QR-IBAN)</param>
 public Iban(string iban, IbanType ibanType)
 {
     if (!IsValidIban(iban))
     {
         throw new SwissQrCodeIbanException("The IBAN entered isn't valid.");
     }
     if (!iban.StartsWith("CH") && !iban.StartsWith("LI"))
     {
         throw new SwissQrCodeIbanException("The IBAN must start with \"CH\" or \"LI\".");
     }
     this.iban     = iban;
     this.ibanType = ibanType;
 }
Beispiel #2
0
            /// <summary>
            /// IBAN object with type information
            /// </summary>
            /// <param name="iban">IBAN</param>
            /// <param name="ibanType">Type of IBAN (normal or QR-IBAN)</param>
            public Iban(string iban, IbanType ibanType)
            {
                MyRes res = new MyRes("Messages,Swiss");

                if (ibanType == IbanType.Iban && !IsValidIban(iban))
                {
                    throw new SwissQrCodeException(res.Get("SwissIbanNotValid"));
                }
                if (ibanType == IbanType.QrIban && !IsValidQRIban(iban))
                {
                    throw new SwissQrCodeException(res.Get("SwissQRIbanNotValid"));
                }
                if (!iban.StartsWith("CH") && !iban.StartsWith("LI"))
                {
                    throw new SwissQrCodeException("SwissQRStartNotValid");
                }
                this.iban     = iban;
                this.ibanType = ibanType;
            }