using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EMIS.DataLogic.Common.TeachingMaterial;
using EMIS.ViewModel.TeachingMaterial;
using Bowin.Common.Linq.Entity;
using EMIS.ViewModel;
namespace EMIS.CommonLogic.TeachingMaterial
{
public class StockInDetailServices : BaseServices, IStockInDetailServices
{
public StockInDetailDAL StockInDetailDAL { get; set; }
///
/// 加载列表项数据
///
public IGridResultSet GetStockInDetailViewGrid(ViewModel.ConfiguretView configuretView, Guid? schoolyearID, Guid? supplierID, Guid? teachingMaterialID, int pageIndex, int pageSize)
{
var query = StockInDetailDAL.GetStockInDetailGridView(x => true);
if (schoolyearID.HasValue)
query = query.Where(x => x.SchoolyearID == schoolyearID);
if (supplierID.HasValue)
query = query.Where(x => x.SupplierID == supplierID);
if (teachingMaterialID.HasValue)
query = query.Where(x => x.TeachingMaterialPoolID == teachingMaterialID);
if (!string.IsNullOrEmpty(configuretView.ConditionValue))
return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToGridResultSet(pageIndex, pageSize);
return query.OrderBy(x => x.TeachingMaterialCode).ToGridResultSet(pageIndex, pageSize);
}
///
/// Excel导出
///
public IList GetStockInDetailViewList(ViewModel.ConfiguretView configuretView, Guid? stockId)
{
var query = StockInDetailDAL.GetStockInDetailGridView(x => x.StockInID == stockId);
if (!string.IsNullOrEmpty(configuretView.ConditionValue))
return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToList();
return query.OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToList();
}
///
/// 删除明细数据
///
///
public void Delete(List stockInDetailIDs)
{
StockInDetailDAL.Delete(stockInDetailIDs);
}
public IList GetStockInDetailByStockInViewGrid(Guid? stockIn){
return StockInDetailDAL.GetStockInDetailGridView(x => x.StockInID == stockIn).OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToList();
}
public IGridResultSet GetStockInDetailViewGrid(Guid? stockIn, int pageIndex, int pageSize)
{
var query = StockInDetailDAL.GetStockInDetailGridView(x => x.StockInID == stockIn);
return query.OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x=>x.TeachingMaterialCode).ToGridResultSet(pageIndex, pageSize);
}
public IList GetStockInDetailViewList(ViewModel.ConfiguretView configuretView, Guid? schoolyearID, Guid? supplierID, DateTime? stockInDJTimeStart, DateTime? stockInDJTimeEnd)
{
var query = StockInDetailDAL.GetStockInDetailGridView(x => true);
if (schoolyearID.HasValue)
query = query.Where(x => x.SchoolyearID == schoolyearID);
if (supplierID.HasValue)
query = query.Where(x => x.SupplierID == supplierID);
//if (stockInDJTimeStart.HasValue)
// query = query.Where(x => x.StockInDJTime >= stockInDJTimeStart);
//if (stockInDJTimeEnd.HasValue)
// query = query.Where(x => x.StockInDJTime <= stockInDJTimeEnd);
if (!string.IsNullOrEmpty(configuretView.ConditionValue))
return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.StockInTime).ToList();
return query.OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToList();
}
public IGridResultSet GetStockInStatisticsViewGrid(ViewModel.ConfiguretView configuretView, Guid? schoolyearID, Guid? supplierID, Guid? teachingMaterialID, int pageIndex, int pageSize)
{
var query = StockInDetailDAL.GetStockInStatisticsGridView(x => x.RecordStatus == (int)CF_GeneralPurpose.IsYes);
if (schoolyearID.HasValue)
query = query.Where(x => x.SchoolyearID == schoolyearID);
if (supplierID.HasValue)
query = query.Where(x => x.SupplierID == supplierID);
if (teachingMaterialID.HasValue)
query = query.Where(x => x.TeachingMaterialPoolID == teachingMaterialID);
if (!string.IsNullOrEmpty(configuretView.ConditionValue))
return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.TeachingMaterialCode).ToGridResultSet(pageIndex, pageSize);
return query.OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToGridResultSet(pageIndex, pageSize);
}
public IList GetStockInStatisticsVieList(ViewModel.ConfiguretView configuretView, Guid? schoolyearID, Guid? supplierID, Guid? teachingMaterialID)
{
var query = StockInDetailDAL.GetStockInStatisticsGridView(x => x.RecordStatus == (int)CF_GeneralPurpose.IsYes);
if (schoolyearID.HasValue)
query = query.Where(x => x.SchoolyearID == schoolyearID);
if (supplierID.HasValue)
query = query.Where(x => x.SupplierID == supplierID);
if (teachingMaterialID.HasValue)
query = query.Where(x => x.TeachingMaterialPoolID == teachingMaterialID);
if (!string.IsNullOrEmpty(configuretView.ConditionValue))
return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.TeachingMaterialCode).ToList();
return query.OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToList();
}
}
}