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;
|
|
}
|
|
/// <summary>
|
/// 插入一个品牌
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
public bool InsertModel(OA_PaperWeight model)
|
{
|
return brandDal.InserModel(model);
|
|
}
|
|
/// <summary>
|
/// 更新品牌
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
public bool UpdateModel(OA_PaperWeight model)
|
{
|
return brandDal.UpdateModel(model);
|
|
}
|
|
public bool DeleteModel(OA_PaperWeight model)
|
{
|
return brandDal.DeleteModel(model);
|
}
|
|
/// <summary>
|
/// 获取全部品牌
|
/// </summary>
|
/// <param name="pa"></param>
|
/// <param name="FirmId"></param>
|
/// <param name="BrandName"></param>
|
/// <returns></returns>
|
public IEnumerable<Model.OA_PaperWeight> 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);
|
}
|
|
/// <summary>
|
/// 获取单个品牌
|
/// </summary>
|
/// <param name="Keyid"></param>
|
/// <returns></returns>
|
public Model.OA_PaperWeight getSingleBrand(string Keyid)
|
{
|
return brandDal.getSingleBrand(Keyid);
|
}
|
|
/// <summary>
|
/// 克重名称是否存在
|
/// </summary>
|
/// <param name="Name"></param>
|
/// <param name="FirmId"></param>
|
/// <param name="ID"></param>
|
/// <param name="GoodsId"></param>
|
/// <returns></returns>
|
public bool isExistPaperWeightName(String Name, Guid FirmId, int ID, int GoodsId)
|
{
|
return brandDal.isExistPaperWeightName(Name, FirmId, ID, GoodsId);
|
}
|
|
/// <summary>
|
/// 获取全部货品Id
|
/// </summary>
|
/// <param name="pa"></param>
|
/// <param name="FirmId"></param>
|
/// <param name="BrandName"></param>
|
/// <returns></returns>
|
public IEnumerable<Model.OA_PaperWeight> getAllPaperWeight(Pagination pa, Guid FirmId, string PaperWeightName, string GoodsName)
|
{
|
|
IEnumerable<OA_PaperWeight> SpecificationList = brandDal.getAllPaperWeight(pa, FirmId, PaperWeightName, GoodsName);
|
IList<OA_PaperWeight> templist = new List<OA_PaperWeight>();
|
if (SpecificationList != null)
|
{
|
foreach (OA_PaperWeight model in SpecificationList)
|
{
|
templist.Add(getModel(model.GoodsId.ToString()));
|
}
|
}
|
|
return templist;
|
|
|
}
|
|
/// <summary>
|
/// 根据货品Id获取所对应的规格
|
/// </summary>
|
/// <param name="GoodsId"></param>
|
/// <returns></returns>
|
public OA_PaperWeight getModel(string GoodsId)
|
{
|
IList<Model.OA_PaperWeight> OldList = brandDal.getAllModelByGoodsId(GoodsId).ToList<OA_PaperWeight>();
|
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<Model.OA_PaperWeight> getAllModelByGoodsId(Pagination pa, string GoodsId)
|
{
|
return brandDal.getAllModelByGoodsId(pa, GoodsId);
|
}
|
}
|
}
|