public void ConvertAccountToSheba(BankCodeEnum bank) { try { if (string.IsNullOrEmpty(_AccountNumber) || string.IsNullOrWhiteSpace(_AccountNumber)) { throw new Exception("شماره حساب مقدار ندارد"); } string sheba = "0"; sheba += Convert.ToInt32(bank).ToString(); for (int i = _AccountNumber.Length; i < 19; i++) { sheba += "0"; } sheba += _AccountNumber + "182700"; decimal numSheba = Convert.ToDecimal(sheba); decimal re = numSheba % 97; int chk = Convert.ToInt32(98 - re); _ShebaNumber = "IR" + ((chk <= 9) ? "0" + chk.ToString() : chk.ToString()) + sheba.Substring(0, 22); } catch (Exception ex) { _Exception = ex; return; } }
private BankCodeEnum getBankEnum() { try { BankCodeEnum _enum = BankCodeEnum.Noor; string re = Convert.ToInt32(BankCode).ToString(); if (!Enum.TryParse(re, out _enum)) { throw new Exception("کد بانک قابل محاسبه نمی باشد"); } return((BankCodeEnum)_enum); } catch (Exception ex) { _Exception = ex; return(BankCodeEnum.Noor); } }