
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Com.FirmLib.Entity;
using Com.FirmLib.UI.Common.Model;
using FWindSoft.SystemExtensions;

namespace Com.FirmLib.UI.Maintainer
{
    public static class MaintainerDataConverter
    {
        public static AssetShowItem ConvertShowItem(MaintainerAssetItem dataItem)
        {
            var showItem = new AssetShowItem();
            showItem.FamilyCode = dataItem.Category;
            showItem.EquipName = dataItem.Asset.EquipName;
            showItem.Id = dataItem.Id;
            showItem.LocalName = dataItem.Asset.EquipLocalName;
            showItem.LocalCode = dataItem.Asset.EquipLocalId;
            showItem.Brand = dataItem.Asset.Brand;
            showItem.Product = dataItem.Asset.Product;
            showItem.Type = dataItem.Asset.Specification;

            showItem.ChangeMaintainer = dataItem.ChnageMaintainer;
            showItem.MaintainerEndDate = dataItem.Asset.MaintainDeadline;
            showItem.MaintainPeriod = (int)dataItem.Asset.MaintainPeriod.ToDouble();

            showItem.MaintainerId = dataItem.Asset.DpMaintainerId;
            return showItem;
        }
    }
}
