using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CY.IDAL;
using CY.Model;
using AbstractFactory;
using CY.Infrastructure.Query;
using System.Data;
namespace CY.BLL.OA
{
public class OA_PaperWeightBLL
{
IOA_PaperWeightDAL brandDal = null;
public OA_PaperWeightBLL()
{
brandDal = Factory.GetDALByInterfaceName(DALInterface.IOA_PaperWeightDAL) as IOA_PaperWeightDAL;
}
///
/// 插入一个品牌
///
///
///
public bool InsertModel(OA_PaperWeight model)
{
return brandDal.InserModel(model);
}
///
/// 更新品牌
///
///
///
public bool UpdateModel(OA_PaperWeight model)
{
return brandDal.UpdateModel(model);
}
public bool DeleteModel(OA_PaperWeight model)
{
return brandDal.DeleteModel(model);
}
///
/// 获取全部品牌
///
///
///
///
///
public IEnumerable getAllBrand(Pagination pa, Guid FirmId, string PaperweightName, string GoodsName)
{
return brandDal.getAllBrand(pa, FirmId, PaperweightName, GoodsName);
}
public DataTable getAllBrand(Guid FirmId)
{
return brandDal.getAllBrand(FirmId);
}
public DataTable getPaperWeight(Guid FrimId, string CommodityId, string GoodsId)
{
return brandDal.getPaperWeight(FrimId, CommodityId, GoodsId);
}
///
/// 获取单个品牌
///
///
///
public Model.OA_PaperWeight getSingleBrand(string Keyid)
{
return brandDal.getSingleBrand(Keyid);
}
///
/// 克重名称是否存在
///
///
///
///
///
///
public bool isExistPaperWeightName(String Name, Guid FirmId, int ID, int GoodsId)
{
return brandDal.isExistPaperWeightName(Name, FirmId, ID, GoodsId);
}
///
/// 获取全部货品Id
///
///
///
///
///
public IEnumerable getAllPaperWeight(Pagination pa, Guid FirmId, string PaperWeightName, string GoodsName)
{
IEnumerable SpecificationList = brandDal.getAllPaperWeight(pa, FirmId, PaperWeightName, GoodsName);
IList templist = new List();
if (SpecificationList != null)
{
foreach (OA_PaperWeight model in SpecificationList)
{
templist.Add(getModel(model.GoodsId.ToString()));
}
}
return templist;
}
///
/// 根据货品Id获取所对应的规格
///
///
///
public OA_PaperWeight getModel(string GoodsId)
{
IList OldList = brandDal.getAllModelByGoodsId(GoodsId).ToList();
OA_PaperWeight model = new OA_PaperWeight();
if (OldList != null && OldList.Count() > 0)
{
model.CommodityId = OldList[0].CommodityId;
model.CommodityName = OldList[0].CommodityName;
model.FirmId = OldList[0].FirmId;
model.GoodsId = OldList[0].GoodsId;
model.GoodsName = OldList[0].GoodsName;
model.Keyid = OldList[0].Keyid;
model.LastUpdateTime = OldList[0].LastUpdateTime;
model.Operator = OldList[0].Operator;
model.OrderNum = OldList[0].OrderNum;
foreach (OA_PaperWeight modl in OldList)
{
model.Name += modl.Name.ToString() + "|";
}
if (!string.IsNullOrEmpty(model.Name))
{
model.Name = model.Name.Substring(0, model.Name.Length - 1);
}
}
return model;
}
public IEnumerable getAllModelByGoodsId(Pagination pa, string GoodsId)
{
return brandDal.getAllModelByGoodsId(pa, GoodsId);
}
}
}