using System;
using System.Collections.Generic;
using System.Text;
using Edu.Model.ViewModel.Course;
using Edu.Repository.Course;
using VT.FW.DB;
namespace Edu.Module.Course
{
public class PointModule
{
///
/// 点数产品仓储
///
private readonly RB_Point_GoodsRepository pointGoodsRepository = new RB_Point_GoodsRepository();
#region 点数商品
///
/// 获取列表
///
///
///
public List GetPointGoodsList(RB_Point_Goods_Extend where)
{
return pointGoodsRepository.GetPointGoodsList(where);
}
///
/// 分页列表
///
///
///
///
///
///
public List GetPointGoodsPageList(int pageIndex, int pageSize, out long rowsCount, RB_Point_Goods_Extend where)
{
return pointGoodsRepository.GetPointGoodsPageList(pageIndex, pageSize, out rowsCount, where);
}
///
/// 新增/修改点数商品
///
///
///
public bool SetPointGoods(RB_Point_Goods_Extend model)
{
if (model.ID == 0)
{
return pointGoodsRepository.Insert(model) > 0;
}
else
{
IDictionary fileds = new Dictionary
{
{ nameof(RB_Point_Goods_Extend.UpdateTime), model.UpdateTime },
{ nameof(RB_Point_Goods_Extend.UpdateBy), model.UpdateBy },
{ nameof(RB_Point_Goods_Extend.GoodsName), model.GoodsName },
{ nameof(RB_Point_Goods_Extend.GivePoint), model.GivePoint },
{ nameof(RB_Point_Goods_Extend.OriginalPrice), model.OriginalPrice },
{ nameof(RB_Point_Goods_Extend.SellingPrice), model.SellingPrice },
{ nameof(RB_Point_Goods_Extend.Sort), model.Sort },
{ nameof(RB_Point_Goods_Extend.CostPrice), model.CostPrice },
{ nameof(RB_Point_Goods_Extend.PonitNum), model.PonitNum }
};
IList auditrecordWhereHelpers = new List
{
new WhereHelper()
{
FiledName = nameof(RB_Point_Goods_Extend.ID),
FiledValue = model.ID,
OperatorEnum = OperatorEnum.Equal
},
new WhereHelper()
{
FiledName = nameof(RB_Point_Goods_Extend.Group_Id),
FiledValue = model.Group_Id,
OperatorEnum = OperatorEnum.Equal
}
};
return pointGoodsRepository.Update(fileds, auditrecordWhereHelpers);
}
}
///
/// 删除点数商品
///
///
///
public bool DeletePointGoods(RB_Point_Goods_Extend model)
{
IDictionary fileds = new Dictionary
{
{ nameof(RB_Point_Goods_Extend.UpdateTime), model.UpdateTime },
{ nameof(RB_Point_Goods_Extend.Status),1 }
};
IList auditrecordWhereHelpers = new List
{
new WhereHelper()
{
FiledName = nameof(RB_Point_Goods_Extend.ID),
FiledValue = model.ID,
OperatorEnum = OperatorEnum.Equal
},
new WhereHelper()
{
FiledName = nameof(RB_Point_Goods_Extend.Group_Id),
FiledValue = model.Group_Id,
OperatorEnum = OperatorEnum.Equal
}
};
return pointGoodsRepository.Update(fileds, auditrecordWhereHelpers);
}
#endregion
}
}