using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Kingo.DataAnalysis.Model { public class ProgressModel { private int _Count = 0; private int _Value = 0; public string ProName { get; set; } /// /// 总个数 /// public int Count { get { return GetCount(); } set { _Count = value; } } /// /// 当前处理个数 /// public int Value { get { return GetValue(); } set { _Value = value; } } public double Percentage => Count == 0 ? 0 : Math.Round((double)Value / Count, 2); public List? SubProgress { get; set; } private int GetCount() { if (SubProgress != null) { _Count = SubProgress.Sum(s => s.Count); } return _Count; } private int GetValue() { if (SubProgress != null) { _Value = SubProgress.Sum(s => s.Value); } return _Value; } public ProgressModel GetProModel(string ProName) { if (this.ProName == ProName) return this; else if (SubProgress != null) { return SubProgress.FirstOrDefault(f => f.ProName == ProName); } else return null; } } }