namespace Yw.Application
{
///
///
///
public class PumpCurveExpressToolInput : IValidatableObject
{
///
/// 流量扬程拟合类型
///
public eFitType FitTypeQH { get; set; }
///
/// 流量功率拟合类型
///
public eFitType FitTypeQP { get; set; }
///
/// 流量效率拟合类型
///
public eFitType FitTypeQE { get; set; }
///
/// 流量扬程点数量
///
public int? PointNumberQH { get; set; }
///
/// 流量功率点数量
///
public int? PointNumberQP { get; set; }
///
/// 流量效率点数量
///
public int? PointNumberQE { get; set; }
///
/// 定义点列表
///
public List DefinePoints { get; set; }
///
///
///
public IEnumerable Validate(ValidationContext validationContext)
{
if (this.DefinePoints == null || this.DefinePoints.Count < 4)
{
yield return new ValidationResult("DefinePoints 数量不足,至少4个点", new string[] { nameof(DefinePoints) });
}
var fitPowQH = FitHelper.GetFitPow(this.FitTypeQH);
if (this.DefinePoints.Count < fitPowQH + 1)
{
yield return new ValidationResult($"DefinePoints 数量不足,至少{fitPowQH + 1}个点", new string[] { nameof(DefinePoints) });
}
if (this.PointNumberQH.HasValue)
{
if (this.PointNumberQH.Value < 6)
{
yield return new ValidationResult($"PointNumberQH 不能小于6", new string[] { nameof(PointNumberQH) });
}
}
var fitPowQP = FitHelper.GetFitPow(this.FitTypeQP);
if (this.DefinePoints.Count < fitPowQP + 1)
{
yield return new ValidationResult($"DefinePoints 数量不足,至少{fitPowQP + 1}个点", new string[] { nameof(DefinePoints) });
}
if (this.PointNumberQP.HasValue)
{
if (this.PointNumberQP.Value < 6)
{
yield return new ValidationResult($"PointNumberQP 不能小于6", new string[] { nameof(PointNumberQP) });
}
}
var fitPowQE = FitHelper.GetFitPow(this.FitTypeQE);
if (this.DefinePoints.Count < fitPowQE + 1)
{
yield return new ValidationResult($"DefinePoints 数量不足,至少{fitPowQE + 1}个点", new string[] { nameof(DefinePoints) });
}
if (this.PointNumberQE.HasValue)
{
if (this.PointNumberQE.Value < 6)
{
yield return new ValidationResult($"PointNumberQE 不能小于6", new string[] { nameof(PointNumberQE) });
}
}
}
}
}