using System.Collections.Generic;

namespace Stat.Items
{
    public class Column
    {
        public static List<Model.StatItem> Get(List<Model.StatItem> list, IList<Model.WebsiteStructure> role)
        {
            if (list != null && list.Count > 0)
            {
                foreach (Model.StatItem sunList in list)
                {
                    foreach (Model.WebsiteStructure item in role)
                    {
                        if (item.id == sunList.ID)
                        {                            
                            sunList.Name = item.Name.Length > 8 ? item.Name.Substring(0, 7) + ".." : item.Name;                            
                            break;
                        }                        
                    }
                    //其他
                    sunList.Name = sunList.Name ?? "其他";
                }
            }
            return list;
        }
    }
}
