TG.WXCRM.V4/WEB/ViewModel/Level2/L2SoftProduct.cs

34 lines
1.0 KiB
C#

using Ninject;
using System.Collections.Generic;
using System.Linq;
using WX.CRM.IBLL.Util;
using WX.CRM.Model.Entity;
using WX.CRM.WebHelper.Infrastructure;
namespace WX.CRM.WEB.ViewModel.Level2
{
public class L2SoftProductHelper
{
private ICACHE_Q cacheQ = NinjectControllerFactory.ninjectKernel.Get<ICACHE_Q>();
private List<L2Soft_ProductDetail> ProductListDetail;
public L2SoftProductHelper()
{
ProductListDetail = cacheQ.GetProductDetail();
}
public L2Soft_ProductDetail getBigProduct(string ProductCode)
{
return ProductListDetail.FirstOrDefault(p => p.PRODUCTCODE == ProductCode);
}
public L2Soft_Product getProduct(string ProductCode)
{
List<L2Soft_Product> ProductList = new List<L2Soft_Product>();
foreach (var p in ProductListDetail)
{
ProductList.AddRange(p.softProduct);
}
return ProductList.FirstOrDefault(p => p.PRODUCTCODE == ProductCode);
}
}
}