本文整理汇总了C#中ModulusChecking.Models.BankAccountDetails.ToCombinedString方法的典型用法代码示例。如果您正苦于以下问题:C# BankAccountDetails.ToCombinedString方法的具体用法?C# BankAccountDetails.ToCombinedString怎么用?C# BankAccountDetails.ToCombinedString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModulusChecking.Models.BankAccountDetails
的用法示例。
在下文中一共展示了BankAccountDetails.ToCombinedString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetModulusSum
public int GetModulusSum(BankAccountDetails bankAccountDetails, ModulusWeightMapping weightMapping)
{
var combinedValue = bankAccountDetails.ToCombinedString();
if (combinedValue.Length != 14)
{
throw new Exception(
string.Format("Combined SortCode and Account Number should be 14 characters long not {0}: {1}",
combinedValue.Length, combinedValue));
}
var sum = 0;
for (var i = 0; i < 14; i++)
{
sum += (int.Parse(combinedValue[i].ToString(CultureInfo.InvariantCulture)) * weightMapping.WeightValues[i]);
}
return sum;
}
示例2: GetModulusSum
public int GetModulusSum(BankAccountDetails bankAccountDetails, IModulusWeightMapping weightMapping)
{
var combinedValue = bankAccountDetails.ToCombinedString();
if (combinedValue.Length != 14)
{
throw new Exception(
String.Format("Combined SortCode and Account Number should be 14 characters long not {0}: {1}",
combinedValue.Length, combinedValue));
}
var sum = 0;
for (var i = 0; i < 14; i++)
{
var multiplicationResult = (Int16.Parse(combinedValue[i].ToString(CultureInfo.InvariantCulture)) * weightMapping.WeightValues[i]);
sum += GetIntArray(multiplicationResult).Sum();
}
if (weightMapping.Exception == 1)
{
sum += 27;
}
return sum;
}