/// <summary> /// 获取 <see cref="IRepaymentCalc"/> 还款计算器. /// </summary> /// <value> /// 还款计算器 <see cref="IRepaymentCalc"/>. /// </value> /// <param name="dtype">结算方式</param> /// <param name="reType">还款模型</param> /// <param name="startDate">开始结算时间</param> /// <returns></returns> public IRepaymentCalc this[RepaymentTimeUnitType dtype, RepaymentType reType, DateTime startDate] { get { if (reType == RepaymentType.期付息N期还本) { throw new ArgumentException("该方法不能创建按期付息N期还本之本金固定"); } if (reType == RepaymentType.期付息L期还本) { throw new ArgumentException("该方法不能创建按期付息N期还本之本金缩小"); } switch (reType) { case RepaymentType.等额本息: return(new 等额本息(dtype, startDate)); case RepaymentType.等额本金: return(new 等额本金(dtype, startDate)); default: case RepaymentType.一次性还本付息: return(new 一次性还本付息(dtype, startDate)); case RepaymentType.期付息到期还本: return(new 期付息到期还本(dtype, startDate)); case RepaymentType.等本等息: return(new 等本等息(dtype, startDate)); } } }
/// <summary> /// 获取 <see cref="IRepaymentCalc"/> 还款计算器. /// </summary> /// <value> /// 还款计算器 <see cref="IRepaymentCalc"/>. /// </value> /// <param name="dtype">结算方式</param> /// <param name="reType">还款模型</param> /// <returns></returns> public IRepaymentCalc this[RepaymentTimeUnitType dtype, RepaymentType reType] { get { return(this[dtype, reType, DateTime.Now]); } }
/// <summary> /// 获取 <see cref="IRepaymentCalc"/> 还款计算器. /// </summary> /// <value> /// 还款计算器 <see cref="IRepaymentCalc"/>. /// </value> /// <param name="dtype">结算方式</param> /// <param name="reType">还款模型</param> /// <param name="principalPeriods">本金的还款信息</param> /// <returns></returns> public IRepaymentCalc this[RepaymentTimeUnitType dtype, RepaymentType reType, IEnumerable <PrincipalRepayPercent> principalPeriods] { get { return(this[dtype, reType, principalPeriods, DateTime.Now]); } }
/// <summary> /// 获取 <see cref="IRepaymentCalc"/> 还款计算器. /// </summary> /// <value> /// 还款计算器 <see cref="IRepaymentCalc"/>. /// </value> /// <param name="dtype">结算方式</param> /// <param name="principalPeriods">本金的还款信息</param> /// <param name="reType">还款模型</param> /// <param name="startDate">开始结算时间</param> /// <returns></returns> public IRepaymentCalc this[RepaymentTimeUnitType dtype, RepaymentType reType, IEnumerable <PrincipalRepayPercent> principalPeriods, DateTime startDate] { get { switch (reType) { case RepaymentType.本金按百分比还: return(new 本金按百分比还(dtype, startDate, principalPeriods)); } return(this[dtype, reType, startDate]); } }
/// <summary> /// 获取 <see cref="IRepaymentCalc"/> 还款计算器. /// </summary> /// <value> /// 还款计算器 <see cref="IRepaymentCalc"/>. /// </value> /// <param name="dtype">结算方式</param> /// <param name="principalPeriods">本金的还款信息</param> /// <param name="reType">还款模型</param> /// <param name="startDate">开始结算时间</param> /// <returns></returns> public IRepaymentCalc this[RepaymentTimeUnitType dtype, RepaymentType reType, IEnumerable <PrincipalRepayType> principalPeriods, DateTime startDate] { get { switch (reType) { case RepaymentType.期付息L期还本: return(new 期付息L期还本(dtype, startDate, principalPeriods)); case RepaymentType.期付息N期还本: return(new 期付息N期还本(dtype, startDate, principalPeriods)); } return(this[dtype, reType, startDate]); } }
/// <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 (OriginalStartDate != null) { hashCode = hashCode * 59 + OriginalStartDate.GetHashCode(); } if (OriginalLoanAmount != null) { hashCode = hashCode * 59 + OriginalLoanAmount.GetHashCode(); } if (OriginalLoanCurrency != null) { hashCode = hashCode * 59 + OriginalLoanCurrency.GetHashCode(); } if (LoanEndDate != null) { hashCode = hashCode * 59 + LoanEndDate.GetHashCode(); } if (NextInstalmentDate != null) { hashCode = hashCode * 59 + NextInstalmentDate.GetHashCode(); } if (MinInstalmentAmount != null) { hashCode = hashCode * 59 + MinInstalmentAmount.GetHashCode(); } if (MinInstalmentCurrency != null) { hashCode = hashCode * 59 + MinInstalmentCurrency.GetHashCode(); } if (MaxRedraw != null) { hashCode = hashCode * 59 + MaxRedraw.GetHashCode(); } if (MaxRedrawCurrency != null) { hashCode = hashCode * 59 + MaxRedrawCurrency.GetHashCode(); } if (MinRedraw != null) { hashCode = hashCode * 59 + MinRedraw.GetHashCode(); } if (MinRedrawCurrency != null) { hashCode = hashCode * 59 + MinRedrawCurrency.GetHashCode(); } if (OffsetAccountEnabled != null) { hashCode = hashCode * 59 + OffsetAccountEnabled.GetHashCode(); } if (OffsetAccountIds != null) { hashCode = hashCode * 59 + OffsetAccountIds.GetHashCode(); } if (RepaymentFrequency != null) { hashCode = hashCode * 59 + RepaymentFrequency.GetHashCode(); } if (RepaymentType != null) { hashCode = hashCode * 59 + RepaymentType.GetHashCode(); } if (LoanPurpose != null) { hashCode = hashCode * 59 + LoanPurpose.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if BankingLoanAccount instances are equal /// </summary> /// <param name="other">Instance of BankingLoanAccount to be compared</param> /// <returns>Boolean</returns> public bool Equals(BankingLoanAccount other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( OriginalStartDate == other.OriginalStartDate || OriginalStartDate != null && OriginalStartDate.Equals(other.OriginalStartDate) ) && ( OriginalLoanAmount == other.OriginalLoanAmount || OriginalLoanAmount != null && OriginalLoanAmount.Equals(other.OriginalLoanAmount) ) && ( OriginalLoanCurrency == other.OriginalLoanCurrency || OriginalLoanCurrency != null && OriginalLoanCurrency.Equals(other.OriginalLoanCurrency) ) && ( LoanEndDate == other.LoanEndDate || LoanEndDate != null && LoanEndDate.Equals(other.LoanEndDate) ) && ( NextInstalmentDate == other.NextInstalmentDate || NextInstalmentDate != null && NextInstalmentDate.Equals(other.NextInstalmentDate) ) && ( MinInstalmentAmount == other.MinInstalmentAmount || MinInstalmentAmount != null && MinInstalmentAmount.Equals(other.MinInstalmentAmount) ) && ( MinInstalmentCurrency == other.MinInstalmentCurrency || MinInstalmentCurrency != null && MinInstalmentCurrency.Equals(other.MinInstalmentCurrency) ) && ( MaxRedraw == other.MaxRedraw || MaxRedraw != null && MaxRedraw.Equals(other.MaxRedraw) ) && ( MaxRedrawCurrency == other.MaxRedrawCurrency || MaxRedrawCurrency != null && MaxRedrawCurrency.Equals(other.MaxRedrawCurrency) ) && ( MinRedraw == other.MinRedraw || MinRedraw != null && MinRedraw.Equals(other.MinRedraw) ) && ( MinRedrawCurrency == other.MinRedrawCurrency || MinRedrawCurrency != null && MinRedrawCurrency.Equals(other.MinRedrawCurrency) ) && ( OffsetAccountEnabled == other.OffsetAccountEnabled || OffsetAccountEnabled != null && OffsetAccountEnabled.Equals(other.OffsetAccountEnabled) ) && ( OffsetAccountIds == other.OffsetAccountIds || OffsetAccountIds != null && OffsetAccountIds.SequenceEqual(other.OffsetAccountIds) ) && ( RepaymentFrequency == other.RepaymentFrequency || RepaymentFrequency != null && RepaymentFrequency.Equals(other.RepaymentFrequency) ) && ( RepaymentType == other.RepaymentType || RepaymentType != null && RepaymentType.Equals(other.RepaymentType) ) && ( LoanPurpose == other.LoanPurpose || LoanPurpose != null && LoanPurpose.Equals(other.LoanPurpose) )); }